Java 7 更新 25 使我们的 Java Web 启动应用程序失败且没有日志记录 [英] Java 7 update 25 makes our java web start application fail with no logging

查看:19
本文介绍了Java 7 更新 25 使我们的 Java Web 启动应用程序失败且没有日志记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自 Oracle 发布的 java 7 update 25 以来,我们的应用程序不再运行.

Since the java 7 update 25 launched by Oracle our application no longer functions.

最初我们收到了一些关于代码库的警告 &Manifest 文件中缺少 sercurity 标记,我们已修复该问题.

Initially we got some warning about codebase & sercurity tags missing in the Manifest file, which we fixed.

我们现在最终遇到的问题是在控制台中我们只得到以下几行:

The problem we now end up with is that in the Console we only get the following lines:

#### Java Web Start Error:
#### null

我们还会收到一个应用程序错误对话框,其中包含以下消息:无法启动应用程序.

We also get an application Error dialog with the message: Unable to launch the application.

详细信息按钮在异常中提供以下详细信息:

The details button gives the following details in the Exception:

java.lang.NullPointerException
    at com.sun.jnlp.JNLPClassLoader.getPermissions(Unknown Source)
    at java.security.SecureClassLoader.getProtectionDomain(SecureClassLoader.java:206)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at desktop.DesktopProxySelector.<init>(DesktopProxySelector.java:24)     <- code smippet below
    at desktop.Main.main(Main.java:139)                                      <- code smippet below
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.sun.javaws.Launcher.executeApplication(Unknown Source)
    at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
    at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
    at com.sun.javaws.Launcher.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:724)

相关代码部分是:

Desktop.Main.main

/**
 * Main method, starts the application
 */
public static void main(String[] args) {
    System.setProperty("java.net.useSystemProxies", "true");

    //Logger.getLogger("httpclient.wire.header.level").setLevel(Level.FINEST);
    //Logger.getLogger("org.apache.commons.httpclient.level").setLevel(Level.FINEST);
    java.net.ProxySelector.setDefault(new DesktopProxySelector(java.net.ProxySelector.getDefault()));

(最后一行是第 139 行)

(The last line is line number 139)

desktop.DesktopProxySelector:

public class DesktopProxySelector extends ProxySelector {

    public  DesktopProxySelector(ProxySelector defaultSelector) {
    URI httpsUri = new CentralConfigurationService().getCentralLocation();

(最后一行是第 24 行发生异常的地方)

(The last line is line number 24 where the exception occures)

有人可以给我们一些线索提示(或更好的解决方案),以解决此次要"更新导致的 Java 新行为.

Can someone give us some clues hints (or better a solution) for this new behaviour of java caused by this 'minor' update.

当我们使用 java -jar Desktop.jar 直接从 cli 运行应用程序时,应用程序将运行文件,因此该问题显然与 java web start 中的更改有关.

When we run the application straight from the cli using java -jar Desktop.jar the application wil run file, so the issue has clearly something todo with the changes in java web start.

@trashgod:该错误显然与 7u25 中的权限更改有关,因为 NullPointerException 发生在 com.sun.jnlp.JNLPClassLoader.getPermissions 中.

@trashgod: the error clearly has something to do with the Permissions change in 7u25, since the NullPointerException occurs in com.sun.jnlp.JNLPClassLoader.getPermissions.

只是为了解释我认为发生的事情(我是 Wouter 的同事):desktop.Main 实例化一个 desktop.DesktopProxySelector(我们的类),desktop.DesktopProxySelector 实例化 desktop.configuration.CentralConfigurationServicedesktop.configuration.CentralConfigurationService 实例化一个 java.net.URI.

Just to explain what I think happens (I am a colleague of Wouter): desktop.Main instantiates a desktop.DesktopProxySelector (our class), desktop.DesktopProxySelector instantiates desktop.configuration.CentralConfigurationService desktop.configuration.CentralConfigurationService instantiates a java.net.URI.

在 DesktopProxySelector init 的第一行,其中实例化 CentralConfigurationService,getPermissions 方法由 JNLPClassLoader 调用,抛出 NullPointerException.因此,在通过 java webstart 加载 CentralConfigurationService 类并获取该类的权限时出现问题.这可能与实例化 URI 类的事实有关,这需要额外的权限(设置到远程 uri 的连接)?

On the first line of the DesktopProxySelector init where the CentralConfigurationService is instantiated the getPermissions method, called by the JNLPClassLoader, throws the NullPointerException. So something is going wrong while loading the CentralConfigurationService class by java webstart with getting the permissions for the class. Could that have anything to do with the fact that a URI class is instantiated, which requires extra permissions (a connection to a remote uri is setup)?

推荐答案

最终问题解决了.该问题是由主 MANIFEST.MF 文件中包含的 jar 文件与 launch.jnlp 中提到的 jar 文件不匹配引起的.

Eventually the problem was solved. The problem was caused between a mismatch in the included jar files in the main MANIFEST.MF file vs the jar files mentioned in the launch.jnlp.

显然,现在需要将所有要使用的 jar 文件也存在于 launch.jnlp 文件中.

Apperently it is now required to have all jar files that will be used also be present in the launch.jnlp file.

(过去决定手动将这个文件保存在sink中,这显然并不总是以适当的方式维护.现在这个过程是自动化的,所以问题不再发生在我们身上.)

(In the past it was decided to keep this file manually in sink, which obviously was not always maintained in a propper way. Now this process is automated, so the problem should no longer happen to us.)

这篇关于Java 7 更新 25 使我们的 Java Web 启动应用程序失败且没有日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆