小程序无法加载

时间:2010-01-05 09:04:37

标签: java applet

我们有一个从Java 1.3移植到Java 1.5的遗留程序。此应用程序涉及之前工作正常的小程序。但是在移植之后,applet将无法加载。但是没有错误或例外。该应用程序只会尝试永远加载它。我们尝试用Java 1.6和poof运行它!没有任何问题。 Java 6不向后兼容吗?那怎么会在那个版本中运行而不是在1.5?

====

Java 1.5.0_19的Java控制台日志

basic: Registered modality listener
basic: Registered modality listener
basic: Registered modality listener
liveconnect: Invoking JS method: document
liveconnect: Invoking JS method: document
liveconnect: Invoking JS method: document
liveconnect: Invoking JS method: URL
liveconnect: Invoking JS method: URL
liveconnect: Invoking JS method: URL
basic: Referencing classloader: sun.plugin.ClassLoaderInfo@bb7759, refcount=1
basic: Referencing classloader: sun.plugin.ClassLoaderInfo@bb7759, refcount=2
basic: Referencing classloader: sun.plugin.ClassLoaderInfo@bb7759, refcount=3
basic: Added progress listener: sun.plugin.util.GrayBoxPainter@b0bad7
basic: Loading applet ...
basic: Initializing applet ...
basic: Starting applet ...
basic: Added progress listener: sun.plugin.util.GrayBoxPainter@ba9340
basic: Added progress listener: sun.plugin.util.GrayBoxPainter@1198891
basic: Loading applet ...
basic: Initializing applet ...
basic: Starting applet ...
basic: Loading applet ...
basic: Initializing applet ...
basic: Starting applet ...
basic: Referencing classloader: sun.plugin.ClassLoaderInfo@bb7759, refcount=4
basic: Releasing classloader: sun.plugin.ClassLoaderInfo@bb7759, refcount=3
basic: Referencing classloader: sun.plugin.ClassLoaderInfo@bb7759, refcount=4
basic: Releasing classloader: sun.plugin.ClassLoaderInfo@bb7759, refcount=3
basic: Referencing classloader: sun.plugin.ClassLoaderInfo@bb7759, refcount=4
basic: Releasing classloader: sun.plugin.ClassLoaderInfo@bb7759, refcount=3
network: Connecting <something>.jar with proxy=HTTP @ proxy/<ip address>
basic: Loading <something>.jar from cache
basic: No certificate info, this is unsigned JAR file.
Left START init()
Left END init()
Right START init()
Control start() Waiting for Left Panel to load...
Right START start()
network: Connecting socket://<ip address>:14444 with proxy=DIRECT
Control start() Waiting for Left Panel to load...
Control start() Waiting for Left Panel to load...
Control start() Waiting for Left Panel to load...
my HostName : <ip address>
Thread-19 Check : 
Thread-19 Check : Monitor : run : start
Thread-20 Monitor : Monitor: run() start
Control start() Waiting for Left Panel to load...
Control start() Waiting for Left Panel to load...
Control start() Waiting for Left Panel to load...
Control start() Waiting for Left Panel to load...
Control start() Waiting for Left Panel to load...
Control start() Waiting for Left Panel to load...

最后一条消息永远持续......现在有了工作版本:

====

Java 1.6.0_15的Java控制台日志

basic: Added progress listener:   sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@1b000e7
basic: Added progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@12611a7
basic: Added progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@1807ca8
network: CleanupThread used 6 us
network: CleanupThread used 5 us
network: CleanupThread used 6 us
cache: Skip blacklist check as cached value is ok.
network: Cache entry found [url: <something>.jar, version: null]
network: Connecting <something>.jar with proxy=HTTP @ proxy/<ip address>
network: ResponseCode for <something>.jar : 304
network: Encoding for <something>.jar : null
network: Disconnect connection to <something>.jar
Reading certificates from 11 <something>.jar | <something>.idx
network: No certificate info for unsigned JAR file: <something>.jar
basic: Applet loaded.
basic: Applet loaded.
basic: Applet resized and added to parent container
basic: Applet resized and added to parent container
basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 330275 us, pluginInit dt 27768955 us, TotalTime: 28099230 us
Right START init()
basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 330275 us, pluginInit dt 27770563 us, TotalTime: 28100838 us
Left START init()
basic: Applet loaded.
basic: Applet resized and added to parent container
basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 330275 us, pluginInit dt 27779332 us, TotalTime: 28109607 us
Left END init()
basic: Applet initialized
basic: Removed progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@12611a7
basic: Applet made visible

就是这样。仍然没有弄清楚为什么它适用于java6而不是java5。


@valli:使用了对象标记,而不是applet

@thorbjorn:我已经尝试过了......它一直在说加载小程序......

@aaron:我怎么知道它是什么异常,如果有的话呢?是的,我们认为它是一个java bug,但我还没有发现那个bug是什么。我明天要提交一份报告,我已经在网上搜索过,但到目前为止还没有提出任何报告......

@all:谢谢你的回复

4 个答案:

答案 0 :(得分:0)

在某个地方可能有一个例外,但你没有看到它(也许它被吞噬了)。或者它是您的Java 5版本中的一个错误,已在Java 6中修复。

答案 1 :(得分:0)

一个可能的问题是,如果您的applet使用“applet”标记嵌入到html页面中,则必须将其修改为使用“object”标记,因为不推荐使用“applet”标记。

答案 2 :(得分:0)

在控制台中启用Java控制台以及所有跟踪/调试信息。

然后尝试重新加载您的applet并查看其内容。

答案 3 :(得分:0)

Java 6向后兼容Java 5,但这只意味着在Java 5下工作的applet也适用于Java 6.您的applet适用于Java 6,它没有说明它是否适用于Java 5。显然,Java 6中的新功能在Java 5下运行时不可用。

如果您的代码使用的是仅在Java 6下可用的类,我希望在Java 5下看到ClassDefNotFoundErrorClassNotFoundException。那就是说,代码中某处可能正在捕获并默默地吞咽异常。查找任何空的catch块或过宽的catch块(即捕获异常或Throwable而不是更具体的东西)。如果代码是多线程的,请考虑向每个线程添加uncaught exception handlers以记录任何问题。

除此之外,在(JDK 5)Applet Viewer中启动applet并附加调试器以试图找出问题的位置。

编辑:您是否使用JDK5构建了applet?这将突出任何兼容性问题。如果使用JDK 6构建,至少应将编译器设置为生成Java 5字节码。但是最好还要构建JDK 5类(通过使用JDK 5,或者使用JDK 6的-bootclasspath选项),以便您可以查看是否使用了不在其中的任何内容。< / p>