23

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.

4
  • Have you looked at eclipse-jcde.sourceforge.net EclipseJCDE? Commented Sep 18, 2015 at 13:33
  • As far as I know it is for Classic edition. Not for servlets.
    – LEQADA
    Commented Sep 18, 2015 at 18:58
  • 1
    Have you checked the plugin provided by Oracle? It also states "Classic Edition", but I'd give it a try.
    – cheffe
    Commented Sep 23, 2015 at 9:35
  • Yes I checked it too. I could not get it work with Connected Edition.
    – LEQADA
    Commented Sep 23, 2015 at 10:14

1 Answer 1

1

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

7
  • It doesn't matter wich port I'm trying to use. Same error. As I know Connected Edition Dev. Kit works only on Windows. The same code works on NetBeans clearly and gives error on Eclipse even when firewall is turned off.
    – LEQADA
    Commented Sep 28, 2015 at 7:00
  • So with Eclipse up and running, what does the netstat -a command list out? Might help to repeat with NetBeans up and running, then compare the two netstat -a outputs...of course, close out Eclipse before starting NetBeans. Commented Sep 30, 2015 at 2:04
  • Something else I noticed on your stack trace...Are you running it in a Debug mode...I see DebugUIPlugin? Because a debugger is going to open a port to allow you to step thru code. Did you try and just use a Run Configuration (no debugger)? Commented Sep 30, 2015 at 2:15
  • it's not debug mode. Device started. But it gives me "unsupported string type constant" on every String I am using (for example response.setContentType("text/html");). So, it seems that this device on Eclipse only for Classic Edition. Maybe there is some other method to set up default device to work with Connected Edition. Or maybe that's not possible to run on Eclipse. Maybe I need to contact Oracle for more information.
    – LEQADA
    Commented Sep 30, 2015 at 20:31
  • Port is opened. But project is not deployed. Browser couldn't load the page.
    – LEQADA
    Commented Sep 30, 2015 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.