Error importing library (.JAR) and using it in a script


We have imported a library (google-oauth-client-1.30.1) through Bonitasoft's library loading manager. The load looks good and is available, but when we are going to import it into a script and evaluate that import, the following exception appears:

(...) Groovy script throws an exception of type class java.lang.NoClassDefFoundError.

We tried placing the .JAR in the Bonita folders and in the workspace but the same exception followed. Reading we have found that it may be a problem with the ClassPath and class loader, but we do not know how to solve it to use this library.

We appreciate you can help us.

1 answer

This one is the BEST answer!

Hi, There is a great chance that google-oauth-client-1.30.1 depends from other libraries that also needs to be imported.

If you check the compile dependencies here you'll see that you also need: * guava * google-http-client-gson * google-http-client-apache-v2 * google-oauth-client

I don't know how do you intend to use the oauth-client but I recommend implementing your logic in a side project using maven or gradle to retrieved all required transitive dependencies.
You can also try to generate a shaded jar to have only have one jar to import in your bonita project and bar files.