JDK-8077138 : Some PKCS11 tests fail because NSS library is not initialized
  • Type: Bug
  • Component: security-libs
  • Sub-Component: javax.crypto:pkcs11
  • Affected Version: 8,9
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris,windows
  • Submitted: 2015-04-07
  • Updated: 2020-12-24
  • Resolved: 2016-09-14
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
9 b137Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
There are 56 new failures failed in JDK9 b59  at windows platform(both 32 and 64 builds) with following error message:
Beginning test run ReinitCipher...
----------System.err:(30/1796)*----------
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:425)
	at PKCS11Test.getSunPKCS11(PKCS11Test.java:77)
	at PKCS11Test.testNSS(PKCS11Test.java:402)
	at PKCS11Test.main(PKCS11Test.java:96)
	at ReinitCipher.main(ReinitCipher.java:42)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:502)
	at com.sun.javatest.regtest.agent.MainActionHelper$SameVMRunnable.run(MainActionHelper.java:218)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.security.ProviderException: Initialization failed
	at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:376)
	at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:103)
	... 14 more
Caused by: java.io.IOException: The specified module could not be found.
C:\\Users\\aurora\\sandbox\\testbase\\jdk\\test\\sun\\security\\pkcs11\\nss\\lib\\windows-i586\\softokn3.dll
	at sun.security.pkcs11.wrapper.PKCS11.connect(Native Method)
	at sun.security.pkcs11.wrapper.PKCS11.<init>(PKCS11.java:138)
	at sun.security.pkcs11.wrapper.PKCS11.getInstance(PKCS11.java:151)
	at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:313)
	... 15 more

Comments
It seems that not only VS, but also MozillaBuild is needed for building NSS libs on Windows. Generally, do our Windows testing machines pre-install such tools?
20-08-2016

The diagnosis is correct: the fix is to build the NSS DLLs in the PKCS11 tests suite using VS2013. Then NSS DLLs can use the C runtime library from VS2013 (msvcr120.dll) that is already distributed with the JDK 9 binaries. UPDATE: An alternative (temporary) fix is to include the C runtime library from VS2010 (msvcr100.dll) in a directory that is listed on the system path.
25-05-2015

These test libraries should not be prebuilt. They should be compiled at build time, in the new build-test-jdk-jtreg-native target, which has been created for this very purpose.
08-04-2015