Jenkins作业失败,错误为java.lang.NoClassDefFoundError

时间:2018-08-07 10:44:29

标签: java jenkins build artifacts jenkins-job-builder

我们已经安排了Jenkins构建来创建AWS VM,VM已成功联机,但是在归档工件时,作业失败并显示以下错误消息。

Archiving artifacts
ERROR: Step ‘Archive the artifacts’ aborted due to exception: 
java.lang.NoClassDefFoundError: Could not initialize class sun.nio.fs.LinuxNativeDispatcher
    at sun.nio.fs.LinuxUserDefinedFileAttributeView.copyExtendedAttributes(LinuxUserDefinedFileAttributeView.java:291)
    at sun.nio.fs.LinuxFileSystem.copyNonPosixAttributes(LinuxFileSystem.java:72)
    at sun.nio.fs.UnixCopyFile.copyFile(UnixCopyFile.java:267)
    at sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:581)
    at sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:253)
    at java.nio.file.Files.copy(Files.java:1274)
    at hudson.FilePath$31$1.visit(FilePath.java:2296)
    at hudson.util.DirScanner.scanSingle(DirScanner.java:44)
    at hudson.FilePath$ExplicitlySpecifiedDirScanner.scan(FilePath.java:2991)
    at hudson.FilePath$31.invoke(FilePath.java:2290)
    at hudson.FilePath$31.invoke(FilePath.java:2283)
    at hudson.FilePath.act(FilePath.java:1042)
    at hudson.FilePath.act(FilePath.java:1025)
    at hudson.FilePath.copyRecursiveTo(FilePath.java:2283)
    at jenkins.model.StandardArtifactManager.archive(StandardArtifactManager.java:61)
    at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:235)
    at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
    at hudson.model.Build$BuildExecution.post2(Build.java:186)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
    at hudson.model.Run.execute(Run.java:1823)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)

是什么原因导致此问题以及如何解决?请帮忙。

3 个答案:

答案 0 :(得分:2)

我在Centos7系统中遇到了同样的问题,解决了它安装新的jdk并使用/ usr / sbin / alternatives --config java设置默认jdk

然后,重新启动Jenkins,仅此

答案 1 :(得分:1)

通过以下方式禁用评价

/etc/init.d/apparmor stop

答案 2 :(得分:0)

在我们的例子中,这是由于Jenkins运行时更新openjdk软件包引起的。詹金斯重新启动修复了它。可能是由指向当前JVM目录的过时的符号链接引起的。