Search code examples
javajava-web-startjnlp

Running Duplicate JavaWS Applications


Summary: How do you run duplicate JavaWS applications (they come from the same source-code but use separate data) on the same machine?

I have an old version of an application running at a client site. I performed an upgrade on the application and have deployed both (using different databases, wars, servers, etc) and would like the ability to have users download and run both applications simultaneously on their computers. Since the applications are essentially independent of each other there should be no issue of overlapping data. However, the .JNLP files will download the new application and overwrite the old one - and vice versa. We want to have both running at the same time such that production doesn't stop, and they can test the functionality of the improvements before switching the newest application to their production.

I have altered the name of the new application, and the start-menu name within the JNLP file, but they still overwrite each other. I suppose there is a sub-question within this question: how/where does Java determine that the application being downloaded/installed through web start already exists? My guess is that it is from the name of the main-class.

Thanks

MIS.JNLP for Reference:

<?xml version="1.0" encoding="utf-8"?>
<!-- JNLP File for Foo Registration Application -->
<jnlp
  spec="1.7+"
  codebase="http://foo:8080/mis"
  href="mis.jnlp">
  <information>
    <title>MIS TEST</title>   <!-- Original: 'MIS' -->
    <vendor>Foo Inc.</vendor>
    <description>Bar MIS System</description>
     <shortcut online="false">
      <desktop/>
      <menu submenu="FooBar MIS TEST"/> <!--Original: 'FooBar MIS' -->
    </shortcut>
  </information>
  <security>
      <all-permissions/>
  </security>
  <resources>
    <j2se version="1.7+" java-vm-args="-client"/>
     ... 
  </resources>
  <application-desc main-class="FooMainApp"/>
</jnlp>

Solution (thanks to Vic in the comment below):

I had to change my build such that a .war with a different name was being created. Also, the JNLP name was changed, as well as the link inside the .html file pointing to the jnlp. A combination of these things allowed the duplicate applications to run simultaneously.


Solution

  • Per Oracle documentation "Each JAR file that a JNLP Client (such as Java Web Start) downloads, is uniquely identified with a URL. If two JNLP files use the same URL, then the resource will only be downloaded once and shared. This is similar to the caching implementations used by web browsers"