现象
使用Jenkins 2.8,当我运行一个简单的Jenkins工作时,构建一个job获取源代码,出现下面的错误
FATAL: jenkins/scm/RunWithSCM
java.lang.NoClassDefFoundError: jenkins/scm/RunWithSCM
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:)
at jenkins.util.AntClassLoader.defineClassFromData(AntClassLoader.java:)
at hudson.ClassicPluginStrategy$AntClassLoader2.defineClassFromData(ClassicPluginStrategy.java:)
at jenkins.util.AntClassLoader.getClassFromStream(AntClassLoader.java:)
at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:)
at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:)
at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:)
at java.lang.ClassLoader.loadClass(ClassLoader.java:)
at org.jenkinsci.plugins.workflow.job.WorkflowJob$SCMListenerImpl.onCheckout(WorkflowJob.java:)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:)
at hudson.model.Run.execute(Run.java:)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:)
at hudson.model.ResourceController.execute(ResourceController.java:)
at hudson.model.Executor.run(Executor.java:)
Caused by: java.lang.ClassNotFoundException: jenkins.scm.RunWithSCM
at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:)
at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:)
at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:)
at java.lang.ClassLoader.loadClass(ClassLoader.java:)
... more
Finished: FAILURE
原因:
由于Jenkins下载插件不全导致,插件下载不全由于网络原因所致(公司可能屏蔽了Jenkins原来的镜像地址,导致下载不全)
解决方案:
可供选择的jenkins2 插件镜像列表:
Jenkins 所有镜像列表: http://mirrors.jenkins-ci.org/status.html
比如日本的镜像: http://mirror.esuni.jp/jenkins/, http://ftp.yz.yamagata-u.ac.jp/pub/misc/jenkins/, http://ftp.tsukuba.wide.ad.jp/software/jenkins/
德国的镜像:http://jenkins.mirror.isppower.de/ , http://mirror.yandex.ru/mirrors/jenkins/
官方的镜像:http://mirrors.jenkins-ci.org/, http://archives.jenkins-ci.org/
清华大学镜像:https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
更换地址方法
1.进入jenkins系统管理
2.进入插件管理
3.点击高级,修改升级站点的地址