Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-15466

Fatal Error No Class Definition found for Kernel32

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • Windows 7 64bit
      jdk1.7.0_07

      Hi,
      We are periodically getting issues with the hudson.util.jna.Kernel32 class not being found when plugins are calling the isSymlink method.

      [xUnit] [INFO] - [UnitTest-1.4 (default)] - 1 test report file(s) were found with the pattern 'tests.xml' relative to 'C:\Jenkins\jobs\NetworkTeam Test\workspace' for the testing framework 'UnitTest-1.4 (default)'.
      FATAL: Could not initialize class hudson.util.jna.Kernel32
      java.lang.NoClassDefFoundError: Could not initialize class hudson.util.jna.Kernel32
      	at hudson.util.jna.Kernel32Utils.isJunctionOrSymlink(Kernel32Utils.java:62)
      	at hudson.Util.isSymlink(Util.java:322)
      	at hudson.Util.deleteRecursive(Util.java:283)
      	at hudson.FilePath$11.invoke(FilePath.java:982)
      	at hudson.FilePath$11.invoke(FilePath.java:980)
      	at hudson.FilePath.act(FilePath.java:851)
      	at hudson.FilePath.act(FilePath.java:824)
      	at hudson.FilePath.deleteRecursive(FilePath.java:980)
      	at org.jenkinsci.plugins.xunit.XUnitPublisher.processDeletion(XUnitPublisher.java:374)
      	at org.jenkinsci.plugins.xunit.XUnitPublisher.performXUnit(XUnitPublisher.java:124)
      	at org.jenkinsci.plugins.xunit.XUnitPublisher.perform(XUnitPublisher.java:93)
      	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:807)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:782)
      	at hudson.model.Build$BuildExecution.post2(Build.java:183)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:729)
      	at hudson.model.Run.execute(Run.java:1541)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:236)
      

      The class file seems to be present and correct compared with the github versions and we are running with Admin access to the filesystem.

      Any help would be appreciated.
      Rob

          [JENKINS-15466] Fatal Error No Class Definition found for Kernel32

          Bruce Rust added a comment -

          @dogfood - I use 1.480.1 LTS and after upgrading to this version from 1.447.2 some of my nodes starting have the issues but others do not. I have the issue with SVN updates when they do the deleting of files as part of the cleanup. So is the issue related to the plugin or is it part of the core Jenkins? As for the fix above, when will that be integrated into the LTS versions because this is killing us. The only good work around I have found so far is to remove the workspace files for the problem build and then build again. The removal is a manual process. Setting SVN to do a fresh checkout does not seem to work either.

          Anyone else have options? If we reverted, what version should we downgrade to?

          Thanks

          Bruce Rust added a comment - @dogfood - I use 1.480.1 LTS and after upgrading to this version from 1.447.2 some of my nodes starting have the issues but others do not. I have the issue with SVN updates when they do the deleting of files as part of the cleanup. So is the issue related to the plugin or is it part of the core Jenkins? As for the fix above, when will that be integrated into the LTS versions because this is killing us. The only good work around I have found so far is to remove the workspace files for the problem build and then build again. The removal is a manual process. Setting SVN to do a fresh checkout does not seem to work either. Anyone else have options? If we reverted, what version should we downgrade to? Thanks

          pjdarton added a comment -

          This issue isn't related to the plugin - it hits more than just the SVN plugin - it's related to the core Jenkins code that the plugins use: Basically, it's very difficult to do basic filesystem operations with any reliability on Windows.

          I suspect that upgrading to the latest Jenkins and running that on a Java7 JVM may neatly sidestep this issue, but I've not tried that myself (I just added a try/catch around the problem code and ran a version of Jenkins that I'd compiled myself, as I also wanted to include code that retried delete ops under Windows which haven't made it into the main code yet).

          pjdarton added a comment - This issue isn't related to the plugin - it hits more than just the SVN plugin - it's related to the core Jenkins code that the plugins use: Basically, it's very difficult to do basic filesystem operations with any reliability on Windows. I suspect that upgrading to the latest Jenkins and running that on a Java7 JVM may neatly sidestep this issue, but I've not tried that myself (I just added a try/catch around the problem code and ran a version of Jenkins that I'd compiled myself, as I also wanted to include code that retried delete ops under Windows which haven't made it into the main code yet).

          I have the same issue raised during the workspace cleaning.
          Jenkins 1.480.3
          Slave: Win2003, java 6_22 and 7_15 (both tested)

          Nickolay Rumyantsev added a comment - I have the same issue raised during the workspace cleaning. Jenkins 1.480.3 Slave: Win2003, java 6_22 and 7_15 (both tested)

          Bruce Rust added a comment -

          The workaround I have found that seems to work so far is to set the SVN checkout option "Use 'svn update' as much as possible". That way it doesn't try to do a delete, just does an update. This work around is ok for some jobs, but others really need to use the "Emulate a clean checkout" option to ensure everything is clean. So I guess I am reiterating that this is still a big issue and is there anyway to get a fix into the latest LTS version?

          Bruce Rust added a comment - The workaround I have found that seems to work so far is to set the SVN checkout option "Use 'svn update' as much as possible". That way it doesn't try to do a delete, just does an update. This work around is ok for some jobs, but others really need to use the "Emulate a clean checkout" option to ensure everything is clean. So I guess I am reiterating that this is still a big issue and is there anyway to get a fix into the latest LTS version?

          it looks like the error is occured when Jenkins attempts to delete file on Windows machine.

          Nickolay Rumyantsev added a comment - it looks like the error is occured when Jenkins attempts to delete file on Windows machine.

          pixman20 added a comment -

          Since this is fixed on the trunk, will/can this be marked as resolved soon so that it can be released into 1.504?

          pixman20 added a comment - Since this is fixed on the trunk, will/can this be marked as resolved soon so that it can be released into 1.504?

          And what is also very important when it could be released in LTS?

          Nickolay Rumyantsev added a comment - And what is also very important when it could be released in LTS?

          Code changed in jenkins
          User: Jesse Glick
          Path:
          changelog.html
          core/src/main/java/hudson/Util.java
          core/src/main/java/hudson/util/jna/Kernel32Utils.java
          http://jenkins-ci.org/commit/jenkins/010866ba90fb7af074c5c447c1bd5143f60c00e2
          Log:
          [FIXED JENKINS-15466] More robust handling of Windows JNA errors.
          b5ed319 already caught linkage errors but then unconditionally returned false from Util.isSymlink, which is wrong;
          we want to fall back to the generic File.canonicalPath comparisons in this case.


          You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
          For more options, visit https://groups.google.com/groups/opt_out.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: changelog.html core/src/main/java/hudson/Util.java core/src/main/java/hudson/util/jna/Kernel32Utils.java http://jenkins-ci.org/commit/jenkins/010866ba90fb7af074c5c447c1bd5143f60c00e2 Log: [FIXED JENKINS-15466] More robust handling of Windows JNA errors. b5ed319 already caught linkage errors but then unconditionally returned false from Util.isSymlink, which is wrong; we want to fall back to the generic File.canonicalPath comparisons in this case. – You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out .

          dogfood added a comment -

          Integrated in jenkins_main_trunk #2308
          [FIXED JENKINS-15466] More robust handling of Windows JNA errors. (Revision 010866ba90fb7af074c5c447c1bd5143f60c00e2)

          Result = SUCCESS
          Jesse Glick : 010866ba90fb7af074c5c447c1bd5143f60c00e2
          Files :

          • core/src/main/java/hudson/Util.java
          • changelog.html
          • core/src/main/java/hudson/util/jna/Kernel32Utils.java

          dogfood added a comment - Integrated in jenkins_main_trunk #2308 [FIXED JENKINS-15466] More robust handling of Windows JNA errors. (Revision 010866ba90fb7af074c5c447c1bd5143f60c00e2) Result = SUCCESS Jesse Glick : 010866ba90fb7af074c5c447c1bd5143f60c00e2 Files : core/src/main/java/hudson/Util.java changelog.html core/src/main/java/hudson/util/jna/Kernel32Utils.java

          I am facing this issue on version 2.73.2. Please find the log file below.

          Nov 02, 2017 3:41:48 PM hudson.remoting.jnlp.Main$CuiListener status
          INFO: Remote identity confirmed: fe:69:3c:a5:b3:d4:da:b1:4d:b4:d9:1b:0d:9a:1b:b4
          Nov 02, 2017 3:41:48 PM hudson.remoting.jnlp.Main$CuiListener status
          INFO: Connected
          WARNING: An illegal reflective access operation has occurred
          WARNING: Illegal reflective access by hudson.remoting.RemoteClassLoader (file:/C:/Users/jenkins/Desktop/slave.jar) to method java.lang.ClassLoader.getClassLoadingLock(java.lang.String)
          WARNING: Please consider reporting this to the maintainers of hudson.remoting.RemoteClassLoader
          WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
          WARNING: All illegal access operations will be denied in a future release
          Nov 02, 2017 3:41:55 PM hudson.util.jna.Kernel32Utils load
          SEVERE: Failed to load Kernel32
          java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
          at hudson.util.jna.Kernel32Utils.load(Kernel32Utils.java:112)
          at hudson.util.jna.Kernel32.<clinit>(Kernel32.java:37)
          at hudson.util.jna.Kernel32Utils.getWin32FileAttributes(Kernel32Utils.java:77)
          at hudson.util.jna.Kernel32Utils.isJunctionOrSymlink(Kernel32Utils.java:98)
          at hudson.Util.isSymlink(Util.java:513)
          at hudson.FilePath.deleteRecursive(FilePath.java:1201)
          at hudson.FilePath.deleteContentsRecursive(FilePath.java:1220)
          at hudson.FilePath.access$1100(FilePath.java:197)
          at hudson.FilePath$15.invoke(FilePath.java:1194)
          at hudson.FilePath$15.invoke(FilePath.java:1191)
          at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2750)
          at hudson.remoting.UserRequest.perform(UserRequest.java:153)
          at hudson.remoting.UserRequest.perform(UserRequest.java:50)
          at hudson.remoting.Request$2.run(Request.java:336)
          at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
          at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          at hudson.remoting.Engine$1$1.run(Engine.java:94)
          at java.base/java.lang.Thread.run(Unknown Source)

          Rakesh Nambiar added a comment - I am facing this issue on version 2.73.2. Please find the log file below. Nov 02, 2017 3:41:48 PM hudson.remoting.jnlp.Main$CuiListener status INFO: Remote identity confirmed: fe:69:3c:a5:b3:d4:da:b1:4d:b4:d9:1b:0d:9a:1b:b4 Nov 02, 2017 3:41:48 PM hudson.remoting.jnlp.Main$CuiListener status INFO: Connected WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by hudson.remoting.RemoteClassLoader ( file:/C:/Users/jenkins/Desktop/slave.jar ) to method java.lang.ClassLoader.getClassLoadingLock(java.lang.String) WARNING: Please consider reporting this to the maintainers of hudson.remoting.RemoteClassLoader WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release Nov 02, 2017 3:41:55 PM hudson.util.jna.Kernel32Utils load SEVERE: Failed to load Kernel32 java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native at hudson.util.jna.Kernel32Utils.load(Kernel32Utils.java:112) at hudson.util.jna.Kernel32.<clinit>(Kernel32.java:37) at hudson.util.jna.Kernel32Utils.getWin32FileAttributes(Kernel32Utils.java:77) at hudson.util.jna.Kernel32Utils.isJunctionOrSymlink(Kernel32Utils.java:98) at hudson.Util.isSymlink(Util.java:513) at hudson.FilePath.deleteRecursive(FilePath.java:1201) at hudson.FilePath.deleteContentsRecursive(FilePath.java:1220) at hudson.FilePath.access$1100(FilePath.java:197) at hudson.FilePath$15.invoke(FilePath.java:1194) at hudson.FilePath$15.invoke(FilePath.java:1191) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2750) at hudson.remoting.UserRequest.perform(UserRequest.java:153) at hudson.remoting.UserRequest.perform(UserRequest.java:50) at hudson.remoting.Request$2.run(Request.java:336) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at hudson.remoting.Engine$1$1.run(Engine.java:94) at java.base/java.lang.Thread.run(Unknown Source)

            Unassigned Unassigned
            rstarkey Rob Starkey
            Votes:
            14 Vote for this issue
            Watchers:
            29 Start watching this issue

              Created:
              Updated:
              Resolved: