JNLP 中的 JVM class 加载程序跟踪选项

JVM class loader tracing options in JNLP

我正在尝试调试 class 正在通过 JNLP 运行 调用的 java 加载问题。但是 -XX:+TraceClassLoading 只打印 'Loaded' 事件并且只针对核心 classes。另一个选项 -verbose:class 什么都不做。我试着用 D 和 X 作为前缀,但没有效果。

当我在桌面 java 应用程序中使用 -verbose:class 时,它打印所有事件都很好,但这里没有出现错误。

我是不是遗漏了什么或者是否有其他方法可以跟踪 class JNLP 中的加载?

编辑:
我尝试过的例子(这是 javaws 调用扩展成的):

/usr/lib/jvm/jdk1.8.0_161/jre/bin/java -classpath /usr/lib/jvm/jdk1.8.0_161/jre/lib/deploy.jar -Djava.security.policy=file:/usr/lib/jvm/jdk1.8.0_161/jre/lib/security/javaws.policy -DtrustProxy=true -verbose:class -XX:+TraceClassLoading -Xverify:remote -Djnlpx.home=/usr/lib/jvm/jdk1.8.0_161/jre/bin -Djava.security.manager -Djnlpx.origFilenameArg=http://localhost:8080/webstart.jnlp -Djnlpx.remove=false -Dsun.awt.warmup=true -Xbootclasspath/a:/usr/lib/jvm/jdk1.8.0_161/jre/lib/javaws.jar:/usr/lib/jvm/jdk1.8.0_161/jre/lib/deploy.jar:/usr/lib/jvm/jdk1.8.0_161/jre/lib/plugin.jar -Djnlpx.splashport=59367 -Djnlpx.jvm=/usr/lib/jvm/jdk1.8.0_161/jre/bin/java com.sun.javaws.Main -notWebJava http://localhost:8080/webstart.jnlp

来自 JNLP 运行 的部分输出(无用户 classes):

[Loaded java.lang.UNIXProcess$$Lambda/1173574345 from java.lang.UNIXProcess]
[Loaded com.sun.javaws.Launcher$CacheUpdateRequiredException from /usr/lib/jvm/jdk1.8.0_161/jre/lib/javaws.jar]
[Loaded java.lang.SecurityException from /usr/lib/jvm/jdk1.8.0_161/jre/lib/rt.jar]
[Loaded com.sun.deploy.security.BlockedException from /usr/lib/jvm/jdk1.8.0_161/jre/lib/deploy.jar]
[Loaded sun.awt.X11.XSystemTrayPeer from /usr/lib/jvm/jdk1.8.0_161/jre/lib/rt.jar]

来自桌面的部分输出 java 运行(注意来自 .m2 存储库的用户 classes 是的,它在 _151 上是 运行 但没有区别,我都试过了):

[Loaded <...>.UnmodifiableArrayIterator from file:/home/imaskar/.m2/repository/<...>/1.6-SNAPSHOT/<...>-1.6-SNAPSHOT-jar-with-dependencies.jar]
[Loaded <...>.RCEvent from file:/home/imaskar/.m2/repository/<...>/1.6-SNAPSHOT/<...>-1.6-SNAPSHOT-jar-with-dependencies.jar]
[Loaded <...>.RCMessengerQualityListener from file:/home/imaskar/.m2/repository/<...>/1.6-SNAPSHOT/<...>-1.6-SNAPSHOT.jar]
[Loaded javax.swing.JComponent$$Lambda4/1794174740 from javax.swing.JComponent]
[Loaded java.util.prefs.FileSystemPreferences from /usr/lib/jvm/jdk1.8.0_151/jre/lib/rt.jar]
[Loaded java.util.prefs.FileSystemPreferences from /usr/lib/jvm/jdk1.8.0_151/jre/lib/rt.jar]
[Loaded java.util.prefs.FileSystemPreferences from /usr/lib/jvm/jdk1.8.0_151/jre/lib/rt.jar]

编辑2

Here 建议将选项传递给 jnlp 的另一种方法,但它也只打印核心 classes。我想,这是因为选项只传递给第一个 java 调用,它只管理部署,然后对实际应用程序进行另一个调用。

解决方法

  1. 运行 javaws http://localhost:8080/webstart.jnlp 稍等一下,以便它部署并启动
  2. 运行 ps -ax | grep Djnlpx 并复制完全展开的 JNLP 调用
  3. 从 p1 关闭应用程序
  4. -verbose:class(或您想要的任何其他选项)添加到来自 p2 的调用,然后再次 运行。

说明

我发现 javaws 调用扩展了两次。所以,基本调用是

javaws http://localhost:8080/sin-web/webstart.jnlp

如果我尝试在此处添加任何选项,都无济于事。 它扩展为

/usr/lib/jvm/jdk1.8.0_151/jre/bin/java
 -classpath
 /usr/lib/jvm/jdk1.8.0_151/jre/lib/deploy.jar
 -Djava.security.policy=file:/usr/lib/jvm/jdk1.8.0_151/jre/lib/security/javaws.policy
 -DtrustProxy=true
 -Xverify:remote
 -Djnlpx.home=/usr/lib/jvm/jdk1.8.0_151/jre/bin
 -Djava.security.manager
 -Djnlpx.origFilenameArg=http://localhost:8080/sin-web/webstart.jnlp
 -Djnlpx.remove=false
 -Dsun.awt.warmup=true
 -Xbootclasspath/a:/usr/lib/jvm/jdk1.8.0_151/jre/lib/javaws.jar:/usr/lib/jvm/jdk1.8.0_151/jre/lib/deploy.jar:/usr/lib/jvm/jdk1.8.0_151/jre/lib/plugin.jar
 -Djnlpx.splashport=44975
 -Djnlpx.jvm=/usr/lib/jvm/jdk1.8.0_151/jre/bin/java
 com.sun.javaws.Main
 -verbose
 -notWebJava
 http://localhost:8080/sin-web/webstart.jnlp

换行符为了便于阅读,您必须将其删除。如果你把 -verbose:class 放在这里它只会打印核心 类。该调用扩展为:

/usr/lib/jvm/jdk1.8.0_161/jre/bin/java 
-Xmx1g -Xms256m 
-Djnlp.packEnabled=false 
-Xbootclasspath/a:/usr/lib/jvm/jdk1.8.0_161/jre/lib/javaws.jar:/usr/lib/jvm/jdk1.8.0_161/jre/lib/deploy.jar:/usr/lib/jvm/jdk1.8.0_161/jre/lib/plugin.jar 
-Djnlp.tk=awt 
-classpath /usr/lib/jvm/jdk1.8.0_161/jre/lib/deploy.jar -Djnlpx.vmargs=LVhteDFnAC1YbXMyNTZtAC1Eam5scC5wYWNrRW5hYmxlZD1mYWxzZQA= -Djnlpx.jvm=/usr/lib/jvm/jdk1.8.0_161/jre/bin/java 
-Djnlpx.splashport=59367 
-Djnlpx.home=/usr/lib/jvm/jdk1.8.0_161/jre/bin 
-Djnlpx.remove=false 
-Djnlpx.offline=false 
-Djnlpx.relaunch=true 
-Djnlpx.session.data=/tmp/session2497443162302588696 
-Djnlpx.heapsize=NULL,NULL 
-Djava.security.policy=file:/usr/lib/jvm/jdk1.8.0_161/jre/lib/security/javaws.policy 
-DtrustProxy=true 
-Xverify:remote 
-Djnlpx.origFilenameArg=http://localhost:8080/webstart.jnlp 
-Dsun.awt.warmup=true 
-Djava.security.manager 
com.sun.javaws.Main 
-notWebJava 
/home/imaskar/.java/deployment/cache/6.0/1/40a358c1-677ef294

重新换行以提高可读性。如果您在此处放置 -verbose:class,则会打印所有 类 个事件。