0

I have a problem with my Java Web Start application. I have an JavaEE Application running in a Wildfly 9 container. I pass a property-file to the Web Start application which contains an URL to a csv file and an url to an template file.

When I run the application for the 1st time the application downloads the property file, loads the URL from the property file entries and downloads the csv file and the templatefile and does a mail merge with the files.

When I run the Web Start application a second, third, ... time its allways downloading the property file from the 1st run. Even the property file is overwritten everytime the user starts the Web Start application.

I've found out that when I deploy my application to Wildfly via "Full publish" from eclipse the Web Start application is working fine but when I deploy my application via "Project --> Export --> WAR file" and place the .war file at the deployment folder in my Wildfly installation I do get the behaviour explained above.

Some additional infos: Deployment via "Export WAR file" console output, 1st run:

Java Web Start 11.65.2.17
JRE-Version verwenden 1.8.0_65-b17 Java HotSpot(TM) Client VM
Benutzer-Home-Verzeichnis = C:\Users\arthurw
c:   Konsolenfenster löschen
f:   Objekte in Finalisierungs-Queue finalisieren
g:   Garbage Collect
h:   Diese Hilfemeldung anzeigen
m:   Speicherauslastung drucken
o:   Logging auslösen
p:   Proxykonfiguration neu laden
q:   Konsole ausblenden
r:   Policy-Konfiguration neu laden
s:   System- und Deployment-Eigenschaften ausgeben
t:   Threadliste ausgeben
v:   Threadstack ausgeben
0-5: Traceebene auf <n> setzen

CacheEntry[http://localhost:8080/browser/resources/webstart/715.jnlp]: updateAvailable=true,lastModified=Tue Nov 24 12:23:01 CET 2015,length=831
CacheEntry[http://localhost:8080/browser/resources/webstart/Textverwaltungsschnittstelle.jar]: updateAvailable=true,lastModified=Tue Nov 24 12:21:14 CET 2015,length=2728463
Missing Permissions manifest attribute in main jar: http://localhost:8080/browser/resources/webstart/Textverwaltungsschnittstelle.jar
CacheEntry[http://localhost:8080/browser/resources/webstart/715.properties]: updateAvailable=true,lastModified=Tue Nov 24 12:23:34 CET 2015,length=298
Content-Type = application/octet-stream
Content-Disposition = null
Content-Length = 298
fileName = 715.properties
File downloaded
Content-Type = application/octet-stream
Content-Disposition = null
Content-Length = 2823
fileName = 715_2015_11_24_12_26_16.csv
File downloaded
Content-Type = application/octet-stream
Content-Disposition = null
Content-Length = 37405
fileName = 715_2015_11_24_12_26_16.DOCX
File downloaded
The Library been loaded, and an activeX component been created

2nd run:

Java Web Start 11.65.2.17
JRE-Version verwenden 1.8.0_65-b17 Java HotSpot(TM) Client VM
Benutzer-Home-Verzeichnis = C:\Users\arthurw
----------------------------------------------------
c:   Konsolenfenster löschen
f:   Objekte in Finalisierungs-Queue finalisieren
g:   Garbage Collect
h:   Diese Hilfemeldung anzeigen
m:   Speicherauslastung drucken
o:   Logging auslösen
p:   Proxykonfiguration neu laden
q:   Konsole ausblenden
r:   Policy-Konfiguration neu laden
s:   System- und Deployment-Eigenschaften ausgeben
t:   Threadliste ausgeben
v:   Threadstack ausgeben
0-5: Traceebene auf <n> setzen
----------------------------------------------------
Missing Permissions manifest attribute in main jar: http://localhost:8080/browser/resources/webstart/Textverwaltungsschnittstelle.jar
Content-Type = application/octet-stream
Content-Disposition = null
Content-Length = 298
fileName = 715.properties
File downloaded
Content-Type = application/octet-stream
Content-Disposition = null
Content-Length = 2823
fileName = 715_2015_11_24_12_26_16.csv
File downloaded
Content-Type = application/octet-stream
Content-Disposition = null
Content-Length = 37405
fileName = 715_2015_11_24_12_26_16.DOCX
File downloaded
The Library been loaded, and an activeX component been created

And this is the JNLP-file

<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8080/browser/resources/webstart" href="715.jnlp">
     <information>
          <title>Textverwaltung Schnittstelle</title>
          <description>automatisierte Serienbriefbefüllung mithilfe Ihrer Textverwaltung</description>
     </information>
     <security>
          <all-permissions/>
     </security>
     <resources>
          <j2se version="1.6+" />
          <jar href="Textverwaltungsschnittstelle.jar" main="true"/>
     </resources>
     <update check="always" policy="always"/>
     <application-desc main-class="mm.Textverwaltungsschnittstelle">
        <argument>http://localhost:8080/browser/resources/webstart/715.properties</argument>
     </application-desc>
</jnlp>

I need to get it working with deployment via "Export WAR file". Anybody know what's the problem?

------------------------------EDIT-------------------------------------

This is the load process of the property file, here is everything fine, I can manually open the property file and the content is correct.

Properties clientprops=new Properties();
clientprops.put("modus", modus);
clientprops.put("templatepath", templateUrl);
clientprops.put("csvpath", csvUrl);
String propertypath=jnlpdir + user + ".properties";
File fp = new File(propertypath);
OutputStream out;
try {
  out = new FileOutputStream(fp);
  clientprops.store(out, "Benötigte Attribute für die Aktivierung der Textverwaltungsschnittstelle");
} catch (IOException e2) {
    e2.printStackTrace();
}

Thats how I download the property file

File proppath = new File(tmpdir + "prop.properties");
URL url;
try {
  url = new URL(args[0]);
  FileUtils.copyURLToFile(url, proppath);
} catch (IOException e) {
  showFehler("Properties konnten nicht kopiert werden");
}

copyURLToFile(url, proppath) is a method from the appache FileUtils. The downloaded property file has invalid content. It is everytime the content from the 1st run.

Sincerly Arthur

Sevan
  • 669
  • 1
  • 5
  • 18
Arthur Welsch
  • 269
  • 2
  • 15
  • Hi Jan, 715.properties is fine, its only the content of the file which is changed every time, but the downloaded 715.properties in web start has the content from the 1st run, which is wrong. I will edit my post to show you the code which is handling the property load and download. – Arthur Welsch Nov 24 '15 at 12:31
  • Hi Jan, I figured out that when I open the property file with firefox I do get allways the same content from the 1st run. But when I navigate to the folder using windows file explorer and open the property file there it has the right content. I guess wildfly gives me a cached version of the 715.properties file when I do a http request for this ressource. – Arthur Welsch Nov 24 '15 at 13:03
  • Hi Jan, indeed the property file was not updated within the war file. I made a workaround by creating a new property file with a unique filename and make the request for this new file. Thank you for your help – Arthur Welsch Nov 24 '15 at 14:12

1 Answers1

0

As discussed:

The property file downloaded within the WebStarted application needs to be updated and included in the published .war to work. So this is not WebStart or wildfly or JNLP related at all but something to consider during build process.

Jan
  • 13,738
  • 3
  • 30
  • 55