Java缓存经纪的声明可能有点苛刻,但这是我目前唯一能想到的。让我描述一下情况。
我在Netbeans 8中开发了一个JavaFX应用程序,它是通过Java webstart(JNLP)启动的。现在我已经更新了应用程序库。让我展示一下JNLP文件:
以前的版本:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0" xmlns:jfx="http://javafx.com" href="MyApp.jnlp">
<information>
<title>MyApp</title>
<vendor>Steven</vendor>
<description>...</description>
</information>
<resources>
<jfx:javafx-runtime version="2.2+" href="http://javadl.sun.com/webapps/download/GetFile/javafx-latest/windows-i586/javafx2.jnlp"/>
</resources>
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="Client.jar" size="1116009" download="eager" />
<jar href="lib/asm-all-repackaged-2.2.0-b21.jar" size="335827" download="eager" />
<jar href="lib/cglib-2.2.0-b21.jar" size="305575" download="eager" />
<jar href="lib/commons-codec-1.7-javadoc.jar" size="420581" download="eager" />
<jar href="lib/commons-codec-1.7-sources.jar" size="293412" download="eager" />
<jar href="lib/commons-codec-1.7.jar" size="283216" download="eager" />
<jar href="lib/commons-io-2.4-javadoc.jar" size="751883" download="eager" />
<jar href="lib/commons-io-2.4-sources.jar" size="261467" download="eager" />
<jar href="lib/commons-io-2.4.jar" size="200339" download="eager" />
<jar href="lib/eclipselink.jar" size="8886159" download="eager" />
<jar href="lib/guava-14.0.1.jar" size="2315551" download="eager" />
<jar href="lib/hk2-api-2.2.0-b21.jar" size="144295" download="eager" />
<jar href="lib/hk2-locator-2.2.0-b21.jar" size="156674" download="eager" />
<jar href="lib/hk2-utils-2.2.0-b21.jar" size="74396" download="eager" />
<jar href="lib/javax.annotation-api-1.2.jar" size="31700" download="eager" />
<jar href="lib/javax.inject-2.2.0-b21.jar" size="10062" download="eager" />
<jar href="lib/javax.servlet-api-3.0.1.jar" size="96886" download="eager" />
<jar href="lib/javax.ws.rs-api-2.0.jar" size="126026" download="eager" />
<jar href="lib/jaxb-api-2.2.7.jar" size="113870" download="eager" />
<jar href="lib/jersey-bundle-1.18.jar" size="1638880" download="eager" />
<jar href="lib/jersey-client.jar" size="170251" download="eager" />
<jar href="lib/jersey-common.jar" size="737307" download="eager" />
<jar href="lib/jersey-container-servlet-core.jar" size="60172" download="eager" />
<jar href="lib/jersey-container-servlet.jar" size="19624" download="eager" />
<jar href="lib/jersey-entity-filtering-2.5.1.jar" size="71150" download="eager" />
<jar href="lib/jersey-media-moxy-2.5.1.jar" size="29085" download="eager" />
<jar href="lib/jersey-server.jar" size="882351" download="eager" />
<jar href="lib/jfxtras-labs-0.1.jar" size="914928" download="eager" />
<jar href="lib/joda-time-2.1-javadoc.jar" size="1347677" download="eager" />
<jar href="lib/joda-time-2.1-sources.jar" size="721507" download="eager" />
<jar href="lib/joda-time-2.1.jar" size="643526" download="eager" />
<jar href="lib/jxl.jar" size="783553" download="eager" />
<jar href="lib/org.osgi.core-4.2.0.jar" size="261147" download="eager" />
<jar href="lib/osgi-resource-locator-1.0.1.jar" size="24816" download="eager" />
<jar href="lib/persistence-api-1.0.jar" size="64451" download="eager" />
<jar href="lib/validation-api-1.1.0.Final.jar" size="78045" download="eager" />
</resources>
<security>
<all-permissions/>
</security>
<applet-desc width="1024" height="768" main-class="com.javafx.main.NoJavaFXFallback" name="MyApp" >
<param name="requiredFXVersion" value="2.2+"/>
</applet-desc>
<jfx:javafx-desc width="1024" height="768" main-class="GUI.CL_MIT" name="MyApp" />
<update check="background"/>
</jnlp>
在新版本中,我们从Java 7切换到Java 8,从Jersey 1.18切换到2.我们也从jar中清理过,因为有些不应该在JNLP文件中(javadocs,sources)。所以这是新版本的JNLP文件:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0" xmlns:jfx="http://javafx.com" href="MyApp.jnlp">
<information>
<title>MyApp</title>
<vendor>Steven</vendor>
<description>...</description>
</information>
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="Client.jar" size="1133482" download="eager" />
<jar href="lib/asm-all-repackaged-2.2.0-b21.jar" size="335848" download="eager" />
<jar href="lib/cglib-2.2.0-b21.jar" size="305538" download="eager" />
<jar href="lib/commons-codec-1.7.jar" size="283227" download="eager" />
<jar href="lib/commons-io-2.4.jar" size="200335" download="eager" />
<jar href="lib/eclipselink.jar" size="8886707" download="eager" />
<jar href="lib/guava-14.0.1.jar" size="2315513" download="eager" />
<jar href="lib/hk2-api-2.2.0-b21.jar" size="144294" download="eager" />
<jar href="lib/hk2-locator-2.2.0-b21.jar" size="156658" download="eager" />
<jar href="lib/hk2-utils-2.2.0-b21.jar" size="74374" download="eager" />
<jar href="lib/javax.annotation-api-1.2.jar" size="31704" download="eager" />
<jar href="lib/javax.inject-2.2.0-b21.jar" size="10060" download="eager" />
<jar href="lib/javax.servlet-api-3.0.1.jar" size="96844" download="eager" />
<jar href="lib/javax.ws.rs-api-2.0.jar" size="126028" download="eager" />
<jar href="lib/jaxb-api-2.2.7.jar" size="113857" download="eager" />
<jar href="lib/jersey-client.jar" size="170237" download="eager" />
<jar href="lib/jersey-common.jar" size="737257" download="eager" />
<jar href="lib/jersey-container-servlet-core.jar" size="60162" download="eager" />
<jar href="lib/jersey-container-servlet.jar" size="19614" download="eager" />
<jar href="lib/jersey-entity-filtering-2.5.1.jar" size="71179" download="eager" />
<jar href="lib/jersey-media-moxy-2.5.1.jar" size="29089" download="eager" />
<jar href="lib/jersey-server.jar" size="882473" download="eager" />
<jar href="lib/joda-time-2.1.jar" size="643623" download="eager" />
<jar href="lib/jxl.jar" size="783441" download="eager" />
<jar href="lib/org.osgi.core-4.2.0.jar" size="261136" download="eager" />
<jar href="lib/osgi-resource-locator-1.0.1.jar" size="24823" download="eager" />
<jar href="lib/persistence-api-1.0.jar" size="64465" download="eager" />
<jar href="lib/validation-api-1.1.0.Final.jar" size="78031" download="eager" />
</resources>
<security>
<all-permissions/>
</security>
<applet-desc width="1024" height="768" main-class="com.javafx.main.NoJavaFXFallback" name="MyApp" >
<param name="requiredFXVersion" value="2.2+"/>
</applet-desc>
<jfx:javafx-desc width="1024" height="768" main-class="GUI.CL_MIT" name="MyApp" />
<update check="background"/>
</jnlp>
现在,当我们通过我们的网站启动新版本时,我们会收到以下错误:
正如您所看到的,我们收到一条错误消息,指出jar commons-codec-1.7-javadoc.jar 缺失。怎么会这样?这个jar甚至不在新版本的JNLP文件中?为什么Java会尝试加载这个jar?
所以我的猜测是它与缓存有关。我尝试过以下选项:
虽然我的头发在一分钟变得越来越灰,但我只是想到了#34; F ---这个,我只是禁用缓存&#34;。所以我做了:
我回到我的网站重新运行应用程序,看到加载屏幕,我很惊讶程序运行良好......没有任何错误!作为测试问题,我已经再次启用了在我的计算机上保存临时文件选项并且错误...错误已经恢复。
所以最重要的问题是,到底发生了什么?我做错了什么吗? Netbeans编译是否存在问题,或者我在添加库时遇到了什么问题? Java缓存有问题吗?
任何帮助,想法,线索都会非常感激!
提前致谢, Perneel the Gray。