Jenkins安装gitlab hook plugin失败的解决办法

jenkins在安装git hook plugins提示失败:

OS : CentOS 6.5 64位
Jenkins : 1.638
JDK : 1.8.0_66
Ruby-runtime : 0.12
问题 : gitlab hook plugin无法安装的原因是因为ruby-runtime无法安装.

java.io.IOException: Failed to dynamically deploy this plugin
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1308)
at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1107)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:104)
at java.lang.Thread.run(Unknown Source)

解决办法:

  1. 看上去是在下载过程中文件出现了问题. 首先关闭Jenkins.找到jenkins主目录下面的插件目录,我的目录在/home/web/.jenkins/plugins, 删除相关文件gitlab-hook.jpi和ruby-runtime.jpi

  2. 重启jenkins, 试着重新安装.还是无法安装成功,报错信息,应该是下载文件的网络问题:

hudson.util.IOException2: Failed to download from http://updates.jenkins-ci.org/download/plugins/ruby-runtime/0.12/ruby-runtime.hpi
at hudson.model.UpdateCenter\$UpdateCenterConfiguration.download(UpdateCenter.java:797)
    at hudson.model.UpdateCenter\$DownloadJob._run(UpdateCenter.java:1148)
    at hudson.model.UpdateCenter\$InstallationJob._run(UpdateCenter.java:1309)
    at hudson.model.UpdateCenter\$DownloadJob.run(UpdateCenter.java:1126)
    at java.util.concurrent.Executors\$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:110)
    at java.lang.Thread.run(Thread.java:745)

手动下载相关的文件,现在地址在这里, 找到相关的插件,然后选择版本.下载到本地

进入jenkins的系统设置->插件管理->高级->上传插件,把下载到本地文件的插件上传到jenkins的服务器进行安装.

还是报错:

java.io.IOException: Failed to dynamically deploy this plugin
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1328)
at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1126)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:110)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Failed to install ruby-runtime plugin
at hudson.PluginManager.dynamicLoad(PluginManager.java:487)
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1324)
... 5 more
Caused by: java.io.IOException: Failed to initialize
at hudson.ClassicPluginStrategy.load(ClassicPluginStrategy.java:441)
at hudson.PluginManager.dynamicLoad(PluginManager.java:478)
... 6 more
Caused by: java.lang.ClassCircularityError: org/jruby/RubyClass
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.jenkinsci.bytecode.ClassWriter.loadClass(ClassWriter.java:97)
at org.jenkinsci.bytecode.ClassWriter.getCommonSuperClass(ClassWriter.java:64)
at org.kohsuke.asm5.ClassWriter.getMergedType(ClassWriter.java:1654)
at org.kohsuke.asm5.Frame.merge(Frame.java:1426)
at org.kohsuke.asm5.Frame.merge(Frame.java:1374)
at org.kohsuke.asm5.MethodWriter.visitMaxs(MethodWriter.java:1475)
at org.kohsuke.asm5.tree.MethodNode.accept(MethodNode.java:833)
at org.kohsuke.asm5.commons.JSRInlinerAdapter.visitEnd(JSRInlinerAdapter.java:187)
at org.jenkinsci.bytecode.Transformer$1$1.visitEnd(Transformer.java:107)
at org.kohsuke.asm5.MethodVisitor.visitEnd(MethodVisitor.java:877)
at org.kohsuke.asm5.ClassReader.readMethod(ClassReader.java:1021)
at org.kohsuke.asm5.ClassReader.accept(ClassReader.java:693)
at org.kohsuke.asm5.ClassReader.accept(ClassReader.java:506)
at org.jenkinsci.bytecode.Transformer.transform(Transformer.java:113)
at hudson.ClassicPluginStrategy$AntClassLoader2.defineClassFromData(ClassicPluginStrategy.java:800)
at jenkins.util.AntClassLoader.getClassFromStream(AntClassLoader.java:1310)
at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1366)
at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1326)
at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1079)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.jenkinsci.jruby.RubyClassConverter.(RubyClassConverter.java:12)
at org.jenkinsci.jruby.JRubyXStream.register(JRubyXStream.java:25)
at ruby.RubyRuntimePlugin.initRubyXStreams(RubyRuntimePlugin.java:44)
at ruby.RubyRuntimePlugin.start(RubyRuntimePlugin.java:28)
at hudson.ClassicPluginStrategy.startPlugin(ClassicPluginStrategy.java:449)
at hudson.ClassicPluginStrategy.load(ClassicPluginStrategy.java:438)
... 7 more

网上继续寻找问题,在Jenkins的官网找到一个issue, 描述的就是这个问题. Phellipe Ribeiro最后给出了一个在CentOS的临时解决方案:

编辑Jenkins的配置文件 /etc/sysconfig/jenkins 的JENKINS_JAVA_OPTIONS

修改后 :

JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.ClassicPluginStrategy.noBytecodeTransformer=true"

你可能感兴趣的:(Jenkins)