简体   繁体   中英

java web start is unable to launch on the second run

I write a basic java program to test jnlp and export as runnable jar from eclipse and signed with jarsigner.

The jnlp file is as follows

<?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>

when I make a test with [javaws http://192.168.2.15/test/test.jnlp], it works as expected for the first run.

When I retry the second time, Java web start is unable to lunch the program and giving the following error

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

When I unistall the program from cache by javaws -uninstall and try to run by javaws [http://192.168.2.15/test/test.jnlp] it is normally againg working for the first run but when I try the second time I am getting the same error above.

My test platform is Windows 7 ultimate and latest java version is installed.

I am new in Java and I could not find the problem. Could you help me?

Result of checking my JNLP file with JaNeLA:

JaNeLA Report - version 11.05.17

Report for http://192.168.2.15/sistem/toplanti/test.jnlp

  • XML encoding not known, but declared as utf-8
  • Codebase + href 'http://192.168.2.15/Sistem/Toplanti/test.jnlp' is not equal to actual location of 'http://192.168.2.15/sistem/toplanti/test.jnlp'.
  • Optimize this application for off-line use by adding the flag.
  • Downloads can be optimized by specifying a resource size for 'test.jar'.
  • The resource download at test.jar can be optimized by removing the (default) value of download='eager'.
  • The resource download at test.jar can be optimized by removing the (default) value of main='false'.
  • It might be possible to optimize the start-up of the app. by specifying download='lazy' for the test.jar resource.
  • Lazy downloads might not work as expected for test.jar unless the download 'part' is specified.

I am still trying to solve the problem, and when I tested the jnlp on pc having os as windows xp, I did not get any error, the same jnlp is running always(for the first run, second run,...) There is also another pc(windows 7 professional) I tested on in also and got the same error ie, working for the first time and for the second run getting the error...

I finally solved my problem after making some number of tests. I found that it's related to the web.config, and for my application I am using telerik tools and there is a line in web.config for compression such that [add name="RadCompression" type="Telerik.Web.UI.RadCompression" preCondition="integratedMode" ] . I solved my problem by commenting (removing) this line.

:)

It looks like the web server you are using returns an error 500 when trying to access the URL.

If so, it is not a problem with Java WebStart but with your web server. How have you set this up?

使用JaNeLA检查JNLP。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM