Search code examples
javakeystoree-token

java.lang.UnsatisfiedLinkError: no j2pkcs11 in java.library.path in java6


I'm trying to use a eToken to sign a pdf file using a java application I wrote. I'm using a windows 7 64 bit edition with java 6.0.30.

When I run the application I'm getting an exception saying

Exception in thread "signer" java.lang.UnsatisfiedLinkError: no j2pkcs11 in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1738)
    at java.lang.Runtime.loadLibrary0(Runtime.java:823)
    at java.lang.System.loadLibrary(System.java:1028)
    at sun.security.pkcs11.wrapper.PKCS11$1.run(PKCS11.java:88)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.security.pkcs11.wrapper.PKCS11.<clinit>(PKCS11.java:86)
    at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:281)
    at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:90)
    at com.greytip.cougar.pdfsigner.PdfSigner.getProvider(PdfSigner.java:364)

But when I looked up the j2pkcs11.dll file is available to jdk 1.5 but not available in my jdk 1.6 64 bit.

Is to anything to do with java security policy since the exception is coming inside AccessController, ie the dll is inside a protected directory inside windows 7?

Thanks in advance.


Solution

  • It looks like pkcs11 is not implemented in any of the 64-bit versions of java. It is only available in the 32-bit version.

    So I'm planning to install a 32-bit version of java and work with it.