I've got an app that has a resource jar that is almost 10 MiB. I'm being asked to increase it's payload up to 30 MiB and am concerned because sometimes the Java Web Start (JWS) fails at the current size. I've used Wireshark to see that sometimes it fails to download the entire file.
Since the resources aren't needed initially in the program, after some research I thought I would give the download=lazy attribute of the jar resource a try. I've got a simple Swing dialog JWS app that attempts to load org.postgresql.Driver via Class.forName in response to a button click. My main jar is indexed (META-INF/INDEX.LIST) and the lazy load looks great on initial launch.
First run only downloads jnlplazy.jnlp and JNLPLazyDownloader.jar
Invoking Class.forName for org.postgresql.Driver downloads lib/postgresql-8.3-603.jdbc3.jar
Additional attempts in that run result in no additional downloads.
Then I close the program, touch lib/postgresql-8.3-603.jdbc3.jar on the web server and launch the test app again. JWS hits the server for all three files with an If-Modified-Since header and gets the "updated" postgresql jar.
304 - jnlplazy.jnlp
304 - JNLPLazyDownloader.jar
200 439723 lib/postgresql-8.3-603.jdbc3.jar
Then I invoke Class.Forname and it downloads the postgresql jar again, this time without If-Modified-Since, and again the web server shows it sends it again.
I verified with Wireshark that the bits are all being sent down twice. It's as if the "check for updates" download ignored the response data but remembered that there was a response that it needed to ask for later when that jar was referenced. I can reproduce this every time. I haven't even gotten to making sure a download progress is shown. At 400K downloading a couple times is an annoyance. At 30M it will be a pain.
Have others seen this? Is it a bug or am I just doing something wrong.
Maybe I'm tackling the problem in the wrong way anyway, especially if the JWS implementation of the Java Nework Launching Protocol (JNLP) DownloadService times out too quickly or is otherwise unreliable on large files and doesn't support restartable or incremental downloads just like the automagic download. After all the reading I've done I am still scratching my head on when to use the JNLP API vs having it auto-magically handled via the JNLP file entries.
I did some testing with the javax.jnlp classes to see what the API would tell me about the state of the files for the two runs, before and after updating the timestamp on the postgresql jar. I added a different button and call the following code on it's action handler:
Here is the output of that code before touching the postgresql jar:
I have some set of jar in My library folder. Among that jar 2 jar version will be changed dynamically
i.e., abc.jar previous version will be 1.10 and after build it will be 1.11 and after next build it will be 1.12
I have cache in my local to lauch application quickly. but the problem is this dynamic version is regonized some time and some time not(taking the previous version).
I am loading the jar based on the diff. If same version the jar will downloaded from Cache, Jar vrsion diffence will be downlaoded newly..
Exact problem is sometimes it downlaoding some times taking the previous version, so that i need to clear cache each time...!!!
Please have a look at our posting policies, namely UseOneThreadPerQuestion. Since you've started another thread for your question (and that is correct), I'm locking this thread so that any discussion happens at just one thread.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Double-download of JNLP download=lazy jars