Java 如何调试/记录/跟踪小程序加载问题?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1173180/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 00:31:25  来源:igfitidea点击:

How to debug/log/trace an applet loading problem?

javadebuggingloggingapplettrace

提问by Serxipc

Recently two of our clients have reported problems with our applets. Looking at the java plugin console it is full of ClassNotFoundException so none of our code is executed.

最近,我们的两个客户报告了我们的小程序问题。查看java插件控制台,它充满了ClassNotFoundException,所以我们的代码都没有执行。

I've been able to reproduce the stack trace using a virtual pc image with 0 free space on disk, but the problem goes away as I restore some disk space, and the users tell me that their disk is not full; they are able to create new files.

我已经能够使用磁盘上可用空间为 0 的虚拟 pc 映像重现堆栈跟踪,但是当我恢复一些磁盘空间时问题就消失了,并且用户告诉我他们的磁盘未满;他们能够创建新文件。

Our applet requires java 6, and the problem has appeared with updates 1, 10 and 14 of the jre. We have also tried different browsers (IE and Firefox), clearing the browser and java caches, ...

我们的小程序需要java 6,问题出现在jre的1、10、14更新。我们还尝试了不同的浏览器(IE 和 Firefox),清除浏览器和 Java 缓存,...

How can I debug or trace what is the jvm doing to load our applet?

我如何调试或跟踪 jvm 为加载我们的小程序所做的工作?

I suppose that the problem lies on some security directive on windows so I'm using Sysinternal's Process Monitor to log the activity but I don't really know where to look at.

我想问题出在 Windows 上的一些安全指令上,所以我使用 Sysinternal 的 Process Monitor 来记录活动,但我真的不知道在哪里查看。

采纳答案by Serxipc

I've been looking at the plugin source from the JDK and I've found that there is additional debug info available in the logs setting the environment variable JPI_PLUGIN2_DEBUG. Unfortunately I still only see ClassNotFoundexceptions.

我一直在查看来自 JDK 的插件源,我发现在设置环境变量的日志中有额外的调试信息可用JPI_PLUGIN2_DEBUG。不幸的是,我仍然只看到ClassNotFound例外。

I've found a piece of the plugin code that swallows all exceptions, so maybe my users problem is there...

我发现了一段包含所有异常的插件代码,所以也许我的用户问题就在那里......

回答by Thorbj?rn Ravn Andersen

The Java cache is most likely messed up. Open Java in the Control Panel and get rid of all temporary files to see if it goes away.

Java 缓存很可能被搞砸了。在控制面板中打开 Java 并清除所有临时文件以查看它是否消失。

Logging in the Java Console for loading applets can be enabled which helps quite alot (even if the plugin is extremely cryptic). See http://java.sun.com/javase/6/docs/technotes/guides/deployment/deployment-guide/tracing_logging.html

可以启用登录 Java 控制台以加载小程序,这有很大帮助(即使插件非常神秘)。请参阅http://java.sun.com/javase/6/docs/technotes/guides/deployment/deployment-guide/tracing_logging.html

回答by akarnokd

had similar problems a while ago. In our case, the problem seems to be how the applet tag is set up on the web page. If it is in a wrong order or contains the codebaseattribute, it fails with 6u10+. This works for us:

前阵子也遇到过类似的问题。在我们的例子中,问题似乎是如何在网页上设置小程序标签。如果顺序错误或包含codebase属性,则失败并显示 6u10+。这对我们有用:

<applet name="DMGANTT" archive="DMGantt.zip" code="dm.applet.DMGanttApplet" 
 width='100%' height='100%' mayscript="mayscript">

回答by Gonfva

We had a similar problem with one of our clients. We discovered that it was a strange bug in some versions of Java related to proxy configuration on the client. See this article for the details

我们的一位客户也遇到了类似的问题。我们发现这是一些 Java 版本中与客户端代理配置相关的一个奇怪的错误。详情请看这篇文章

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6723715

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6723715

Also, our applet failed with new versions for a different reason.

此外,由于不同的原因,我们的小程序在新版本上失败了。

Now, in similar cases I ask them to check javatester.org, so that I can see if applets (in general) load OK in their browser. If that page loads OK, its a problem on our applet (or page). Else it's a problem in their configuration. I help them anyway but it's easier to debug.

现在,在类似的情况下,我要求他们检查 javatester.org,以便我可以查看小程序(通常)在他们的浏览器中是否加载正常。如果该页面加载正常,则说明我们的小程序(或页面)有问题。否则就是他们的配置有问题。无论如何我都会帮助他们,但调试起来更容易。