【问题标题】:applet does not load小程序无法加载
【发布时间】:2010-01-05 09:04:37
【问题描述】:

我们有一个从 Java 1.3 移植到 Java 1.5 的遗留程序。此应用程序涉及以前运行良好的小程序。然而,移植后,小程序将无法加载。但是没有错误或异常。该应用程序只会尝试永远加载它。我们尝试使用 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:使用了对象标签,而不是小程序

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

@aaron:如果真的有异常,我怎么知道它是什么异常?是的,我们认为它是一个 java 错误,但我仍然没有找到那个错误是什么。我明天必须提交一份报告,我已经在网上搜索过,但目前还没有任何结果......

@all:谢谢你的回复

【问题讨论】:

  • 给个加载小程序的html代码怎么样?
  • 不能。我们不被允许。我们的合同中有一些关于此的内容......对不起。
  • 如果有帮助的话,我添加了 java 控制台日志。虽然我删除/更改了一些部分,如类名和目录

标签: java applet


【解决方案1】:

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

【讨论】:

    【解决方案2】:

    一个可能的问题是,如果您的小程序使用“applet”标签嵌入到 html 页面中,则必须修改它以使用“object”标签,因为“applet”标签已被弃用。

    【解决方案3】:

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

    然后尝试重新加载您的小程序并查看它的内容。

    【讨论】:

      【解决方案4】:

      Java 6 向后兼容 Java 5,但这只是意味着在 Java 5 下工作的小程序也可以在 Java 6 上工作。你的小程序在 Java 6 上工作,这没有说明它是否应该在 Java 5 上工作。有显然 Java 6 中的新特性在 Java 5 下运行时不可用。

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

      除此之外,在 (JDK 5) Applet Viewer 中启动小程序并附加调试器以尝试查明问题的位置。

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

      【讨论】:

      • 我们使用 JDK5 构建小程序。我尝试使用 Java 5 和使用 Java 6 运行小程序... java 控制台中的日志不同,所以也许它真的是版本中的问题?无论如何,我会尝试你的建议。谢谢你:)
      猜你喜欢
      • 1970-01-01
      • 2013-06-22
      • 2014-12-23
      • 1970-01-01
      • 2021-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多