Exception java.lang.UnsatisfiedLinkError: Unable to locate JNA native support library

Answered

We are developing a java application that stores some data into the Windows Credentials.

For accessing to the Windows Credentials we are using the credential-secure-storage library

https://github.com/microsoft/credential-secure-storage-for-java

We have tried with the version 1.0.0 (jdk 11) and we have also compiled the 1.0.3 with jdk 17 with the same results.

The error is when we try to get the secure storage object Windows

StorageProvider.getCredentialStorage(true, SecureOption.REQUIRED);

The code works perfectly when we run it under command line with java jdk 

(oracle Open JDK 17.0.12)

However when we embed into the Webstorm plugin we are developing we get this error in Windows (in Mac works well)

 

detailMessage = "Exception java.lang.UnsatisfiedLinkError: Unable to locate JNA native support library [in thread "Thread-84"]"
0 = {StackTraceElement@38012} "com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:992)"
1 = {StackTraceElement@38013} "com.sun.jna.Native.<clinit>(Native.java:195)"
2 = {StackTraceElement@38014} "com.microsoft.credentialstorage.implementation.windows.CredAdvapi32.<clinit>(CredAdvapi32.java:26)"
3 = {StackTraceElement@38015} "com.microsoft.credentialstorage.implementation.windows.CredManagerBackedSecureStore.getCredAdvapi32Instance(CredManagerBackedSecureStore.java:220)"
4 = {StackTraceElement@38016} "com.microsoft.credentialstorage.implementation.windows.CredManagerBackedSecureStore.<init>(CredManagerBackedSecureStore.java:30)"
5 = {StackTraceElement@38017} "com.microsoft.credentialstorage.implementation.windows.CredManagerBackedCredentialStore.<init>(CredManagerBackedCredentialStore.java:13)"
6 = {StackTraceElement@38018} "com.microsoft.credentialstorage.StorageProvider.<clinit>(StorageProvider.java:75)"

 

The environment for testing is: Windows 11, oracle Open JDK 17.0.12, Webstorm 2024.1.6

 

We appreciate support for this.

2
3 comments

I understand, however advappi32.dll is a part of Windows operative system

it is located in C:\Windows\System32\

0

At the end we were able to find the problem, it was the library

jnidispatch.dll

It is into the webstorm application and also inside the jna library so there is a problem trying to load the library twice. Removing the library for the webstorm version fixed the problem.

0

Please sign in to leave a comment.