Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Web Start Cache Update: Always-Always = Never-Never

mosquitobytesJun 9 2011 — edited Jul 14 2011
JNLP version 6.0 introduced support for a new element "update" which accepts attributes "check" and "policy". If you don't specify this element in your jnlp file, the Web Start client that ships with Java 6 (I'm currently using update 22) defaults the attributes to check=timeout and policy=always. Or at least, this is what I see when I review my jnlp in the cache viewer.

I tried to set check to "always" and also set policy to "always" and after that, the web start client stopped checking for updates completely! Has anyone gotten this to work correctly?

Once the app gets in this state, the only way to register an update on the client is to either purge the client's cache, or (sometimes at least) to launch from a browser instead of from a Web Start Start-menu shortcut.

In an attempt to reduce the likelihood that this behavior was somehow related to our own code, I recreated the problem using a simple "HelloWorld" Web Start application, and I deployed it with the JNLPDownloadServlet sample that shipped with JDK 6 (Update 10). I did not modify any of the sample code, but I did customize the JNLP and web.xml files a bit, relative to what is documented in the JnlpDownloadServlet Guide. Here's what I'm using for a JNLP on the web server:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp codebase="$$codebase" href="HelloWorld.jnlp" >
<information>
<title>Hello World</title>
<vendor>Myself</vendor>
<description>just an example</description>
<icon href="images/hwjnlpicon.gif"/>
<shortcut online="true">
<menu submenu="Myself"/>
</shortcut>

</information>
<update check="always" policy="always"/>
<resources>
<j2se version="1.2+"/>
<jar href="application.jar" version="1.0" />
</resources>
<application-desc/>
</jnlp>


And here's what I see in the web start cache after web start has downloaded and parsed this jnlp and launched my application

<jnlp spec="1.0+" codebase="http://galileo/pjserv/servlet/JnlpDownloadServlet/" href="http://galileo/pjserv/servlet/JnlpDownloadServlet/HelloWorld.jnlp">
<information>
<title>Hello World</title>
<vendor>Myself</vendor>
<homepage href="null"/>
<description>just an example</description>
<icon href="http://galileo/pjserv/servlet/JnlpDownloadServlet/images/hwjnlpicon.gif" kind="default"/>
<shortcut online="true">
<menu submenu="Myself"/>
</shortcut>
</information>
<update check="always" policy="always"/>
<resources>
<java version="1.2+"/>
<jar href="http://galileo/pjserv/servlet/JnlpDownloadServlet/application.jar" version="1.0" download="eager" main="false"/>
</resources>
<application-desc/>
</jnlp>

I enabled DEBUG level logging in the download servlet. When I launch this application the first time, the downloadservlet log looks like this:
JnlpDownloadServlet(4): Initializing
JnlpDownloadServlet(3): Request: /pjserv/servlet/JnlpDownloadServlet/HelloWorld.jnlp
JnlpDownloadServlet(3): User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MS-RTC LM 8)
JnlpDownloadServlet(4): DownloadRequest[path=/servlet/JnlpDownloadServlet/HelloWorld.jnlp encoding=gzip, deflate isPlatformRequest=false]
JnlpDownloadServlet(4): Basic Protocol lookup
JnlpDownloadServlet(4): JnlpResource: JnlpResource[WAR Path: /servlet/JnlpDownloadServlet/HelloWorld.jnlp lastModified=Thu Jun 09 16:42:45 EDT 2011]]
JnlpDownloadServlet(3): Resource returned: /servlet/JnlpDownloadServlet/HelloWorld.jnlp
JnlpDownloadServlet(4): SupportQuery in Href: false
JnlpDownloadServlet(4): lastModified: 1307652165218 Thu Jun 09 16:42:45 EDT 2011
JnlpDownloadServlet(3): Request: /pjserv/servlet/JnlpDownloadServlet/HelloWorld.jnlp
JnlpDownloadServlet(3): User-Agent: JNLP/6.0 javaws/1.6.0_22 (b04) Java/1.6.0_22
JnlpDownloadServlet(4): DownloadRequest[path=/servlet/JnlpDownloadServlet/HelloWorld.jnlp encoding=gzip isPlatformRequest=false]
JnlpDownloadServlet(4): Basic Protocol lookup
JnlpDownloadServlet(4): JnlpResource: JnlpResource[WAR Path: /servlet/JnlpDownloadServlet/HelloWorld.jnlp lastModified=Thu Jun 09 16:42:45 EDT 2011]]
JnlpDownloadServlet(3): Resource returned: /servlet/JnlpDownloadServlet/HelloWorld.jnlp
JnlpDownloadServlet(4): SupportQuery in Href: true
JnlpDownloadServlet(4): lastModified: 1307652165218 Thu Jun 09 16:42:45 EDT 2011
JnlpDownloadServlet(3): Request: /pjserv/servlet/JnlpDownloadServlet/application.jar?version-id=1.0
JnlpDownloadServlet(3): User-Agent: JNLP/6.0 javaws/1.6.0_22 (b04) Java/1.6.0_22
JnlpDownloadServlet(4): DownloadRequest[path=/servlet/JnlpDownloadServlet/application.jar encoding=pack200-gzip,gzip query=version-id=1.0 version=1.0 isPlatformRequest=false]
JnlpDownloadServlet(4): Version-based/Extension based lookup
JnlpDownloadServlet(3): Rescanning directory: /servlet/JnlpDownloadServlet/
JnlpDownloadServlet(4): File directory: J:\ws\100a\indus\portalj\servlet\JnlpDownloadServlet
JnlpDownloadServlet(4): Read resource: JnlpResource[WAR Path: /servlet/JnlpDownloadServlet/application.jar versionId=1.0 name=application.jar lastModified=Thu Jun 09 12:59:43 EDT 2011] returnVersionId=1.0]
JnlpDownloadServlet(4): JnlpResource: JnlpResource[WAR Path: /servlet/JnlpDownloadServlet/application.jar versionId=1.0 name=application.jar lastModified=Thu Jun 09 12:59:43 EDT 2011] returnVersionId=1.0]
JnlpDownloadServlet(3): Resource returned: /servlet/JnlpDownloadServlet/application.jar
JnlpDownloadServlet(4): Real resource returned: JnlpResource[WAR Path: /servlet/JnlpDownloadServlet/application.jar versionId=1.0 name=application.jar lastModified=Thu Jun 09 12:59:43 EDT 2011] returnVersionId=1.0]
JnlpDownloadServlet(3): Request: /pjserv/servlet/JnlpDownloadServlet/images/hwjnlpicon.gif
JnlpDownloadServlet(3): User-Agent: JNLP/6.0 javaws/1.6.0_22 (b04) Java/1.6.0_22
JnlpDownloadServlet(4): DownloadRequest[path=/servlet/JnlpDownloadServlet/images/hwjnlpicon.gif encoding=gzip isPlatformRequest=false]
JnlpDownloadServlet(4): Basic Protocol lookup
JnlpDownloadServlet(4): JnlpResource: JnlpResource[WAR Path: /servlet/JnlpDownloadServlet/images/hwjnlpicon.gif lastModified=Fri May 18 09:28:14 EDT 2007]]
JnlpDownloadServlet(3): Resource returned: /servlet/JnlpDownloadServlet/images/hwjnlpicon.gif
JnlpDownloadServlet(4): Real resource returned: JnlpResource[WAR Path: /servlet/JnlpDownloadServlet/images/hwjnlpicon.gif lastModified=Fri May 18 09:28:14 EDT 2007]]



Launching the app a second time (from the desktop shortcut), the log looks like this:
JnlpDownloadServlet(3): Request: /pjserv/servlet/JnlpDownloadServlet/images/hwjnlpicon.gif
JnlpDownloadServlet(3): User-Agent: JNLP/6.0 javaws/1.6.0_22 (b04) Java/1.6.0_22
JnlpDownloadServlet(4): DownloadRequest[path=/servlet/JnlpDownloadServlet/images/hwjnlpicon.gif encoding=gzip isPlatformRequest=false]
JnlpDownloadServlet(4): Basic Protocol lookup
JnlpDownloadServlet(4): JnlpResource: JnlpResource[WAR Path: /servlet/JnlpDownloadServlet/images/hwjnlpicon.gif lastModified=Fri May 18 09:28:14 EDT 2007]]
JnlpDownloadServlet(3): Resource returned: /servlet/JnlpDownloadServlet/images/hwjnlpicon.gif
JnlpDownloadServlet(4): return 304 Not modified


As you can see, no request for the jar (which is expected, because it is using the version-based download protocol) but also no request for the jnlp file, which means that this app will never update.

If I change the "check" attribute to one of the other values: timeout, or background, then web start does query for the jnlp, but not with the behavior that I need.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 11 2011
Added on Jun 9 2011
1 comment
1,125 views