4

We have scheduled a Jenkins Build to create AWS VM, VM is successfully online but while archiving the Artifacts, job got failed with below error message.

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)

What is causing this issue and how to resolve it?

Dharman
  • 30,962
  • 25
  • 85
  • 135
SeJaPy
  • 284
  • 1
  • 6
  • 18

4 Answers4

3

I had the same problem in a Centos7 system and solved it installing a new jdk and setting the default jdk with /usr/sbin/alternatives --config java

After that, restart Jenkins and that's all

Raul
  • 66
  • 2
3

In our case this was caused by updating the openjdk package while Jenkins was running. A Jenkins restart fixed it. Possibly caused by stale symlinks pointing to the current JVM directory.

dskrvk
  • 1,318
  • 15
  • 24
  • 1
    Yes, it worked!.. This is because of the Symliks of previous JDK version that were tagged to running Jenkins process. Once we restart the Jenkins, the symlinks got updated and the error is gone. Thankyou very much. – Sri Jul 18 '22 at 15:08
1

I did not change anything. I just restarted Jenkins.

norms
  • 41
  • 3
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/31281210) – rikyeah Mar 15 '22 at 07:52
  • This was the solution for me – grahamjgreen Aug 22 '22 at 13:08
-3

Disable apparrmor by

/etc/init.d/apparmor stop
user3599934
  • 11
  • 1
  • 6