How can I debug applications in Java Web Start (JNLP)?

I know how I can debug a remote Java virtual virtual machine using Eclipse, but how to do it using Java Web Start. I have a problem that only occurs in Java Web Start. This should be related to security.

I need a solution that will work with the current Java virtual machine, for example 1.6.0_12.

+48
java debugging java-web-start jnlp
Mar 26 '09 at 14:35
source share
9 answers

This is exactly the same as with any other Java process that you want to debug remotely: you need to set some arguments for the virtual machine ( -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=n,suspend=y,address=12345 ) and then connect to this port. In Java Webstart 6.0, this can be done using the -J option, in an earlier version, through the JAVAWS_VM_ARGS environment variable. More details here .

+25
Mar 26 '09 at 15:06
source share

Launch the JWS VM manually. This way you can provide startup options to open the debug port. Here is a description, it looks 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 
+23
Mar 26 '09 at 15:15
source share

Regarding newer versions of Java (Java 8u20 + and Java 7u70 +), I realized that parameters like -Xrunjdwp cannot be passed directly or not use JAVAWS_VM_ARGS. The message Rejecting attempt to specify insecure property: -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 began to be displayed on the console output.

The only solution that worked for me was to pass these arguments to the JAVA_TOOL_OPTIONS system variable.

+15
Nov 06 '14 at
source share

You can also specify the debug parameter for 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 
+9
May 21 '13 at 8:11
source share

You will need to do the following:

  • Enable Java Logs and Tracing in the Java Control Panel> Advanced. Java Control Panel: Logs and Tracing

  • To enable options for debugging Java (optional but useful, that is, problems with tls / ssl handshake like close_notify or handshake_failure) and running JNLP, there are two ways to do this:

    2.a. Download the JNLP file and execute it from the command line (the SET command is not required in this particular case).

     set JAVA_TOOL_OPTIONS=-Djavax.net.debug=all javaws -wait jnlp.jnlp 

    2b. Add arguments (i.e. -Djavax.net.debug=all ) for the JVM in the Java> Java> View control panel (this is not required in this particular one) and run the JNLP file from the browser:

    Java control panel: jvm arguments

  • Logs and traces are located in the log directory from Java Deployment Home , from where I paste these places:

    but. Windows XP: %HOME%\Application Data\Sun\Java\Deployment

    b. Windows 7 / Vista: %APPDATA%\..\LocalLow\Sun\Java\Deployment

    from. Linux / Solaris: %HOME%/.java/deployment

With javax.net.debug = all you will see a handshake if the jar inside jnlp is loaded from an https connection. Such problems are difficult 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: 
+4
Aug 07 '17 at 17:13
source share

To debug a Web Start application on Linux, create a shell script ~ / bin / javaws-debug.sh with javaws in debug mode, as described above:

~ / bin / javaws-debug.sh:

 #!/bin/sh export JAVAWS_TRACE_NATIVE=1 export JAVAWS_VM_ARGS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8989,server=y,suspend=n" javaws "$@" 

Then in your browser, select the script as the application to invoke in jnlp files.

For example, in Firefox, go to "Edit" โ†’ "Settings" โ†’ "Applications", "Content Type: Java Web Start" and select "Use Other" in action and select a script in the "Select a Helper Application" dialog box. In Chrome, you need to change your Linux system settings. In KDE, go to "System Preferences" โ†’ "File Associations", "Known Types": application: x-java-jnlp file, add a new application, select ~ / bin / javaws-debug.sh from "Select Application for Application / x -java -jnlp-file ".

After setting up your browser, the Java Web Start application will start using your shell, which will allow the debugger to connect to port 8989.

+2
Jun 14 '13 at 16:49
source share

Using Java 8 and Windows 10, open a command prompt (cmd.exe) and enter the following:

 set JAVAWS_TRACE_NATIVE=1 set JAVA_TOOL_OPTIONS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 javaws java-app.jnlp 
+2
Jul 12 '17 at 0:12
source share

Have you tried printing a debug log? This is a useful thing, which should be in any case, and can help in this case.

If you need real debugging, see, for example, Here: How to debug in WebStart?

+1
Mar 26 '09 at 15:12
source share

You can run JNLP with debugging enabled:

 javaws -Xnosplash -J-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5009 <application>.jnlp 

Exit: Listening to the dt_socket transport at: 5009

Attach to this with your favorite IDE, I use IntelliJ IDEA Run> Attach to Process

+1
Sep 07 '19 at 9:12
source share



All Articles