5

I need to debug an applet which is started by another java application(webstart) by opening the browser window. It was working fine with older versions of java, but with Java 1.7_45, the debug works only for the first JVM(which is the webstart application).

I use these parameters in the jcontrol:

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8086

I think there's nothing wrong with this, because the debugger attaches correctly. The only problem is, I can only debug the webstart application and not the applet which is run after that.

In the console of both the webstart application and the applet shows this:

Java Plug-in 10.45.2.18
Using JRE version
1.7.0_45-b18 Java HotSpot(TM) 64-Bit Server VM

The JNLP java process starts with the agentlib options I set in the jcontrol:

/usr/lib/jvm/java-7-oracle/jre/bin/java -Xmx512m -Xms128m 
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8086 
-Xbootclasspath/a:/usr/lib/jvm/java-7-oracle/jre/lib/javaws.jar:/usr/lib/jvm/java-7-oracle/jre/lib/deploy.jar:/usr/lib/jvm/java-7-oracle/jre/lib/plugin.jar 
-classpath /usr/lib/jvm/java-7-oracle/jre/lib/deploy.jar 
-Djnlpx.vmargs="-Xmx512m -Xms128m 
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8086" 
-Djnlpx.jvm=/usr/lib/jvm/java-7-oracle/jre/bin/java
....

When I open an applet I want to debug from this webstart app, new tab in firefox is opened and three processes are started:

/opt/firefox/plugin-container /usr/lib/jvm/java-7-oracle/jre/lib/amd64/libnpjp2.so -greomni /opt/firefox/omni.ja -appomni /opt/firefox/browser/omni.ja -appdir /opt/firefox/browser 13665 true plugin

/usr/lib/jvm/java-7-oracle/jre/bin/java -D__jvm_launched=8315888593 -D__applet_launched=8315738716 -Xbootclasspath/a:/usr/lib/jvm/java-7-oracle/jre/lib/deploy.jar:/usr/lib/jvm/java-7-oracle/jre/lib/javaws.jar:/usr/lib/jvm/java-7-oracle/jre/lib/plugin.jar -Djava.class.path=/usr/lib/jvm/java-7-oracle/jre/classes -Dsun.awt.warmup=true sun.plugin2.main.client.PluginMain write_pipe_name=/tmp/.com.sun.deploy.net.socket.13900.6946726655044877700.AF_UNIX

/usr/lib/jvm/java-7-oracle/jre/bin/java -D__jvm_launched=8317712180 -D__applet_launched=8315738716 -Xbootclasspath/a:/usr/lib/jvm/java-7-oracle/jre/lib/deploy.jar:/usr/lib/jvm/java-7-oracle/jre/lib/javaws.jar:/usr/lib/jvm/java-7-oracle/jre/lib/plugin.jar -Djava.class.path=/usr/lib/jvm/java-7-oracle/jre/classes -Djnlpx.session.data=/tmp/session6916520025949955515 -Dsun.awt.warmup=true sun.plugin2.main.client.PluginMain write_pipe_name=/tmp/.com.sun.deploy.net.socket.13900.3102318208570708149.AF_UNIX

As you can see, the debug port is not passed as a parameter to commands executing applet

I've tried to add new debug parameters to the applet tag(I've tried both Xdebug and agentlib), but it does nothing:

<param name="java_arguments" value="-Djnlp.packEnabled=true -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8087">

I've also tried to use appletviewer and after resolving problems with pack200 libraries, I'm stuck on this exception:

java.lang.NoClassDefFoundError: netscape/javascript/JSException
at java.lang.Class.getDeclaredConstructors0(Native Method)

But I wouldn't consider this as a solution because appletviewer doesn't work with pack200 and I'd have to add duplicate libraries to the server.

Is it somehow possible to:

  1. Define separate jdwp ports for webstart app and plugins?
  2. Listen on the same port for both?
  3. Choose for which one the debug will be used?

I use 64 bit oracle JDK 1.7.0_45-b18 and 64 bit Firefox on Linux.

1 Answer 1

1

Not really a solution, but there's a workaround for my problem.

  • Clear the java parameters in jcontrol
  • Start the webstart application
  • Add the java parameters again
  • Run applet

After that, the parameters are passed to applet only and debug works.

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.