[Solved} Problem with JNLP caching in OpenWebStart

The public knowledge pool and discussion forum of the OWS community. Do not post confidential information here!
msc
Posts: 13
Joined: 09 Dec 2021, 07:18

[Solved} Problem with JNLP caching in OpenWebStart

Post by msc »

Hello,

We have different versions of the same application deployed in various docker-containers on the same server, so they all resolve to the same IP.
We access them as app_v1.host.com/myapp.jnlp, app_v2.host.com/myapp.jnlp etc. (I believe everything goes through an nginx reverse proxy).

I have installed OpenWebStart 1.5.0 on my computer and started app_v1, everything went fine.
Then, I started app_v2. I got the right version of myapp.jnlp downloaded (codebase is app_v2.host.com), but instead of app_v2, app_v1 was started (with the jnlp from cache).

I cleared the cache and then started app_v2 again. This time it started ok.
Then I started app_v1. That also went ok, but the myapp.jnlp that was already cached (originating from app_v2) was overwritten by the myapp.jnlp from app_v1. Probably because it is newer than the one from app_v2. Still, the two apps should not interfere whit one another, even though they use a jnlp with the same name, because they come from different containers.
If I try to start app_v2 again, with the right jnlp (codebase app_v2), OpenWebStart starts app_v1.

My assumption is that OpenWebStart cannot distinguish between the two servers because they both resolve to the same IP. So it only keeps the newest version of the jnlp in the cache, instead of keeping both versions.
If I clear the cache between starts, everything works ok.

I tried to do exactly the same with Java Webstart from Oracle and it works without any problems. Both versions of myapp.jnlp and of every jar exist in the Java cache.
OpenWebStart overwrites everything with the newest version:
- the jnlp file
- all the jars that have the same version in both apps
- all the unversioned jars (jars which don´t have a version attribute in the jar tag in myapp.jnlp).

Is there a way to solve this through settings in OpenWebStart or is that really a bug?
Thank you!

Janak Mulani
Posts: 726
Joined: 24 Mar 2020, 13:37

Re: Problem with JNLP caching in OpenWebStart

Post by Janak Mulani »

Firstly, OWS works with the URLs provided to it :
1. as an argument to javaws executable
2. the codebase and the href in the jnlp
3. then the jnlp pointed to by the href

OWS does not manipulate the URLs. So it is important to look at the Jnlps and their attributes like codebase and href to make sure that there aren't clashes of names.

Secondly, OWS's behavior could be different from Oracle Java Web Start in some ways for example how the Jnlp apps are downloaded and cached, how JVMS are chosen and downloaded, etc. Oracle Java Web Start code is not open source, while OWS is based on IcedTea-Web which is the open source implementation of JRS-56.

To be able to help you we should be able to reproduce your issue. We can offer you a paid consultation where in we can jointly review your Jnlps and your server setup to understand your issues and propose a fix. We also offer various support packages https://openwebstart.com/#supportoptions

msc
Posts: 13
Joined: 09 Dec 2021, 07:18

Re: Problem with JNLP caching in OpenWebStart

Post by msc »

Thank you for your answer, although I'd like to ask you to clarify a little further:

As I said before, the URLs provided to OWS are app_v1.host.com/myapp.jnlp, app_v2.host.com/myapp.jnlp etc. What I mean by "provided to OWS" is that I click on a link "app_v1.host.com/myapp.jnlp" in my browser, the myapp.jnlp is downloaded and then automatically started with OWS because of the file association in Windows.

For each link, the right myapp.jnlp is downloaded. I get two different versions of myapp.jnlp in my Downloads folder (myapp.jnlp and myapp(1).jnlp). Each of them contains the right codebase (app_v1.host.com and app_v2.host.com respectively). But no matter which one of the two I start, I get the same application, namely the one corresponding to the cached myapp.jnlp.
The problem ist that there is only one cached myapp.jnlp, although I have two different URLs.

So, I'm not really sure what you mean by "OWS does not manipulate the URLs". Does OWS cache the files based on the URLs or based on the IPs they resolve to? Does OWS see app_v1.host.com/myapp.jnlp and app_v2.host.com/myapp.jnlp as two different jnlps or as one and the same jnlp when app_v1.host.com and app_v2.host.com resolve to the same IP?

Also, I don't really understand what you mean by "clashes of names". I have two versions of the same application under two different URLs on the same sever, so 90% of the application is essentially the same in both deployments. They both use the same jnlp name, many of the same jars etc. But the jnlp files use different codebases, so one has something like
<jnlp codebase="http://app_v1.host.com/" href="myapp.jnlp" ...>
and the other one
<jnlp codebase="http://app_v2.host.com/" href="myapp.jnlp" ...>.
These two applications shouldn't interfere with one another, although they use jnlp files and jars with the same names, because they come from two different URLs and two different codebases.

Of course OWS is not Oracle Java Web Start and can behave differently. I only told you how Oracle Java Web Start behaves in this instance because I expected OWS to do the same. That´s why I asked if this should be considered a bug in OWS or if it´s the expected and intended behaviour.
Because if it´s a bug, then maybe we can wait until a fix comes out. But if it´s intended, then we need to instruct our users to deactivate OWS caching entirely.

So what I´m asking is: does OWS cache by URL or by IP? If it caches by IP: is that a bug that needs to be fixed or is it intended behaviour? Can I somehow configure the way OWS caching works?

Thank you again for your time.

Janak Mulani
Posts: 726
Joined: 24 Mar 2020, 13:37

Re: Problem with JNLP caching in OpenWebStart

Post by Janak Mulani »

>
I click on a link "app_v1.host.com/myapp.jnlp" in my browser, the myapp.jnlp is downloaded and then automatically started with OWS because of the file association in Windows.
>

Is OWS started automatically or are you supposed to "open" the downloaded jnlp? My experience with Chrome, Firefox, Edge is that when a jnlp link is clicked it the browser down loads the file which you have to "open" explicitly.

>
But no matter which one of the two I start, I get the same application, namely the one corresponding to the cached myapp.jnlp.
>
How are you starting? By clicking on the desktop shortcut or by rt-clk "open" on the downloaded jnlp file.

>
The problem ist that there is only one cached myapp.jnlp,
>
In which directory is this cached myapp.jnlp?

>
<jnlp codebase="http://app_v1.host.com/" href="myapp.jnlp" ...>
and the other one
<jnlp codebase="http://app_v2.host.com/" href="myapp.jnlp" ...>.
>

Do these http://app_v1.host.com/myapp.jnlp and http://app_v2.host.com/myapp.jnlp have href? To which jnlp are they pointing and what is the codebase and href in that jnlp?

As I said we will need to look at all your jnlps, your cache and your server set up to really understand your issue. We can make an offer for paid support in case you are interested.

msc
Posts: 13
Joined: 09 Dec 2021, 07:18

Re: Problem with JNLP caching in OpenWebStart

Post by msc »

>> Is OWS started automatically or are you supposed to "open" the downloaded jnlp? My experience with Chrome, Firefox, Edge is that when a jnlp link is clicked it the browser down loads the file which you have to "open" explicitly.

Depending on the browser, it downoads the file and starts it directly or it asks if I want to keep the file, since it is potentially harmful, and starts it after I click on "keep". But I have also tried launching the jnlps from the Downloads folder, by double clicking them or by Open with -> OWS.

>> How are you starting? By clicking on the desktop shortcut or by rt-clk "open" on the downloaded jnlp file.

As I said, I tried different variants, all with the same effect. Even though I open the myapp.jnlp which I downloaded from app_v2 and which has codebase app_v2, the other application (the one in app_v1) gets started, because I have the myapp.jnlp from app_V1 in my cache.

>> In which directory is this cached myapp.jnlp?
It is in my USER_HOME under .cache\icedtea-web\cache\0\203\.

>> Do these http://app_v1.host.com/myapp.jnlp and http://app_v2.host.com/myapp.jnlp have href? To which jnlp are they pointing and what is the codebase and href in that jnlp?

They each point to the respective jnlps: app_v1.host.com/myapp.jnlp and app_v2.host.com/myapp.jnlp (two different files in two different containers on the same server).
Both jnlps look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp codebase="http://app_v1.host.com/" href="myapp.jnlp" spec="6.0">
<information>
<title>...</title>
<vendor>...</vendor>
<description>...</description>
<description kind="short">...</description>
<icon href="icon.gif" />
<offline-allowed />
</information>
<security>
<all-permissions />
</security>
<resources>
<j2se version="1.8+" initial-heap-size="128m" max-heap-size="256m"/>
<jar href="first.jar" version="16.0.0"/>
<jar href="second.jar"/>
...
</resources>
<application-desc main-class="com.host.myapp.Main" />
</jnlp>

but of course, the second one has codebase="http://app_v2.host.com/" instead of app_v1.
They seem to be working fine with Oracle Web Start, so I don't think there are any problems there.
The links are also ok, as I said, the right jnlps get downoaded each time. But even when I start the myapp.jnlp which was downloaded from app_v2 and which has codebase app_v2 from my Downloads folder by right clicking it and choosing Open with -> OWS, the wrong application gets started.

>> As I said we will need to look at all your jnlps, your cache and your server set up to really understand your issue. We can make an offer for paid support in case you are interested.

That is not my decision to make, but I could take that up with the people in charge in our company if we can't otherwise solve the issue.
As a workaround, we can limit the cache size to zero, so nothing will be cached and all the jars etc. get downloaded every time...

Thank you again for your answers.

Janak Mulani
Posts: 726
Joined: 24 Mar 2020, 13:37

Re: Problem with JNLP caching in OpenWebStart

Post by Janak Mulani »

But even when I start the myapp.jnlp which was downloaded from app_v2 and which has codebase app_v2 from my Downloads folder by right clicking it and choosing Open with -> OWS, the wrong application gets started.
So on the server:

app_v1.host.com/myapp.jnlp has code base and href: <jnlp codebase="http://app_v1.host.com/" href="myapp.jnlp" spec="6.0">

And

app_v2.host.com/myapp.jnlp has code base and href: <jnlp codebase="http://app_v2.host.com/" href="myapp.jnlp" spec="6.0">

When you download in browser you have in Downloads folder myapp.jnlp and myapp(1).jnlp.

These two should differ in their codebase attribute. What are the other differences between these two jnlps besides the codebase?

If they both have the same jars and same Application main class then they will start the same app will be started.

One more thing you can try is to remove the href attribute in myapp.jnlp and myapp(1).jnlp and see if respective applications are started.

msc
Posts: 13
Joined: 09 Dec 2021, 07:18

Re: Problem with JNLP caching in OpenWebStart

Post by msc »

>> These two should differ in their codebase attribute. What are the other differences between these two jnlps besides the codebase?

Besides the difference in the codebase attribute, some of the jars have newer versions in one of the jnlps. The main class is contained in one of these jars.

>> One more thing you can try is to remove the href attribute in myapp.jnlp and myapp(1).jnlp and see if respective applications are started.

I removed the href attribute of the jnlp tag. This way, the jnlps are not cached any more and the right application gets started every time.
So this seems to be working.

Thank you very much!

msc
Posts: 13
Joined: 09 Dec 2021, 07:18

Re: Problem with JNLP caching in OpenWebStart

Post by msc »

There's still a problem if we use jnlp extensions in the original jnlp. These will be cached even if they don't have an href attribute.

Janak Mulani
Posts: 726
Joined: 24 Mar 2020, 13:37

Re: Problem with JNLP caching in OpenWebStart

Post by Janak Mulani »

We will need to look at all your jnlps, your cache and your server set up to really understand your issue. We can make an offer for paid support in case you are interested.


Janak Mulani
Posts: 726
Joined: 24 Mar 2020, 13:37

Re: Problem with JNLP caching in OpenWebStart

Post by Janak Mulani »

Please try the new release 1.8.0. We have fixed the problem with cache key and probably this has fixed your issue.

msc
Posts: 13
Joined: 09 Dec 2021, 07:18

Re: Problem with JNLP caching in OpenWebStart

Post by msc »

Our first tests were successful; the caching seems to be working properly with the new Version 1.8.0. Thank you!

Janak Mulani
Posts: 726
Joined: 24 Mar 2020, 13:37

Re: Problem with JNLP caching in OpenWebStart

Post by Janak Mulani »

Thanks for the positive feedback.

Post Reply