Search code examples
androidiosjenkinsjava-9

Jenkins: FATAL: Could not initialize class hudson.util.ProcessTree$UnixReflection


FATAL: Could not initialize class hudson.util.ProcessTree$UnixReflection
java.lang.NoClassDefFoundError: Could not initialize class hudson.util.ProcessTree$UnixReflection
at hudson.util.ProcessTree$UnixProcess.kill(ProcessTree.java:647)
at hudson.util.ProcessTree$UnixProcess.killRecursively(ProcessTree.java:668)
at hudson.util.ProcessTree$UnixProcess.killRecursively(ProcessTree.java:667)
at hudson.util.ProcessTree$Unix.killAll(ProcessTree.java:589)
at hudson.Launcher$LocalLauncher.kill(Launcher.java:949)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:502)
at hudson.model.Run.execute(Run.java:1737)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:421)

Jenkins ver. 2.73.3 MacOSx

Doing an iOS build and upload to hockeyapp. The .ipa is created successfully, error seems to happen afterwards, seems like on the hockeyapp upload. I have an android project that works and uploads to hockeyapp successfully though.

Started getting this today after updating Jenkins and plugins. Was working before.

Any ideas?


Solution

  • happened to me when running an Android build (Jenkins build 2.86, I just downgraded from 2.87 or something slighlty newer, because of other fails)

    Build step 'Invoke Gradle script' changed build result to SUCCESS
    FATAL: Could not initialize class 
    hudson.util.ProcessTree$UnixReflection
    java.lang.NoClassDefFoundError: Could not initialize class 
    hudson.util.ProcessTree$UnixReflection
    at hudson.util.ProcessTree$UnixProcess.kill(ProcessTree.java:647)
    at hudson.util.ProcessTree$UnixProcess.killRecursively(ProcessTree.java:668)
    at hudson.util.ProcessTree$Unix.killAll(ProcessTree.java:589)
    at hudson.Launcher$LocalLauncher.kill(Launcher.java:949)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:510)
    at hudson.model.Run.execute(Run.java:1724)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:421)
    Finished: FAILURE
    

    first SUCCESS then FAILURE, hmm weeeird

    I remembered that recently I have installed java 9 for experimenting, but still having java 8 set to usl/libexec/java_home, in my .zshrc like:

    export JAVA_HOME=`/usr/libexec/java_home -v 1.8.0_152`
    

    but that did not help at all, so I said goodbye to Java 9 with

    sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk
    

    then went to Manage Jenkins -> Configure System -> Environment variables and added

    /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home
    

    as JAVA_HOME

    after Jenkins restart my builds run like a charm