4
votes

All,

I am having some trouble running a java web start application that has been generated by Netbeans 7.

I have migrated my existing java 6.9.1 application to Netbeans 7 and attempted to make it a web start application.

To do this I have checked the Enable Web Start option from the project properties.

For the codebase option I have Web Application Deployment selected. The Application descriptor is selected option which will point the JNLP application-desc element to my applications main class.

For signing, I have generated a key and pointed the Signing properties at this. I have the Mixed Code set to Trusted Only as my application will only used signed JARs.

When I compile, all referenced JAR files and the application JAR file are signed which is output in the console (for each one) as:

Signing JAR: D:\MyCode\dist\lib\somejarfile.jar to D:\MyCode\dist\lib\somejarfile.jar as signFiles
Enter Passphrase for keystore: Enter key password for signFiles: 

NOTE: signFiles is the alias I have used in the Signing properties in Netbeans.

The following files are created in my dist folder:

  • lib
  • jnlpcomponent1.jnlp
  • launch.html
  • launch.jnlp
  • README.TXT
  • My App.jar

I have copied these to my web folder that is hosted under tomcat which is C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\mywebapp.

I am running from the following URL in IE and Firefox: http://mylaptop:8080/mywebapp/launch.html

The following exception is thrown when I click the button in launch.html to launch the JNLP file:

com.sun.deploy.net.FailedDownloadException: Unable to load resource: file:/C:/Users/panderson/AppData/Local/Microsoft/Windows/Temporary Internet Files/Content.IE5/B3UCQV8C/$$codebase/launch.jnlp
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.Launcher.updateFinalLaunchDesc(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

My launch.jnlp file has the following:

<jnlp codebase="$$codebase" href="launch.jnlp" spec="1.0+">
...
<resources>
    <j2se version="1.6+"/>
    <jar href="My App.jar" main="true"/>
...

I am not too sure why it is looking under the temp folders in internet explorer for it...

... But I have tried putting the full url in the jnlp href to the launch.JNLP file http://mylaptop:8080/mywebapp/launch.jnlp then it throws the following exception:

com.sun.deploy.net.FailedDownloadException: Unable to load resource: file:/C:/Users/panderson/AppData/Local/Microsoft/Windows/Temporary Internet Files/Content.IE5/DR2O6URQ/$$codebase/My App.jar

If I then change the jar href to http://mylaptop:8080/mywebapp/My App.jar, the following exception is thrown when I click the button in the launch.html to run the launch.JNLP file.

BadFieldException[ The field <jnlp>codebase has an invalid value: $$codebase,$$codebase]

Any help or thoughts?

Cheers,

Andez

2
@Andrew - Was hopefully going to be a JWS issue. Just with netbeans - it sometimes hides the potential problems from you which hit you head on when you run things. :-( - Andez

2 Answers

3
votes
<jnlp codebase="$$codebase" href="launch.jnlp" spec="1.0+">

These $$ place-holder values are usually translated to something sensible by a servlet or similar functionality.

2
votes

This was suggested as a useful tool in the following question.

Try using JaNeLA and see if it finds any problems with your JNLP file.

Further double check and make sure the codebase url matches the url of your server/application.