We are using Hudson to continuously build few projects, which executes sql files in database using a groovy script (Execute Groovy system script) as a post build action. The script (which uses enum) works fine most of the time, but throws following error on random basis:
FATAL: java/lang$Enum
java.lang.NoClassDefFoundError: java/lang$Enum
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethods(Unknown Source)
at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:84)
at java.security.AccessController.doPrivileged(Native Method)
at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:81)
at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250)
at groovy.lang.MetaClassImpl.populateMethods(MetaClassImpl.java:334)
at groovy.lang.MetaClassImpl.fillMethodIndex(MetaClassImpl.java:284)
at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:2904)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:166)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:182)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:227)
at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:751)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallStaticSite(CallSiteArray.java:59)
...
...
All subsequent build fails with same error once we get this error. We fixed this once by defining JAVA_HOME environment variable (which got erased somehow). It worked for few days only to re-appear again. This time, we defined JAVA_HOME in Hudson configuration and it worked temporarily as the issue re-appeared after few days. We haven't set Groovy path in hudson configuration as we haven't installed groovy separately. Version details are:
- Hudson = 3.3.3
- Hudson Subversion Plug-in = 2.3.11
- Hudson Groovy builder = 1.13-h-3
- Groovy Support Plugin = 3.0.3
- Windows = 2012
- JRE = 1.8.0_111
What other options can we try to resolve the issue?
PS: We have tried Jenkins, but fall back to Hudson due to one issue/feature in Subversion plugin in Jenkins, which checkout the repository when workspace is locked, which we cannot afford.