gpt4 book ai didi

java.lang.SecurityException : JAR manifest requested to run in all-permissons only 错误

转载 作者:行者123 更新时间:2023-11-30 07:02:47 25 4
gpt4 key购买 nike

我们有一个 Swing 应用程序,它通过 Java Web Start 下载并在本地机器上运行。但是在自动启动下载的 JNLP 文件后发生错误:

Application Blocked by Security Settings Name: Somename Location: http://localhost:8080 The Java security settings have prevented this application from running. You may change this behavior in the Java Control Panel.

此 URL 已添加到异常(exception)站点列表中。

此时 Java 控制台不工作,但如果在控制台中通过命令启动此 JNLP 文件:

javaws -verbose filename.jnlp

我们在跟踪中发现了一些异常:

java.lang.SecurityException: JAR manifest requested to run in all-permissons only: http://localhost:8080/path/to/jar/jarname.jar
at com.sun.deploy.security.DeployManifestChecker.verify(Unknown Source)
at com.sun.deploy.security.DeployManifestChecker.verify(Unknown Source)
at com.sun.deploy.security.SandboxSecurity.isPermissionGranted(Unknown Source)
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResourcesHelper(Unknown Source)
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResources(Unknown Source)
at com.sun.javaws.Launcher.prepareResources(Unknown Source)
at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main.access$000(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

该 Jar 文件的 list :

Manifest-Version: 1.0
version-time: 1926
version-number: 01.030.02.02
Ant-Version: Apache Ant 1.9.4
Application-Name: Somename
Permissions: all-permissions
version-date: March 4 2015
Created-By: 1.7.0_75-b13 (Oracle Corporation)
debug: on
Codebase: *

JNLP文件结构:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8080/" href="/warname/jnlp/filename.jsp">
<information>
<title>Title</title>
<vendor>Company</vendor>
<homepage href="http://www.foo.com"/>
<description>Description</description>
<offline-allowed/>
</information>
<resources>

<j2se max-heap-size="512m" initial-heap-size="128m"
version="1.3+"/>

<jar href="/warname/jnlp/lib/jarname.jar"/>
<jar href="/warname/jnlp/lib/jarname-2.jar" />

<extension href="/warname/jnlp/help.jsp" name="Java Help"/>
</resources>
<application-desc
main-class="path.to.class.Starter">
<argument>-java.naming.provider.url=someurl</argument>
<argument>-java.naming.factory.initial=someinitial</argument>
<argument>-java.naming.security.principal=login</argument>
<argument>-java.naming.security.credentials=password</argument>
<argument>-locatorConfig=server</argument>
<argument>-verbose</argument>
</application-desc>
</jnlp>

Java 版本:1.7.0_75。

出现该异常的原因是什么?应用无法启动的原因是什么?

最佳答案

“所有权限”设置意味着应用程序需要访问您的某些系统资源。

在这种情况下,Oracle 表示您必须在 JNLP 和 list 文件中定义相同的权限。您应该查看 JNLP 文件的“安全”元素:

<security>
<all-permissions/>
</security>

您可以找到更多信息here .

您可能必须更改 Java 安全设置。在 Windows 下,您应该在 Java 的控制面板上有一个图标。对于 Linux,您可以在 JDK 的 bin 目录中运行“ControlPanel”应用程序。

在“安全”选项卡下,您可以添加关于“本地主机”的异常(exception)。这应该可以帮助您解决问题。

关于java.lang.SecurityException : JAR manifest requested to run in all-permissons only 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28873375/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com