Skip to content

Exception in thread "main" java.lang.UnsatisfiedLinkError: no pkcs11wrapper in java.library.path #4064

@aproust33

Description

@aproust33

I am trying to migrate an application to native, using graalVM. This app needs a dependance for crpyto purpose. It is currently using this lib (https://jce.iaik.tugraz.at/products/core-crypto-toolkits/pkcs11-wrapper/). This app is a windows one.

This lib use a DLL (pkcs11wrapper.dll) included in the jar. I am currently building the jar, then building the native image using this command :

native-image -cp target\single-proxy-native-0.0.1-SNAPSHOT.jar;C:\dev\tools\m2\iaik\pkcs\pkcs11-wrapper\1.4\pkcs11-wrapper-1.4.jar fr.devboxsante.cps.nativ.NativeCpsApplication -Djava.library.path=C:\dev\

(C:\dev\ contains the right dll)

It make the exe file, but when i try to execute it, it fails :

Exception in thread "main" java.lang.UnsatisfiedLinkError: no pkcs11wrapper in java.library.path at com.oracle.svm.core.jdk.NativeLibrarySupport.loadLibraryRelative(NativeLibrarySupport.java:132) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:197) at java.lang.Runtime.loadLibrary0(Runtime.java:830) at java.lang.System.loadLibrary(System.java:1871) at fr.devboxsante.cps.nativ.NativeCpsApplication.main(NativeCpsApplication.java:15)

I have tryied a lot of things, putting the dll in the bin folder of the native jvm, adding it to the system32 folder, ... You can find the project here

Steps to reproduce the issue

  1. Clone https://github.com/aproust33/pkcs-native/tree/main
  2. Donwload the pkcs11-wrapper jar and add it to your mvn repo
  3. Run mvn package
  4. Then native-image -cp target\single-proxy-native-0.0.1-SNAPSHOT.jar;C:\dev\tools\m2\iaik\pkcs\pkcs11-wrapper\1.4\pkcs11-wrapper-1.4.jar fr.devboxsante.cps.nativ.NativeCpsApplication -Djava.library.path=C:\dev\

Describe GraalVM and your environment:

  • openjdk 11.0.12 2021-07-20
  • OpenJDK Runtime Environment GraalVM CE 21.2.0 (build 11.0.12+6-jvmci-21.2-b08)
  • OpenJDK 64-Bit Server VM GraalVM CE 21.2.0 (build 11.0.12+6-jvmci-21.2-b08, mixed mode, sharing)*
  • OS: Windows 10
  • Architecture: [e.g.: AMD64]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions