我喜歡使用Java Web Start將我的Java遊戲演示放到網絡上,以便用戶可以查看遊戲角色並與其進行交互等。JWS堆棧溢出錯誤
我使用Eclipse導出可運行jar特性將項目導出到jar文件。然後我能夠成功地運行java -jar
。我成立了一個test.jnlp
文件,如下:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="/home/bili/JWSdeploytest/" href="test.jnlp">
<information>
<title>Demo</title>
<vendor>binman</vendor>
<description>Test</description>
<offline-allowed/>
</information>
<resources>
<jar href="LoadbonesFOrmat.jar" main="true"/>
<extension name="Demo" href="test.jnlp" />
</resources>
<security>
<all-permissions/>
</security>
<application-desc />
</jnlp>
我試圖與調試打開,我從這裏其他職位讀本地測試它在我的機器上:
set JAVAWS_TRACE_NATIVE=1
set JAVAWS_VM_ARGS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket, address=8989,server=y,suspend=n"
但是當我運行javaws test.jnlp
我得到StackOverflowError
。以下是輸出:
[email protected]:~/JWSdeploytest$ javaws -J test.jnlp
Exception in thread "Demo" java.lang.StackOverflowError
at java.util.LinkedHashMap$LinkedHashIterator.<init>(LinkedHashMap.java:362)
at java.util.LinkedHashMap$LinkedHashIterator.<init>(LinkedHashMap.java:362)
at java.util.LinkedHashMap$KeyIterator.<init>(LinkedHashMap.java:400)
at java.util.LinkedHashMap$KeyIterator.<init>(LinkedHashMap.java:400)
at java.util.LinkedHashMap.newKeyIterator(LinkedHashMap.java:413)
at java.util.HashMap$KeySet.iterator(HashMap.java:891)
at java.io.ExpiringCache.cleanup(ExpiringCache.java:117)
at java.io.ExpiringCache.get(ExpiringCache.java:74)
at java.io.UnixFileSystem.canonicalize(UnixFileSystem.java:152)
at java.io.File.getCanonicalPath(File.java:576)
at sun.security.provider.PolicyFile.canonPath(PolicyFile.java:1872)
at java.io.FilePermission$1.run(FilePermission.java:203)
at java.io.FilePermission$1.run(FilePermission.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.io.FilePermission.init(FilePermission.java:200)
at java.io.FilePermission.<init>(FilePermission.java:266)
at java.lang.SecurityManager.checkRead(SecurityManager.java:888)
at net.sourceforge.jnlp.config.DeploymentConfiguration.getProperty(DeploymentConfiguration.java:269)
at net.sourceforge.jnlp.SecurityDesc.getCustomTrustedPolicy(SecurityDesc.java:172)
at net.sourceforge.jnlp.SecurityDesc.<init>(SecurityDesc.java:159)
at net.sourceforge.jnlp.Parser.getSecurity(Parser.java:553)
at net.sourceforge.jnlp.JNLPFile.parse(JNLPFile.java:594)
at net.sourceforge.jnlp.JNLPFile.<init>(JNLPFile.java:178)
at net.sourceforge.jnlp.JNLPFile.<init>(JNLPFile.java:211)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.getInstance(JNLPClassLoader.java:351)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.initializeExtensions(JNLPClassLoader.java:370)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.<init>(JNLPClassLoader.java:174)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.getInstance(JNLPClassLoader.java:295)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.getInstance(JNLPClassLoader.java:351)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.initializeExtensions(JNLPClassLoader.java:370)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.<init>(JNLPClassLoader.java:174)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.getInstance(JNLPClassLoader.java:295)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.getInstance(JNLPClassLoader.java:351)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.initializeExtensions(JNLPClassLoader.java:370)
三條線295:351:370被重複了十幾次。 它從輸出中看起來好像有一些限制訪問正在進行。我檢查並驗證Jar文件jnlp是允許執行/讀取的。
我開始懷疑我是否需要Web服務器來測試它。在我心中懷疑,因爲我從來沒有與JWS工作然而幾件事情:
- 有些事情錯的jar文件(我沒有正確導出)
- 的
test.jnlp
配置不正確
任何關於如何解決JWS業務的指針?
編輯:我已刪除了進一步擴展元素,它拋出另一個異常:
[email protected]:~/JWSdeploytest$ javaws test.jnlp
net.sourceforge.jnlp.LaunchException: Fatal: Launch Error: Could not launch JNLP file.
at net.sourceforge.jnlp.Launcher.launchApplication(Launcher.java:596)
at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:887)
Caused by: java.lang.IllegalArgumentException: file:/home/bili/JWSdeploytest/LoadbonesFOrmat.jar is not a cacheable resource
at net.sourceforge.jnlp.cache.CacheUtil.getCacheFile(CacheUtil.java:297)
at net.sourceforge.jnlp.Launcher.launchApplication(Launcher.java:561)
... 1 more
Caused by:
java.lang.IllegalArgumentException: file:/home/bili/JWSdeploytest/LoadbonesFOrmat.jar is not a cacheable resource
at net.sourceforge.jnlp.cache.CacheUtil.getCacheFile(CacheUtil.java:297)
at net.sourceforge.jnlp.Launcher.launchApplication(Launcher.java:561)
at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:887)
這一次似乎更直觀,我敢肯定這timethat我沒有正確打包的Jar文件。稍後再試一次。 下面是JaNeLA輸出:
content type application/xml does not equal expected type of application/x-java-jnlp-file
XML encoding not known, but declared as utf-8
Codebase '/home/bili/JWSdeploytest/' is a malformed URL! Defaulting to file:/home/bili/JWSdeploytest/test.jnlp
Codebase '/home/bili/JWSdeploytest/' is a malformed URL! Defaulting to file:/home/bili/JWSdeploytest/test.jnlp
Codebase '/home/bili/JWSdeploytest/' is a malformed URL! Defaulting to file:/home/bili/JWSdeploytest/test.jnlp
Codebase '/home/bili/JWSdeploytest/' is a malformed URL! Defaulting to file:/home/bili/JWSdeploytest/test.jnlp
Downloads can be optimized by specifying a resource size for 'LoadbonesFOrmat.jar'.
The resource download at LoadbonesFOrmat.jar can be optimized by removing the (default) value of download='eager'.
Lazy downloads might not work as expected for LoadbonesFOrmat.jar unless the download 'part' is specified.
我搬到資源要素之上的安全元素擺脫CVC-複雜type.2.4.a的:根據網站上JaNeLa的幫助文件。在控制檯中,它說文檔是有效的,但數據可能仍然是錯誤的!
您已將'applet'標記添加到問題中,但JNLP指示這是一個應用程序(JWS可以啓動)。它是一個applet,還是不是? – 2012-02-13 02:59:44
這不是一個小程序對不起!這真的很早,我只是想完成這個問題。 – bili 2012-02-13 08:43:14
感謝您的確認(以及編輯標籤的良好感覺)。 :) – 2012-02-13 09:10:23