Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Java Card Connected Edition Web samples on Eclipse?

Tags:

I downloaded Java Card Connected Edition 3.0.2 from Oracle official website and installed it. There are some web samples in JCDK. In documentation written:

All samples must be run from within the NetBeans IDE. They cannot be run from the command line in this release of the development kit.

Samples works with NetBeans IDE correctly. I can import them and run on Java Card Platform.

But I want to use this samples on Eclipse IDE. In Eclipse as Java Card SDK path I showed Java Card Connected home path. Then created new device and tried to start it [CardHolderApp for example]. But Eclipse gives:

ApduTool thread exited User input thread exited APDU|ApduTool [v3.0.2] APDU|    Copyright (c) 2009 Sun Microsystems, Inc. APDU|    All rights reserved. APDU|    Use is subject to license terms. APDU|Opening connection to localhost on port 9025. APDU|Connected. APDU|java.net.ConnectException: Connection refused: connect ApduTool process finished with code: 1 

.log file:

!ENTRY org.eclipse.core.jobs 4 2 2015-09-08 01:39:17.142 !MESSAGE An internal error occurred during: "Launching CardHolderApp". !STACK 0 java.lang.RuntimeException: Cannot start device. Please see the log.     at com.oracle.javacard.jcdk.launch.runconfiguration.AppletRunConfigurationDelegate.launch(AppletRunConfigurationDelegate.java:79)     at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:885)     at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)     at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)     at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)     at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) 

Is it possible to run Java Card Connected Web project in Eclipse IDE?

UPDATE:

Device started successfully. But project not deployed. It gives "unsupported String type constant" on every String usage. Code example:

public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {     response.setContentType("text/html"); // unsupported String type constant     PrintWriter out = response.getWriter();     RequestDispatcher dispatcher = null;     dispatcher = request.getRequestDispatcher("/WEB-INF/header.i");//unsupported String type constant     response.sendRedirect(response.encodeRedirectURL("http://www.sun.com"));//unsupported String type constant     dispatcher.include(request, response);     dispatcher.include(request, response); } 

Classic Edition did not support Strings. But it must work on Connected Edition.

like image 965
LEQADA Avatar asked Sep 08 '15 12:09

LEQADA


1 Answers

Forgetting about all the complicated software in between. Just looking at the error messages, it looks like port 9025 is not open or available on your localhost :

APDU|Opening connection to localhost on port 9025. APDU|Connected. APDU|java.net.ConnectException: Connection refused: connect ApduTool process finished with code: 1 

The text [java.net.ConnectException: Connection refused: connect], everytime I see "Connection refused" it means java tried to create a socket on the port (9025 in this case) and it could not get the port number either because of a blockage (like a firewall) or not available (something else is using port 9025).

On windows or *nix, you can usually use the netstat command to see what ports are being used.

hth, adym

like image 137
lincolnadym Avatar answered Sep 19 '22 11:09

lincolnadym