Search code examples
javanullpointerexceptionjava-web-start

NullPointerException when attempting to start JWS application


I am trying to start the JNLP located at http://gparyani.com/beatbox.jnlp, but I get a NullPointerException in an internal class when I try to do so:

java.lang.NullPointerException
    at com.sun.deploy.security.SandboxSecurity.showSandboxDialog(Unknown Source)
    at com.sun.deploy.security.SandboxSecurity.checkSignedSandboxSecurity(Unknown Source)
    at com.sun.deploy.security.SandboxSecurity.isPermissionGranted(Unknown Source)
    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.access$000(Unknown Source)
    at com.sun.javaws.Main$1.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Here's the JNLP:

<jnlp spec="1.0+" codebase="http://gparyani.com/">
  <information>
    <title>BeatBox</title>
    <vendor>Gaurav Paryani, Nick Hoang, and Harrison Qi</vendor>
    <offline-allowed/>
  </information>
  <update check="background" policy="prompt-run"/>
  <resources>
    <j2se version="1.7+"/>
    <jar href="beatbox.jar" main="true"/>
  </resources>
  <application-desc main-class="com.gparyani.beatbox.GUIMaker"/>
</jnlp>

What is the problem here?


Solution

  • Certainly not the most helpful error message is it.

    I was able to get past it by fixing the codebase URL. Your actual code is hosted at:

    http://www.rohitleena.com/gparyani/

    but the codebase in your JNLP file is:

    http://gparyani.com/

    In summary the fix is to modify the jnlp element in your JNLP file to:

    <jnlp spec="1.0+" codebase="http://www.rohitleena.com/gparyani/">
    

    This was detected as a warning by Janela which may help you debug these issues in the future.

    By changing the codebase to the first URL the NullPointerException went away. My suspicion is that it is trying to validate the URL using certificates and that certificate validation is getting confused when trying to figure out which URL it needs to validate.

    Fixing this gets past the NullPointerException and immediately throws another exception but that appears to be a different problem (your application requesting the change the default runtime handler without having the permissions to do so).