Jenkins在centos环境下连接gitee报错问题

杜河
2023-12-01

问题描述

在centos环境下jenkins配置gitee时测试连接出现无法连接ERROR问题,期初怀疑是加速镜像导致gitee插件失效问题,后来看了后台错误日志后发现在centos环境下缺失jar包,之前在windows环境下测试不会出现此问题!

后台错误日志

2021-12-23 07:40:52.740+0000 [id=10]    WARNING h.i.i.InstallUncaughtExceptionHandler#handleException: Caught unhandled exception with ID 71ead75a-2a1f-4e50-b26c-ea7f90c252f7
java.lang.ClassNotFoundException: javax.ws.rs.ext.MessageBodyReader
        at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1402)
        at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1357)
        at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1112)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
Caused: java.lang.NoClassDefFoundError: javax/ws/rs/ext/MessageBodyReader
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
        at org.apache.tools.ant.AntClassLoader.defineClassFromData(AntClassLoader.java:1172)
        at org.apache.tools.ant.AntClassLoader.getClassFromStream(AntClassLoader.java:1340)
        at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1392)
        at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1357)
        at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1112)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
        at org.apache.tools.ant.AntClassLoader.defineClassFromData(AntClassLoader.java:1172)
        at org.apache.tools.ant.AntClassLoader.getClassFromStream(AntClassLoader.java:1340)
        at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1392)
        at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1357)
        at jenkins.ClassLoaderReflectionToolkit.loadClass(ClassLoaderReflectionToolkit.java:148)
        at hudson.ClassicPluginStrategy$DependencyClassLoader.findClass(ClassicPluginStrategy.java:649)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at org.apache.tools.ant.AntClassLoader.findBaseClass(AntClassLoader.java:1421)
        at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1108)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at com.gitee.jenkins.gitee.api.impl.ResteasyGiteeClientBuilder.buildClient(ResteasyGiteeClientBuilder.java:115)
        at com.gitee.jenkins.gitee.api.impl.ResteasyGiteeClientBuilder.buildClient(ResteasyGiteeClientBuilder.java:81)
        at com.gitee.jenkins.connection.GiteeConnection.getClient(GiteeConnection.java:116)
        at com.gitee.jenkins.connection.GiteeConnectionConfig.doTestConnection(GiteeConnectionConfig.java:145)
        at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
        at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:398)
        at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:410)
        at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:208)
        at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:141)
        at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:558)
        at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:59)
        at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:766)

解决办法

我的jenkins版本为2.325,上面报错信息中描述为缺失jar包

1.将jenkins的war包解压处理
2.找到** \WEB-INF\lib **路径
3.下载 javax.ws.rs-api-2.0.jar放到lib目录即可.
4.下载地址
jar包下载地址
5.重启jenkins
6.重新测试连接,出现成功字样即可!

 类似资料: