Jenkins的间歇性构建失败

时间:2012-11-18 13:58:47

标签: linux git build jenkins

我在Jenkins(在linux上运行)中有项目,该项目以定义的时间间隔轮询SCM并构建新的更改。我使用以下控制台输出间歇性地获取构建失败:

Started by user MyUser User
Building on master in workspace <http://ci.mybuild.com:8080/job/temp-project/ws/>
Checkout:workspace / <http://ci.mybuild.com:8080/job/temp-project/ws/> - hudson.remoting.LocalChannel@5f2c402a
Using strategy: Default
Cloning the remote Git repository
Cloning repository origin
FATAL: hudson/FilePath$11
java.lang.NoClassDefFoundError: hudson/FilePath$11
    at hudson.FilePath.deleteRecursive(FilePath.java:980)
    at hudson.plugins.git.GitAPI.clone(GitAPI.java:211)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1121)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1063)
    at hudson.FilePath.act(FilePath.java:851)
    at hudson.FilePath.act(FilePath.java:824)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1063)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1308)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:676)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:581)
    at hudson.model.Run.execute(Run.java:1516)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:236)

我尝试使用类似的配置创建一个新作业,但第一个版本因此错误而失败。

有人可以帮我提一下这个吗?

3 个答案:

答案 0 :(得分:1)

在日志中查看 - deleteRecursive 失败:

...
java.lang.NoClassDefFoundError: hudson/FilePath$11
    at hudson.FilePath.deleteRecursive(FilePath.java:980)
    at hudson.plugins.git.GitAPI.clone(GitAPI.java:211)
...

这可能意味着您的文件系统阻止删除该区域中的文件 -
请检查文件权限(也在文件夹上)。

答案 1 :(得分:1)

这几乎肯定会发生,因为Jenkins正在尝试清理/删除另一个进程同时访问的文件。

在看到此错误后立即尝试运行以下命令:

lsof /my/repo/dir

这将告诉您哪些文件在您的repo目录中被锁定以及锁定它们的内容。

答案 2 :(得分:-1)

问题

异常的本质是类加载之一。基于实际例外:

java.lang.NoClassDefFoundError: hudson/FilePath$11

意味着JVM无法找到类定义(显然)。 “FilePath”之后的美元符号和数字($ 11)表示它找不到FilePath类中定义的匿名内部类,可以在以下位置看到:

https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/FilePath.java

这支持这一理论,因为存在“FileCallable”的匿名实现。

解决方案

现在对于困难的部分,该怎么做。

我怀疑你是在某种形式的网络容器中运行jenkins(在目前的问题形式中不知道)。 Web容器因其类加载特性而臭名昭着。如果可以,请尝试运行jenkins standalone或其他容器。

另外,你在容器启动时是否正在摆弄类路径?它是否在同一台机器上使用构建器从站?我建议先调查这些问题。

相关问题