gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 11:53:08 26 4
gpt4 key购买 nike

我编写了一个基本的 java 程序来测试 jnlp 并从 eclipse 导出为可运行的 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
  • 代码库 + 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,延迟下载可能无法按预期工作。

我仍在努力解决这个问题,当我在操作系统为 windows xp 的电脑上测试 jnlp 时,我没有收到任何错误,同样的 jnlp 一直在运行(第一次运行,第二次运行,.. .)还有另一台电脑(Windows 7 专业版)我也测试过并得到同样的错误,即第一次工作和第二次运行得到错误......

最佳答案

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

:)

关于java web start 无法在第二次运行时启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6464231/

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