Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8206258

[Test Error] sun/security/pkcs11 tests fail if NSS libs not found

    Details

      Backports

        Description

        I see this:

        ----------configuration:(11/604)----------
        Boot Layer
          add modules: java.base jdk.crypto.cryptoki
          add exports: java.base/com.sun.crypto.provider ALL-UNNAMED
                       java.base/sun.security.jca ALL-UNNAMED
                       java.base/sun.security.provider ALL-UNNAMED
                       java.base/sun.security.rsa ALL-UNNAMED
                       java.base/sun.security.tools.keytool ALL-UNNAMED
                       java.base/sun.security.x509 ALL-UNNAMED
                       jdk.crypto.cryptoki/sun.security.pkcs11 ALL-UNNAMED
          add opens: jdk.crypto.cryptoki/sun.security.pkcs11 ALL-UNNAMED

        ----------System.out:(2/126)----------
        Warning: can't find NSS librarys on this machine, skipping test
        libsoftokn3 version not found, set to 0.0: nulllibsoftokn3.so
        ----------System.err:(40/2662)----------
        java.io.FileNotFoundException: nulllibsoftokn3.so (No such file or directory)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)
        at PKCS11Test.getNSSInfo(PKCS11Test.java:413)
        at PKCS11Test.getNSSInfo(PKCS11Test.java:389)
        at PKCS11Test.getNSSVersion(PKCS11Test.java:365)
        at PKCS11Test.<clinit>(PKCS11Test.java:667)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:115)
        at java.base/java.lang.Thread.run(Thread.java:834)
        java.security.ProviderException: Could not initialize NSS
        at jdk.crypto.cryptoki/sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:218)
        at jdk.crypto.cryptoki/sun.security.pkcs11.SunPKCS11$1.run(SunPKCS11.java:113)
        at jdk.crypto.cryptoki/sun.security.pkcs11.SunPKCS11$1.run(SunPKCS11.java:110)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at jdk.crypto.cryptoki/sun.security.pkcs11.SunPKCS11.configure(SunPKCS11.java:110)
        at PKCS11Test.getSunPKCS11(PKCS11Test.java:152)
        at TestNssDbSqlite.initializeProvider(TestNssDbSqlite.java:119)
        at TestNssDbSqlite.initialize(TestNssDbSqlite.java:110)
        at TestNssDbSqlite.main(TestNssDbSqlite.java:67)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:115)
        at java.base/java.lang.Thread.run(Thread.java:834)
        Caused by: java.io.IOException: NSS initialization failed
        at jdk.crypto.cryptoki/sun.security.pkcs11.Secmod.initialize(Secmod.java:234)
        at jdk.crypto.cryptoki/sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:213)
        ... 14 more

        .. in our nightly tests on machines which have not the full set of NSS libs installed.

        Comments in PKCS11Tests::getNSSLibDir() look like the test should be skipped in case NSS libraries are not fully installed:

        ".. skipping tests"

        However, this is not what happens, the test will fail.

        Can be reproduced easily on any Linux, even if NSS is installed, by temporarily renaming the system libsoftokn3.so to something else.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  jjiang John Jiang
                  Reporter:
                  stuefe Thomas Stuefe
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: