【发布时间】:2016-07-13 15:36:43
【问题描述】:
我有一个由 servlet 动态生成的 JNLP 文件。生成的 JNLP 为:
<jnlp spec="6.0+" href="launch?param1=Hooolas">
<information>
<title>JSGD</title>
<vendor>evconsul</vendor>
<homepage href=""/>
<description>JSGD</description>
<description kind="short">JSGD</description>
<offline-allowed/>
</information>
<update check="background"/>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.8+"/>
<jar href="http://192.168.0.17:8080/Secu/huella/JSGD.jar" main="true"/>
</resources>
<application-desc main-class="jsgd.JSGD">
<argument>Hooolas</argument>
</application-desc>
</jnlp>
客户端机器中的错误:
java.lang.NullPointerException
at com.sun.javaws.JnlpxArgs.execProgram(Unknown Source)
at com.sun.javaws.Launcher.relaunch(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)
Missing Application-Name manifest attribute for: http://192.168.0.17:8080/Secu/huella/JSGD.jar
#### Java Web Start Error:
#### null
我已经将所有库打包到一个名为 JSGD.jar 的 jar 中,它的结构是:
JSGD.jar
-jsgd
-META-INF
-org
-SecugenLib
我的jar的网址是:http://192.168.0.17:8080/Secu/huella/JSGD.jar
我已经通过 Netbeans 8.1 打包了我的应用程序 Files->/buil.xml 右键单击 Run Target->Other Targets->package-for-store。 这会在 Store 文件夹中生成一个 jar。这个 jar 具有上述结构。
在我的机器上运行正常(当代码库属性为:codebase="http://localhost:8080/Secu/" 当然!)。会有什么问题? JRE 版本 1.7.0_79-b15(客户端机器) 我使用 Netbeans 8.1
详情:
我已经覆盖了 build.xml 添加下一行;将所有类打包在一个 jar 中:
<target name="package-for-store" depends="jar">
<!-- Cambien el valor de esta propiedad para dar el nombre al JAR,
sin la extensión .jar. No debe tener espacios.
<property name="store.jar.name" value="NombreDelJar"/>
-->
<property name="store.jar.name" value="JSGD"/>
<!-- No editar nada después de esta línea -->
<property name="store.dir" value="store"/>
<property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/>
<echo message="Packaging ${application.title} into a single JAR at ${store.jar}"/>
<delete dir="${store.dir}"/>
<mkdir dir="${store.dir}"/>
<jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip">
<zipgroupfileset dir="dist" includes="*.jar"/>
<zipgroupfileset dir="dist/lib" includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
<attribute name="Application-Name" value="JSGD"/>
<attribute name="Trusted-Only" value="true"/>
<attribute name="Permissions" value="sandbox"/>
<attribute name="Codebase"
value="http://192.168.0.17 http://localhost"/>
</manifest>
</jar>
<zip destfile="${store.jar}">
<zipfileset src="${store.dir}/temp_final.jar"
excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/>
</zip>
<delete file="${store.dir}/temp_final.jar"/>
</target>
更新
按照@mosquito-x 的建议,事情似乎变得更好了,但是 Java 7(我也在 jre-8u91 中尝试)阻止了它。 消息是:
Application Blocked by Java Security.
Name: JSGD
From: http://192.168.0.17
Reason: The Java Security Settings have this application from running. You may change this behavior in Java Control Panel.
在 Java 控制面板站点列表中。我已经添加了这些网站:
http://192.168.0.17:8080
http://192.168.0.17:8080/Secu
http://192.168.0.17:8080/Secu/huella
http://192.168.0.17:8080/Secu/launch
提前致谢!
【问题讨论】:
-
请务必使用 JaNeLA 检查 JNLP,可通过我的share drive 获取。
-
嗨@AndrewThompson CVC - complex - type.2.4.a:从元素“security”中发现无效内容。他期望'{资源,应用程序 - desc,applet - desc 组件 - desc,-desc 安装程序}'之一。谢谢!
-
这通常意味着 JNLP 中的某些元素的顺序错误。检查JNLP File Syntax 以找到正确的顺序。
-
@FernandoPie 你找到解决方案了吗?我面临同样的问题。
标签: java java-web-start jnlp