简体   繁体   中英

FileNotFoundException during JNLP download

I was looking for a solution of this problem for weeks now, but did not find anything, which really related to my problem / or I already tried all suggested solutions, without any success.

I have a JNLP file, which is downloaded by the javaws properly (I think), but then before launching, it complains about not finding some files in the /tmp directory. Exact error message is:

CouldNotLoadArgumentException[ Could not load file/URL specified: /tmp/tmp_cache8259898691262575141.tmp]
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(Thread.java:745)
Caused by: java.io.FileNotFoundException: /tmp/tmp_cache8259898691262575141.tmp (Nincs ilyen fájl vagy könyvtár)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at java.io.FileInputStream.<init>(FileInputStream.java:93)
    at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
    ... 5 more

I checked the /tmp , the folder is of course there, and is writable. Funny thing is, that during downloading the tmp_cacheNNNNNN.tmp files are there! They appear one-by-one, as the download progress moves on. However when the download is finished something ( javaws ?) deletes all of them, and then starts to complain about missing them.

I have JNLP caching turned on (and intend to have it cached locally). I tried with JRE 1.8.0_40 , 1.8.0_65 , 1.8.0_66 , all gives the same result. Same result on windows and linux, both complain about missing files in the temp folder. The last JRE I managed to start is the 1.8.0_25 , and seems to work with 1.8.0_72 (beta). However the downloaded jar files are still not cached! (if I open up the jcontrol application and look into the cache, the JAR files are not there, and I also don't know why).

My JNLP looks like this:

<?xml version="1.0" encoding="utf-8"?>

<jnlp spec="7.0+"
      codebase="http://localhost:8080/jbaf-server/jnlp/swing-client"
      href="http://localhost:8080/jbaf-server/clientDownload/client.jnlp" >
    <information>
        <title>Swing Client</title>
        <vendor>www.xy.z</vendor>
        <description>Swing Client</description>
        <description kind="short">Swing Client</description>
        <homepage href="www.xy.z"></homepage>

        <icon href="images/jnlp-icon.png"/>
        <icon kind="splash" href="images/jnlp-splash.png"/>

        <offline-allowed/>

    </information>
    <security>
        <all-permissions/>
    </security>
    <resources>
        <j2se version="1.8+" initial-heap-size="256m" max-heap-size="1024m"/>


    <property name="jnlp.versionEnabled" value="true" />
    <jar href="jbaf-swing-client.jar" version="0.3.0" main="true"/>
.... (lots of jar files)
    <jar href="spring-expression.jar" version="4.2.3.RELEASE"/>
    <jar href="spring-tx.jar" version="4.2.3.RELEASE"/>
    <jar href="commons-codec.jar" version="1.10"/>


    </resources>
    <application-desc main-class="org.jbaf.swingclient.Main">
        <argument>http://localhost:8080/jbaf-server</argument>
        <argument>false</argument>
    </application-desc>
</jnlp>

The JARs are signed with self-signed cert.

I have no idea why this happens. Anyone faced such a problem?

Finally I managed to find the problem!

It was caused by following HTTP headers set by Tomcat:

I did not set these headers in my Servlets, but it seems that these were added by some of the filter previously. I set these header values to "" (empty string), and the JDK started to cache my files, and the application was started finally OK!

However if you set the Cache-Control to no-cache , the JDK still fails to start the application. The files are saved to the System/User temp directory, but afterwards it will not start, because the temp files are removed. This was only working with JDK 1.8.0_72 (BETA), all previous version failed!

Long story short: if you have problems with your JNLP where the WebStart tells you not finding files in the temp directory, check your HTTP Response Headers!

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