java web start无法在第二次运行时启动

时间:2011-06-24 06:29:22

标签: java telerik jnlp

我编写了一个基本的java程序来测试jnlp并从eclipse导出为runnable jar并使用jarsigner签名。

jnlp文件如下

<?xml version="1.0" encoding="utf-8"?>
    <jnlp spec="1.0+" codebase="http://192.168.2.15/test" href="test.jnlp">
        <information>
            <title>test</title>
            <vendor>test</vendor>
            <homepage href="http://192.168.2.15/test" />
            <description>test</description>
        </information>
        <security>
            <all-permissions/>
        </security>
        <resources>
            <j2se version="1.6+" />
            <jar href="test.jar" />
        </resources>
        <application-desc main-class="Test.main">
        </application-desc>
    </jnlp>

当我使用[javaws http://192.168.2.15/test/test.jnlp]进行测试时,它在第一次运行时按预期工作。

当我第二次重试时,Java web start无法在程序中休息并发出以下错误

java.io.IOException: Server returned HTTP response code: 500 for URL: [http://192.168.2.15/test/test.jar]
    at sun.reflect.GeneratedConstructorAccessor2.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
    at com.sun.deploy.net.BasicHttpRequest.doGetRequestEX(Unknown Source)
    at com.sun.deploy.net.DownloadEngine.isUpdateAvailable(Unknown Source)
    at com.sun.deploy.net.DownloadEngine.isUpdateAvailable(Unknown Source)
    at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
    at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
    at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
    at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: [http://192.168.2.15/test/test.jar]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at java.net.HttpURLConnection.getResponseCode(Unknown Source)
    ... 13 more

当我通过javaws -uninstall从缓存中取消程序并尝试运行javaws [http://192.168.2.15/test/test.jnlp]时,它通常会在第一次运行时工作,但是当我尝试我第二次得到同样的错误。

我的测试平台是Windows 7终极版,并安装了最新的java版本。

我是Java的新手,我找不到问题。你能帮帮我吗?

使用JaNeLA检查我的JNLP文件的结果:

JaNeLA报告 - 版本11.05.17

报告http://192.168.2.15/sistem/toplanti/test.jnlp

  • XML编码未知,但声明为utf-8
  • Codebase + href'http://192.168.2.15/Sistem/Toplanti/test.jnlp'不等于'http://192.168.2.15/sistem/toplanti/test.jnlp'的实际位置。
  • 通过添加标记来优化此应用程序以进行离线使用。
  • 可以通过为'test.jar'指定资源大小来优化下载。
  • 可以通过删除download ='eager'的(默认)值来优化test.jar上的资源下载。
  • 可以通过删除main ='false'的(默认)值来优化test.jar上的资源下载。
  • 可以优化应用的启动。通过为test.jar资源指定download ='lazy'。
  • 除非指定了下载“部分”,否则延迟下载可能无法按预期运行test.jar。

我仍在尝试解决这个问题,当我在使用os作为windows xp的pc上测试jnlp时,我没有得到任何错误,同样的jnlp始终在运行(对于第一次运行,第二次运行,... 。) 还有另外一台PC(Windows 7专业版),我也测试过,并得到了相同的错误,即第一次工作,第二次运行得到错误......

3 个答案:

答案 0 :(得分:1)

经过一些测试后,我终于解决了我的问题。我发现它与web.config有关,对于我的应用程序,我使用的是telerik工具,web.config中有一行用于压缩,[add name="RadCompression" type="Telerik.Web.UI.RadCompression" preCondition="integratedMode" ]。我通过评论(删除)这一行解决了我的问题。

:)

答案 1 :(得分:0)

看起来您正在使用的Web服务器在尝试访问URL时返回错误500.

如果是这样,Java WebStart不是问题,而是Web服务器。你是如何设置的?

答案 2 :(得分:0)

使用JaNeLA检查JNLP。

相关问题