A_Elric
A_Elric

Reputation: 3568

Web-start exception JNLP

So I'm a bit confused on how to sign a jar in order for it to run as a jnlp.

At present I have a jar, it runs, starts to download and verify stuff, then it gets to the end and a window pops up saying it's unable to launch, then it gives the exception:

JNLPException[category: Launch File Error : Exception: null : LaunchDesc: 
 <jnlp codebase="http:/SomeHost:8080/_test/" href="jnlpcomponent1.jnlp" spec="1.0+">
<information>
  <title>jnlpcomponent1</title>
 <vendor>SUN_MICR</vendor>
 </information>
 <security>
 <all-permissions/>
  </security>
<resources>
 <jar href="lib/activation.jar" download="eager"/>
<jar href="lib/mail.jar" download="eager"/>
 </resources>
 <component-desc/>
 </jnlp> 
]
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResourcesHelper(Unknown Source)
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResources(Unknown Source)
at com.sun.javaws.Launcher.prepareResources(Unknown Source)
at com.sun.javaws.Launcher.prepareAllResources(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)

I am fairly sure this has something to do with the jar being signed wrong / poorly... I could use some help in understanding what's going on here and how to fix it though.

Thanks a lot.

Upvotes: 1

Views: 12836

Answers (2)

Thorn
Thorn

Reputation: 4057

You can use ANT to sign the JAR file. This way you can sign your files from within your IDE and it makes for a faster work-flow for when you deploy your appplication. Every change requires that you re-sign your application.

<project name="YourProject" default="dist" basedir="jarsigning">

  <target name="signMainJar">
     <signjar jar="../dist/YourApp.jar" destDir="signed" alias="WhateverYouSetIt2" 
              keystore="fileNameOfCerticate" storepass="passw03d" lazy="true" /> 
     <echo message="The file was signed." /> 
  </target>
  <!-- Use this if you are using any libraries. These also need to be signed. -->
  <target name="signLibs">
    <signjar destDir="signed" alias="WhateverYouSetIt2"
              keystore="fileNameOfCerticate" storepass="passw03d" force="true">
       <path>
          <fileset dir="lib" includes="*.jar" /> 
       </path>
    </signjar>
    <echo message="The library files were signed." /> 
  </target>

 </project>

Before you can run this script, you need to first create a jarsigning directory and place a certificate (key) to be used for signing. Inside that folder, create a folder called "signed" and this is where your signed code will be placed by the script. Use the keystore tool to create a self-signed certificate if you have not purchased one from a granting authority like Verisign or GoDaddy.

Upvotes: 0

user529543
user529543

Reputation:

I am fairly sure this has something to do with the jar being signed wrong / poorly

Exactly that happent, one of your jars isn't signed (properly)

What is always working for me: unzip all jars than sign with 1 process. If is confirmed as it working, than I will remove 1-2 jar to match the original deployment design. And you will know in what jar is the problem, than easier to fix it.

Upvotes: 1

Related Questions