简体   繁体   中英

Classpath for jenkins plugins

I have a jenkins with the openid plugin installed. I try to authenticate via openid, but receive a webpage complaining about java.lang.NoClassDefFoundError: org/openid4java/util/OpenID4JavaDOMParser .

The missing class is contained in a jar located at "plugins/openid/WEB-INF/lib/".

Why is Jenkins not able to load that class?

Any ideas how to debug? (The logfile does not give much more information besides the NoClassDefFoundError.)

Update: After symlinking the jar to "war/WEB-INF/lib" jenkins is able to access the class. Seems like jars in plugins are simply ignored, but according to Documentation they should be accessible.

It depends on what classloader is trying to load the class, if it gets initialized by some library or discovery it may use the Thread classloader instead of your plugin classloader, which is typically a ClassicPluginStrategy$AntClassLoader2 .

You may have an option to pass a classloader or create the instance directly. I had the same issue with jax-rs and fixed it that way.

https://github.com/carlossg/KubernetesAPIJavaClient/blob/c6082e3/src/main/java/com/github/kubernetes/java/client/v2/RestFactory.java#L66

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM