4

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

Andez
  • 5,588
  • 20
  • 75
  • 116
  • @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 Jun 21 '11 at 11:31

2 Answers2

3
<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.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • 1
    Hey Andrew, you just beat me to this. There are a couple of issues with it. First thing as you mentioned was the codebase. I have changed this to the URL e.g. http://mylaptop:8080/mewebapp. Secondly there appears to be an issue with the name of my JAR file. As it has a space in the filename, it came up with the unable to load resource file. – Andez Jun 21 '11 at 11:26
  • Spaces in HTML should generally be replaced by ..I think it is `%20`. But then, I avoid using caps. or spaces in Jar names. Instead of spaces, a `.` or `-` or `_` will generally suffice. – Andrew Thompson Jun 21 '11 at 11:30
2

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.

Community
  • 1
  • 1
maple_shaft
  • 10,435
  • 6
  • 46
  • 74