java.io.FileNotFoundException: /usr/lib/libnss3.so error on Debian Wheezy

 


Edit:
this should have been fixed by http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=634058

 

 

I came across this error the other day running a java application on Debian Wheezy:

java.security.ProviderException: Could not initialize NSS
at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:201)
at sun.security.pkcs11.SunPKCS11.<init>(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.getIndex(ProviderList.java:262)
at sun.security.jca.ProviderList.getProviderConfig(ProviderList.java:246)
at sun.security.jca.ProviderList.getProvider(ProviderList.java:252)
at java.security.Security.getProvider(Security.java:473)
at jd.http.XTrustProvider.install(XTrustProvider.java:70)
at jd.http.Browser.init(Browser.java:1317)
at jd.update.Main.main(Main.java:119)
Caused by: java.io.FileNotFoundException: /usr/lib/libnss3.so
at sun.security.pkcs11.Secmod.initialize(Secmod.java:186)
at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:197)
… 18 more
ERROR Could not initialize NSS

Apparently an update broke the configuration of the OpenJDK installation. So to fix it I had to manually edit the file /etc/java-6-openjdk/security/nss.cfg:

name = NSS
#nssLibraryDirectory = /usr/lib
nssLibraryDirectory = /usr/lib/i386-linux-gnu
nssDbMode = noDb
attributes = compatibility

Commenting out the highlighted orange line and adding the highlighted green line. The reason of it is that OpenJDK has split this configuration according to the box architecture (see https://bugs.launchpad.net/ubuntu/+source/nss/+bug/778726). However on my box it failed updating the reference to the new location of the libnss3.so file (I am on Debian Wheezy which is not stable yet so I guess something went wrong).





16 Responses to “java.io.FileNotFoundException: /usr/lib/libnss3.so error on Debian Wheezy”

  1. Andrés Reyes D. says:

    HEY! Be careful,
    x64 users must specify /usr/lib/x86_64-linux-gnu directory on nss.cfg file.

    name = NSS
    nssLibraryDirectory = /usr/lib/x86_64-linux-gnu
    nssDbMode = noDb
    attributes = compatibility

    Now JDownloader works great on my Debian (Wheezy).

    Thanks.

  2. Leandro Del Teso says:

    Exactly Andrés. The path is architecture-dependant….so each one has to find the right path according to the current configuration of the box. One easy way to do this is by running:

    locate libnss3.so

    Anyway, I guess the package should get fixed soon and this will be fixed automatically when updating.

  3. Excellent — I had reluctantly switched back to sun jdk when this broke, but now I can go back. Thanks.

  4. dwaver says:

    dude you saved my day!

    … i will now disable auto updates in debian… because i can not stand fixing other people’s software problems. (releasing things untested?) (no test documentation?)

    i am using eclipse on debian wheezy inside a xen vm connecting via vnc.

    but snapshots don’t work right now… so i could not even restore a working version of debian/openjdk.
    thanks again.

  5. Leandro Del Teso says:

    Well, Wheezy is the current Debian’s testing branch so expect it to have this sort of odd behavior occasionally.

    Maybe you should go for Squeeze which is Debian’s stable release. You won’t experience this “broken” updates on stable, for sure. :)

  6. buwil1 says:

    thanks a lot, saved my day too, never would have figured this out myself…

  7. Sean says:

    Wow, thanks for posting this. I was running into this exact problem today and I was wondering what I changed in my code.

  8. andre says:

    thanks to thread and first comment :) now running jd on my wheezy 64 bit :))

  9. [...] buscando me encontré con la respuesta gracias a este genial post y que básicamente hay que hacer lo [...]

  10. Korsaire says:

    Thanks, it runs right now.

  11. Thanks for the post :)

  12. [...] gedit /etc/java-6-openjdk/security/nss.cfgand changed its content into the following (thanks to java.io.FileNotFoundException: /usr/lib/libnss3.so error on Debian Wheezy):name = NSS nssLibraryDirectory = /usr/lib/x86_64-linux-gnu nssDbMode = noDb attributes = [...]

  13. Diego Santiviago says:

    It works! I’m using x86_x64 configuration.

    name = NSS
    nssLibraryDirectory = /usr/lib/x86_64-linux-gnu
    nssDbMode = noDb
    attributes = compatibility

  14. Adil says:

    It works. This help resolve bug on CCS (Eclipse) plugin install on Ubuntu. Error was: Could not initialize NSS.

  15. [...] I am a lazy guy, I checked Google for an answer which you can find here. I had to make just a little change cause I use a x64 [...]

  16. FGM says:

    After tweaking this file, your tip helped me make it work.

    The nssLibraryDirectory was set to the libnss3.so in Zend Studio instead of pointing to a directory.

    Being on Ubuntu 11.04, /usr/lib/x86_64-linux-gnu did not contain that file either, but libnss3.so is present in /usr/lib, and setting

    nssLibraryDirectory = /usr/lib

    dit the trick.

Leave a Reply