JDK-8022939 : REGRESSION:NullPointerException at com.sun.javaws.Launcher.prepareToLaunch()
  • Type: Bug
  • Component: deploy
  • Sub-Component: webstart
  • Affected Version: 7u40
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_7
  • Submitted: 2013-08-09
  • Updated: 2017-07-12
  • Resolved: 2014-05-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u20Fixed 9 b22Fixed
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version  " 1.7.0_40-ea " 
Java(TM) SE Runtime Environment (build 1.7.0_40-ea-b35)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b54, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]

A DESCRIPTION OF THE PROBLEM :
1. Run http://jenkins-ci.org/jenkins.jnlp (by clicking in a browser, or download and run with "javaws jenkins.jnlp")
2. You will get:

java.lang.NullPointerException
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)

Expected behavior: A user-friendly error message of what went wrong


REPRODUCIBILITY :
This bug can be reproduced always.
Comments
the original test jnlp (jar) is not allowed to run with JDK9 now since the jar does not contain attribute "Permission". Not verified.
12-07-2017

I did some further investigation and found the NPE is not related to a security policy change as originally suspected.
19-05-2014

Submitter had agreed that the correct resolution is for javaws to throw a more detailed error message that helps developers correct the problem. Also filed a bug report with Jenkins here: https://issues.jenkins-ci.org/browse/JENKINS-19238
19-08-2013

SQE-OK to defer this issue to later releases since it's a known behavior with no codebase JNLP
16-08-2013

Once I see the SQE-OK - I will approve this deferral.
16-08-2013

To use no-codebase JNLP webstart application with browser html page, you need to use deployment toolkit (DT) as well. Current DT API: dtjava.launch: http://docs.oracle.com/javafx/2/deployment/deployment_toolkit.htm#BABJHEJA old style DT: http://docs.oracle.com/javase/tutorial/deployment/deploymentInDepth/deployingWithoutCodebase.html
15-08-2013

Deferral justification: This doesn't seem to be an immediate regression in 7u40, the failure conditions are different but it fails to work in earlier releases too. The workaround for this is fairly trivial, using one of the methods I described above.
15-08-2013

I've tested this back to 7u13 and it still didn't launch due to some NPE somewhere, in every case because there is either no explicit codebase or no codebase can be derived. The only bug I can see here is perhaps javaws should check for this case and throw some sort of Exception explaining that it cannot determine the codebase. For that reason, I'll leave it open. As for Jenkins, they need to do one of the following for proper deployment: - Use deployJava.js to launch the webstart applet instead of just using a <a href="xxx"> link - Add codebase/href attributes to jenkins.jnlp - Launch manually by using the URL instead of downloading: "javaws http://jenkins-ci.org/jenkins.jnlp"
15-08-2013

Adding an href="jenkins.jnlp" attribute to the jnlp element in jenkins.jnlp works around this issue, the existing jnlp file has no href attribute.
15-08-2013

I get the same exception when I work around the NPE in Launcher.
15-08-2013

tested with 7u25 and don't see the issue. I do get another exception during launch though (probably net config) 7u25 b17 : java.net.NoRouteToHostException: No route to host: connect at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) I suspect this NPE is a regression in 7u40. ** UPDATE : looking at jnlp files. attempt to download "<jar href="http://mirrors.jenkins-ci.org/war/latest/jenkins.war"/>" is made - so the 7u25 network issue makes sense given the proxy required. 7u40 issue requires analysis.
15-08-2013

FWIW I'm getting this on Windows 7/32-bit with 7u25: java.lang.NullPointerException at com.sun.jnlp.JNLPClassLoader.getPermissions(Unknown Source) at java.security.SecureClassLoader.getProtectionDomain(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at com.sun.javaws.Launcher.doLaunchApp(Unknown Source) at com.sun.javaws.Launcher.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
15-08-2013

launching from browser downloads the JNLP and launches it using the local file, so it's effectively the same as downloading and manually launching javaws with the local file.
15-08-2013

launching directly from browser address bar reproduces the issue for me (windows 7, Chrome and windows XP IE)
15-08-2013

Ok... so there's a crucial step missing in the description. You have to download the JNLP file first, then try to launch the local JNLP rather than the from the URL provided.
15-08-2013

I switched to Win7 from Mac OS X and installed 7u40 b35 and it's still not happening. Very frustrating.
15-08-2013

I just reproduced by launching on my windows box with 7u40b38.
15-08-2013

Ok, I can't reproduce it this morning at all... Could something have changed on Jenkins' side?
15-08-2013

Does not happen with JDK 8, only 7 so far.
15-08-2013

Shows a different error when running with -verbose: com.sun.deploy.net.JARSigningException: Found unsigned entry in resource: http://mirrors.jenkins-ci.org/war/latest/jenkins.war at com.sun.javaws.security.SigningInfo.getCommonCodeSignersForJar(Unknown Source) at com.sun.javaws.security.SigningInfo.check(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(Thread.java:744)
14-08-2013