Thursday, August 5, 2010

Hudson, Ubuntu 10.04 and OpenJDK

Yesterday, I was trying to install and run Hudson server on my Ubuntu 10.04 VM. I was constantly getting the following error message. I even tried to create a slave on this Virtual Machine from my Windows Master, and even that was not working. The error message was :

java.security.ProviderException: Could not initialize NSS
 at sun.security.pkcs11.SunPKCS11.(SunPKCS11.java:201)
 at sun.security.pkcs11.SunPKCS11.(SunPKCS11.java:103)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
 at sun.security.jca.ProviderConfig$3.run(ProviderConfig.java:262)
 at sun.security.jca.ProviderConfig$3.run(ProviderConfig.java:244)
 at java.security.AccessController.doPrivileged(Native Method)
 at sun.security.jca.ProviderConfig.doLoadProvider(ProviderConfig.java:244)
 at sun.security.jca.ProviderConfig.getProvider(ProviderConfig.java:224)
 at sun.security.jca.ProviderList.getProvider(ProviderList.java:232)
 at sun.security.jca.ProviderList.getService(ProviderList.java:330)
 at sun.security.jca.GetInstance.getInstance(GetInstance.java:157)
 at java.security.Security.getImpl(Security.java:696)
 at java.security.AlgorithmParameters.getInstance(AlgorithmParameters.java:130)

I wasn't able to find anything related to this exception in the Hudson user groups. A simple test to make sure I was running the correct version of Java, helped fix things. The VM was running openJDK, and after linking to the correct Sun JDK the problem went away. I was able to run the master on this VM< and also on a similar VM was able to run the slave as well.

meera@ubuntu:~/src/meera$ java -version
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

So, if in case you see this error next time, make sure and check which Java you are using.

2 comments:

  1. Hello Meera,

    I meet that exception also when using OpenJDK (OpenJDK Runtime Environment (IcedTea6 1.8.3) (6b18-1.8.3-0ubuntu1~8.04.2)
    OpenJDK Server VM (build 16.0-b13, mixed mode)), if I run with Sun JDK, it's OK, like your case.

    But my problem is I have to use OpenJDK, rather than Sun JDK ... So, do you know how to resolve this problem?

    Thanks by advance,

    Thanks,
    Quang

    ReplyDelete
  2. I solved it on openSuse by installing Mozilla-nss (provided that the root is a missing libnss3.so file)

    ReplyDelete