Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remote debugging a jnlp application with eclipse

I'm debugging a jnlp application, and I used to be able to remote debug it through eclipse, but not anymore.

the command to start it is:

 /usr/java/jdk1.6.0_14/jre/bin/java -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1445 -Djnlpx.heapsize=64m,512m -DtrustProxy=true -Xverify:remote -Djava.security.policy=/lib/security/javaws.policy -Dfile.encoding=UTF-8 -Xbootclasspath/a:/usr/java/jdk1.6.0_14/jre/lib/deploy.jar:/usr/java/jdk1.6.0_14/jre/lib/javaws.jar:/usr/java/jdk1.6.0_14/jre/lib/plugin.jar -classpath /usr/java/jdk1.6.0_14/jre/lib/deploy.jar com.sun.javaws.Main launch.jnlp
Listening for transport dt_socket at address: 1445

and the problem is that when I attach the eclipse debugger, it shuts down and restarts; so the debugger attaches to the first process; and when that dies so does the debugger.

the debugger script actually doesn't matter; as the jnlp process re-starts on its own before the debugger ever gets launched if suspend=n .

I've tried tracing it, but the option -XX:TraceSupport=true (and other variations I have tried) causes a jvm error.

I'm using fedora 11, Eclipse Java EE IDE for Web Developers. (Build id: 20090621-0832)

I'm asking if anyone knows how to fix this, or at least how to turn on better logging (ie, capture all the console output to a log; so that I can take a look at the first console that flashes up on my screen for a millisecond)

thanks!

like image 261
Jill Avatar asked Nov 03 '09 19:11

Jill


2 Answers

This blog post has environment variables you can set to debug jnlp. This has always worked for me.

  set JAVAWS_TRACE_NATIVE=1

  set JAVAWS_VM_ARGS=-Xdebug -Xnoagent -Djava.compiler=NONE 
            -Xrunjdwp:transport=dt_socket,address=8989,server=y,suspend=y
  javaws http://server:port/descriptor.jnlp
like image 191
Andrew Niefer Avatar answered Oct 21 '22 05:10

Andrew Niefer


My Boss found the answer:

It appears that the “<property>” tags in the jnlp file are more restrictive with the newer JRE. According to the Sun documentation:

“For an untrusted application, system properties set in the JNLP file will only be set by Java Web Start if they are considered secure, or if the property name begins with "jnlp." or "javaws.".”

It looks like the untrusted status causes the application to launch a second time with the appropriate properties.

after recompiling and fixing a hopefully unrelated issue where newlines were causing the signed APPLICATION.JNLP and the launch.jnlp to not appear to be "the same", the debugger is now working.

like image 44
Jill Avatar answered Oct 21 '22 07:10

Jill