java - Jenkins 作业因错误 java.lang.NoClassDefFoundError 而失败

标签 java jenkins build artifacts jenkins-job-builder

我们已安排 Jenkins Build 来创建 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)

是什么导致了这个问题,如何解决?

最佳答案

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

之后重启Jenkins就可以了

关于java - Jenkins 作业因错误 java.lang.NoClassDefFoundError 而失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51724860/

相关文章:

Java、SWT : how to make a shell transparent (not alpha!)

java - 对一手扑克进行排序

Java无法重写构造函数中使用的方法: The method setupAnimationFrames() of type Slime must override or implement a supertype method

maven - 尝试通过 allure-jenkins-plugin 创建 allure 报告时出现 NullPointerException

visual-studio - 在构建期间无法自动将 NuGet 包更新到最新版本

c++ - 使用 CMake 从没有相对路径的子目录导入

java - 如何在java中分割复杂字符串以及如何对值求和?

java - Jenkins:失败的 TestNG 测试中的错误消息未格式化

jenkins - 如何在脚本化 Jenkinsfile 中使用多个属性?

c - 如何在没有 sudo 的情况下构建 Mongodb C 驱动程序