This discussion is archived
8 Replies Latest reply: Dec 8, 2012 3:37 AM by 950421 RSS

Dynamic jnlp problem in java7.

950421 Newbie
Currently Being Moderated
Hi, I have a webstart application using dynamically generated jnlp for the purpose of dealing with the dynamic parameters(logon user etc.). After application launched, will clear the jnlp cache so that the application will can be initialized correctly in next time launching, the code like this:
-----
DownloadService ds;
     try {
     ds = (DownloadService)ServiceManager.lookup("javax.jnlp.DownloadService");
     } catch (UnavailableServiceException e) {
     ds = null;
     }

     if (ds != null) {
     try { 
     // determine if a particular resource is cached,and remove the resource from the cache
     URL url = new URL("http://www.xxx.com/erp/webstart/Erp.jarjnlp");
     boolean cached = ds.isResourceCached(url, null);
     if (cached) {
     ds.removeResource(url, null);
     }
......
-----
It works fine in java6, but in the machine of which java upgrade to java7, the application cann't launch unless manually clear the cache every time before click the JNLP link in webpage.
The jnlp generation page of jsp as below:
-----
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0" xmlns:jfx="http://javafx.com" version="1.3">
<information>
<title>Mutual-win ERP</title>
<vendor>Mutual-win IT depatment</vendor>
<description>ERP rich FX client</description>
<!-- <offline-allowed/>-->
</information>
<update check="always" policy="always"/>
<resources>
<jfx:javafx-runtime version="2.1+" 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="Win2Erp.jar" size="223880" download="eager" />
<jar href="libs/apache-mime4j-0.6.jar" size="345048" download="eager" />
<jar href="libs/commons-beanutils-1.7.0.jar" size="188671" download="eager" />
<jar href="libs/commons-lang.jar" size="243016" download="eager" />
<jar href="libs/commons-logging.jar" size="60841" download="eager" />
<jar href="libs/datafx-redfx.jar" size="4364" download="eager" />
<jar href="libs/datafx.jar" size="100459" download="eager" />
<jar href="libs/datanucleus-json-2.0.0-m2.jar" size="70817" download="eager" />
<jar href="libs/flexjson-2.1.jar" size="81151" download="eager" />
<jar href="libs/gson-2.1.jar" size="180110" download="eager" />
<jar href="libs/httpclient-4.2.1.jar" size="427022" download="eager" />
<jar href="libs/httpcore-4.2.1.jar" size="223374" download="eager" />
<jar href="libs/httpmime-4.2.jar" size="26592" download="eager" />
<jar href="libs/javafx-calendar.jar" size="67457" download="eager" />
<jar href="libs/jnlp.jar" size="10211" download="eager" />
<jar href="libs/log4j-1.2.15.jar" size="391834" download="eager" />
</resources>
<security>
<all-permissions/>
</security>
<!--
<applet-desc width="900" height="800" main-class="com.javafx.main.NoJavaFXFallback" name="Win2Erp" >
<param name="requiredFXVersion" value="2.1+"/>
</applet-desc>
-->
<jfx:javafx-desc width="900" height="800" main-class="com.win2.erp.ui.ErpMain" name="Win2Erp" >
          <fx:param name="sid" value="<%=request.getParameter("JSESSIONID") %>"/>
          <fx:param name="domain" value="<%=request.getServerName()%>"/>
</jfx:javafx-desc>
-----
Is there any change in java7 on webstart? Thanks in advance!

Edited by: GrealeGe on 2012-12-2 下午9:04
  • 1. Re: Dynamic jnlp problem in java7.
    950421 Newbie
    Currently Being Moderated
    Here is the java console log, if failed to launch.
    ---
    basic: LaunchDesc location: http://192.168.18.35:8088/joffice/webstart//Win2Erp.jarjnlp
    network: Created version ID: 1.6.0.10
    preloader: Enter wait for preloader jars to be loaded
    preloader: Done with loading of preloader jars. Error=null
    network: Created version ID: 1.0
    network: Created version ID: 7.0
    network: Created version ID: 6.0.18
    network: Created version ID: 6.0.10
    network: Created version ID: 6.0
    network: Created version ID: 1.5
    network: Created version ID: 1.0
    basic: Relaunch because: [current UI toolkit does not match]
    Exception in thread "thread applet-com.win2.erp.ui.ErpMain-1" java.lang.NullPointerException
         at com.sun.deploy.cache.Cache.getCacheEntry(Unknown Source)
         at com.sun.deploy.cache.Cache.getCacheEntry(Unknown Source)
         at sun.plugin2.applet.viewer.JNLP2Viewer$1$3.appletJRERelaunch(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager.fireAppletJRERelaunch(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    cache: MemoryCache: removed entry http://192.168.18.35:8088/joffice/webstart//libs/datanucleus-json-2.0.0-m2.jar
    cache: MemoryCache: removed entry http://192.168.18.35:8088/joffice/webstart//libs/commons-beanutils-1.7.0.jar
    cache: MemoryCache: removed entry http://192.168.18.35:8088/joffice/webstart//libs/commons-lang.jar
    cache: MemoryCache: removed entry http://192.168.18.35:8088/joffice/webstart//libs/flexjson-2.1.jar
    cache: MemoryCache: removed entry http://192.168.18.35:8088/joffice/webstart//libs/httpcore-4.2.1.jar
    cache: MemoryCache: removed entry http://192.168.18.35:8088/joffice/webstart//libs/gson-2.1.jar
    cache: MemoryCache: removed entry http://192.168.18.35:8088/joffice/webstart//libs/httpclient-4.2.1.jar
    cache: MemoryCache: removed entry http://192.168.18.35:8088/joffice/webstart//Win2Erp.jar
    cache: MemoryCache: removed entry http://192.168.18.35:8088/joffice/webstart//libs/commons-logging.jar
    cache: MemoryCache: removed entry http://192.168.18.35:8088/joffice/webstart//libs/javafx-calendar.jar
    cache: MemoryCache: removed entry http://192.168.18.35:8088/joffice/webstart//libs/log4j-1.2.15.jar
    cache: MemoryCache: removed entry http://192.168.18.35:8088/joffice/webstart//libs/httpmime-4.2.jar
    cache: MemoryCache: removed entry http://192.168.18.35:8088/joffice/webstart//libs/apache-mime4j-0.6.jar
    cache: MemoryCache: removed entry http://192.168.18.35:8088/joffice/webstart//libs/datafx-redfx.jar
    cache: MemoryCache: removed entry http://192.168.18.35:8088/joffice/webstart//libs/jnlp.jar
    cache: MemoryCache: removed entry http://192.168.18.35:8088/joffice/webstart//libs/datafx.jar
    preloader: Stop progressCheck thread
  • 2. Re: Dynamic jnlp problem in java7.
    950421 Newbie
    Currently Being Moderated
    May be I'm not make myself clear, my question is: what exactly below log means? The application terminate when below message shown in java7 console.
    ---
    basic: Relaunch because: [current UI toolkit does not match]
    Exception in thread "thread applet-com.win2.erp.ui.ErpMain-1" java.lang.NullPointerException
         at com.sun.deploy.cache.Cache.getCacheEntry(Unknown Source)
         at com.sun.deploy.cache.Cache.getCacheEntry(Unknown Source)
         at sun.plugin2.applet.viewer.JNLP2Viewer$1$3.appletJRERelaunch(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager.fireAppletJRERelaunch(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    preloader: Stop progressCheck thread
  • 3. Re: Dynamic jnlp problem in java7.
    817614 Explorer
    Currently Being Moderated
    Possibly some bug already fixed. What is the JRE version that you use? Have you tried the latest http://jdk7.java.net/download.html
  • 4. Re: Dynamic jnlp problem in java7.
    817614 Explorer
    Currently Being Moderated
    I think what you saw is bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7191889
    The bug associated with JNLP file without href attribute. The work-around is to use JNLP attribute, example: <jnlp href="launch.jnlp"....
  • 5. Re: Dynamic jnlp problem in java7.
    950421 Newbie
    Currently Being Moderated
    Hi ntn,

    Thanks for your response.
    I have tried adding the JNLP attribute, but "file not found" error occurred, since actually there's no JNLP file exists in file system, it's dynamically generated by the JSP.
    By the way, I have Java7 u9 installed.
    ----
    java.io.FileNotFoundException: http://192.168.18.35:8088/joffice/webstart//Win2Erp.jnlp
         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 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.actionDownload(Unknown Source)
         at com.sun.deploy.net.DownloadEngine._downloadCacheEntry(Unknown Source)
         at com.sun.deploy.cache.ResourceProviderImpl.getResourceCacheEntry(Unknown Source)
         at com.sun.deploy.cache.ResourceProviderImpl.getResourceCacheEntry(Unknown Source)
         at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
         at com.sun.javaws.Launcher.updateFinalLaunchDesc(Unknown Source)
         at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
         at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
         at com.sun.javaws.Launcher.launch(Unknown Source)
         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(Unknown Source)

    Edited by: GrealeGe on 2012-12-4 下午11:37
  • 6. Re: Dynamic jnlp problem in java7.
    817614 Explorer
    Currently Being Moderated
    Have you tried latest early access build from http://jdk7.java.net/7u12.download.html ?
    Note that it is 7u12 not 7u10.
  • 7. Re: Dynamic jnlp problem in java7.
    950421 Newbie
    Currently Being Moderated
    It works after installed Java7 u12. thanks, ntn.
  • 8. Re: Dynamic jnlp problem in java7.
    950421 Newbie
    Currently Being Moderated
    Hi NTN,

    There's another problem still the same: cannot use DownLoadService to remove the cache of jnlp after application launched, next time when I login from website, my application will failed to login use the session of webpage, because Webstart will lauch the application with the parameters(generated in jnlp in last time) from the jnlp cache.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points