Saturday, October 1, 2016

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/cache/CacheBuilder on WindowsAuthProviderImpl class


Hey guys,


Recently I was working with JNA using Waffle to get the user details, and at same time creating a token on client side, in order to create a trust relationship between the targets.. Then i got this issue that I would like to share how to fix:

On top of JNA exists a library called Waffle which encapsulates all functionality you need to implement user authentication. Get from GitHub at https://github.com/dblock/waffle and also on Maven central. To download the jar files get from here: https://github.com/dblock/waffle/releases/download/Waffle-1.8.0/Waffle.1.8.zip



Using waffle project I got this error recently:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/cache/CacheBuilder
at waffle.windows.auth.impl.WindowsAuthProviderImpl.<init>(WindowsAuthProviderImpl.java:68)
at waffle.windows.auth.impl.WindowsAuthProviderImpl.<init>(WindowsAuthProviderImpl.java:58)
at thiago.leoncio.Authenticator.main(Authenticator.java:19)
Caused by: java.lang.ClassNotFoundException: com.google.common.cache.CacheBuilder
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more


To fix this you must add the library that has all google classes. It's name is guava-18.0.jar  and of course the waffle one: waffle-jna-1.8.0.jar


Please, check this JNA and Waffle article also:  http://phonecoding.com/2016/10/how-to-use-waffle-library-for-jna-java.html


I hope this helps,
Thiago Leoncio.

No comments:

Post a Comment