microsoft / vsts-authentication-library-for-java

Retrieve OAuth2 or Personal Accesss Tokens for Visual Studio Team Services (visualstudio.com) accounts. Also provides secure storage for those secrets on different platforms.
MIT License
18 stars 20 forks source link

Help Debugging Silent Failure of `StorageProvider.getCredentialStorage` #21

Open idbentley opened 5 years ago

idbentley commented 5 years ago

Hi Team. I'm working with this library to provide a secure "remember me" function for my application.

I've had great luck using the library both in Linux and Windows, thanks for all the hard work!

I'm currently having a problem on a single Windows machine. Every other machine I've tested the library with, everything works fine.

On this machine when I call StorageProvider.getCredentialStorage with either PREFER, or MUST, my application crashes completely with no information in my log4j error logs.

I'm no Windows specialist, and was hoping that you could give me some idea how I might begin debugging this issue. Wrapping the call in a exception block didn't stop the application crashing, which makes me believe that this is an operating system level issue.

Thanks, Ian

idbentley commented 5 years ago

After some experimentation, I believe the problem to be related to having more than one version of jna.jar on the path. The exception was a Throwable, not an Exception:

java.lang.NoSuchMethodError: com.sun.jna.Structure.<init>(Lcom/sun/jna/Pointer;)V
at com.microsoft.alm.storage.windows.internal.CredAdvapi32$CREDENTIAL.<init>(CredAdvapi32.java:187)
at com.microsoft.alm.storage.windows.internal.CredManagerBackedSecureStore.get(CredManagerBackedSecureStore.java:87)