JDK-8023434 : NSS initialization failed
  • Type: Bug
  • Component: security-libs
  • Sub-Component: javax.crypto:pkcs11
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: generic
  • Submitted: 2013-08-20
  • Updated: 2016-11-29
  • Resolved: 2016-09-22
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 9
9Resolved
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
Failures on any pkcs11 test can occur with the message "NSS initialization failed".  The exception shows up as: Exception in thread "main" java.lang.reflect.InvocationTargetException

but the details of the cause show the real story:

Caused by: java.security.ProviderException: Could not initialize NSS
        at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:211)
        at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:103)
        ... 6 more
Caused by: java.io.IOException: NSS initialization failed
        at sun.security.pkcs11.Secmod.initialize(Secmod.java:220)
        at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:206)

Why is NSS failing to initialize?  I don't know, but I think this is a test issue more than a product issue.  This is not seen with Solaris Crypto Framework and does not appear to be from a particular version of NSS at this point.  All the bugs that fail with this error will be attached to hopefully show a pattern. 
Comments
Because the fix for JDK-8077138 has removed this issue from ProblemList.txt, so it's unnecessary to mark this issue with label "ProblemList"
14-09-2016

This is not a TCK failure, it is an intermittent failure that happens from time to time most likely because of test harness situations but has not been reported in the real world
17-12-2015

Perhaps we should consider changing the native nssInitialize call to return an int (value in "res") instead of just a boolean ("res == 0") which would help provider more info on why NSS initialization failed.
18-11-2015

Possibly related.
17-11-2015

sun/security/pkcs11/Secmod/LoadKeystore.java also fails. If I chmod a+x the DLLs in the test directory, the test succeeds then.
30-10-2015

This new failure involves keystore, could it be related to keystore changes more than a PKCS11 issue? The stacktraces are not similar. The library error could be a result of anything as is way too generic.
18-09-2015

I was only seeing on Solaris, likely something else then.
17-09-2015

This may be OS-related, after updating the test to run on sparcv9, and running on 8 FCS: SunOS <first machine> 5.11 11.1 sun4v sparc sun4v We get the error above. SunOS <second machine> 5.10 Generic_148888-02 sun4v sparc sun4v It passes.
19-06-2015

I also ran into this problem on JDK8. However note, the test hardcodes sparc instead of sparcv9, so this test is never run in JDK workspace on 8. Also note that I think with the change to rely on the OS's NSS, this test needs to be updated.
19-06-2015