jenkins_java.lang.NoClassDefFoundError
出现这个问题其实是挺苦恼的,之前也有过一点java基础,对于这种问题,要么就是jenkins安装不完整,有些类找不到,要么就是jdk环境变量或者是class_path没有配置正确在构建的时候出现发了如下问题FATAL: org/jenkinsci/plugins/workflow/job/WorkflowRunjava.lang.NoClassDefFoundError: org/j...
·
出现这个问题其实是挺苦恼的,之前也有过一点java基础,对于这种问题,要么就是jenkins安装不完整,有些类找不到,要么就是jdk环境变量或者是class_path没有配置正确
在构建的时候出现发了如下问题
FATAL: org/jenkinsci/plugins/workflow/job/WorkflowRun
java.lang.NoClassDefFoundError: org/jenkinsci/plugins/workflow/job/WorkflowRun
at org.jenkinsci.plugins.workflow.job.WorkflowJob$SCMListenerImpl.onCheckout(WorkflowJob.java:653)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:609)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1741)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Finished: FAILURE
至于具体原因也没有找到,我原来用的java版本是二进制文件,不在标准环境变量路径中,但是我安装了jdk-1.8.0-openjdk后,再重新启动jenkins,发现原来构建失败的都构建成功了。
突然想到一个问题,有可能是java环境问题,因为只给他bin可执行文件的路径还是不够的,还需要jvm运行时需要的类库
直接修改下面的文件就好了,所以要想用自己安装的jdk,则可以将自己的jdk路径写在candidates数组的靠前位置, 或者只写自己的安装路径信息
$ vim /etc/init.d/jenkins
# Search usable Java as /usr/bin/java might not point to minimal version required by Jenkins.
# see http://www.nabble.com/guinea-pigs-wanted-----Hudson-RPM-for-RedHat-Linux-td25673707.html
# candidates="
# /etc/alternatives/java
# /usr/lib/jvm/java-1.8.0/bin/java
# /usr/lib/jvm/jre-1.8.0/bin/java
# /usr/lib/jvm/java-1.7.0/bin/java
# /usr/lib/jvm/jre-1.7.0/bin/java
# /usr/bin/java
# "
candidates="
/usr/local/jdk/bin/java
/usr/local/jdk/jre/java
"
# 这里可以看到其实就是给JENKINS_JAVA_CMD变量赋值
for candidate in $candidates
do
[ -x "$JENKINS_JAVA_CMD" ] && break
JENKINS_JAVA_CMD="$candidate"
done
更多推荐
已为社区贡献1条内容
所有评论(0)