I know how I can debug a remote Java VM with Eclipse, but how can I do it with a Java Web Start program. I have a problem that only occurs in Java Web Start. It must be secu
Have you tried printing a debug log? That is a useful thing to have at any rate, and might help in this case.
If you want real debugging, see e.g. here: How can I debug under WebStart?
You can run your JNLP with debugging enabled:
javaws -Xnosplash -J-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5009 <application>.jnlp
Output: Listening for transport dt_socket at address: 5009
Attach to this with your favorite IDE, I use IntelliJ IDEA Run>Attach to process
Start the JWS VM manually. This way you can provide the startup parameters to open the debug port. Here is a description, it goes like this:
set JAVAWS_TRACE_NATIVE=1
set JAVAWS_VM_ARGS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8989,server=y,suspend=n"
javaws http://server:port/descriptor.jnlp
You can also provide the debug parameter to the javaws executable using the -J option
Example:
javaws.exe -J-Xdebug -J-Xnoagent -J-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 http://server:port/descriptor.jnlp
You will need to do the following:
Enable the Java logs and tracing in the Java Control Panel > Advanced.
Enable parameters for debugging Java (optional but useful i.e. problems with tls/ssl handshake as close_notify or handshake_failure) & launching the JNLP, there are two ways you can do it:
2.a. Download the JNLP file and execute it from command line (the SET
command is not required in this particular case).
set JAVA_TOOL_OPTIONS=-Djavax.net.debug=all
javaws -wait jnlp.jnlp
2.b. Add arguments (i.e. -Djavax.net.debug=all
) for the JVM in the Java Control Panel > Java > View (this is not required in this particular), and launch the JNLP file from browser:
The logs and traces are located in the log
directory from the Java Deployment Home from where I paste these locations:
a. Windows XP: %HOME%\Application Data\Sun\Java\Deployment
b. Windows 7/Vista: %APPDATA%\..\LocalLow\Sun\Java\Deployment
c. Linux/Solaris: %HOME%/.java/deployment
With javax.net.debug=all you will see the handshake if the jar inside the jnlp is loaded from an https connection. This kind of problems are hard to debug.
...
%% No cached client session
*** ClientHello, TLSv1.2
...
***
...
Java Web Start Main Thread, received EOFException: error
Java Web Start Main Thread, handling exception: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
Java Web Start Main Thread, SEND TLSv1.2 ALERT: fatal, description = handshake_failure
Java Web Start Main Thread, WRITE: TLSv1.2 Alert, length = 2
Java Web Start Main Thread, called closeSocket()
#### Java Web Start Error:
It's quite the same like with any other Java process you want to debug remotely: You have to set up some arguments for the VM (-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=n,suspend=y,address=12345
) and then connect to the given port. In Java webstart 6.0 this can be done with the -J option, in earlier version via environment variable JAVAWS_VM_ARGS. See details here.