简体   繁体   English

jenkins插件的类路径

[英]Classpath for jenkins plugins

I have a jenkins with the openid plugin installed. 我有一个安装了openid插件的jenkins。 I try to authenticate via openid, but receive a webpage complaining about java.lang.NoClassDefFoundError: org/openid4java/util/OpenID4JavaDOMParser . 我尝试通过openid进行身份验证,但收到一个抱怨java.lang.NoClassDefFoundError: org/openid4java/util/OpenID4JavaDOMParser

The missing class is contained in a jar located at "plugins/openid/WEB-INF/lib/". 缺少的类包含在位于“plugins / openid / WEB-INF / lib /”的jar中。

Why is Jenkins not able to load that class? 为什么Jenkins无法加载该类?

Any ideas how to debug? 任何想法如何调试? (The logfile does not give much more information besides the NoClassDefFoundError.) (除了NoClassDefFoundError之外,日志文件没有提供更多信息。)

Update: After symlinking the jar to "war/WEB-INF/lib" jenkins is able to access the class. 更新:将jar符号链接到“war / WEB-INF / lib”后,jenkins可以访问该类。 Seems like jars in plugins are simply ignored, but according to Documentation they should be accessible. 看起来像插件中的jar只是被忽略,但根据文档,它们应该是可访问的。

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 . 这取决于类加载器正在尝试加载类,如果它被某些库或发现初始化,它可能使用Thread类加载器而不是插件类加载器,它通常是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. 我和jax-rs有同样的问题并以这种方式修复它。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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