NoClassDefFoundError: java/util/HashMap$Entry with Java 8

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

NoClassDefFoundError: java/util/HashMap$Entry with Java 8

Paolo Di Tommaso
Is a Groovy 2.3.x app compiled with Java 7 supposed to run on Java 8? 

When I compile with Java 7 and run it with Java 8 I'm getting the following exception. 


ERROR nextflow.script.CliRunner - java.lang.NoClassDefFoundError: java/util/HashMap$Entry -- See the file '.nextflow.log' for more error details
java.lang.NoClassDefFoundError: java/util/HashMap$Entry
at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_05]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2688) ~[na:1.8.0_05]
at java.lang.Class.getDeclaredMethods(Class.java:1962) ~[na:1.8.0_05]
at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:84) ~[groovy-2.3.0.jar:2.3.0]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_05]
at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:81) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250) ~[groovy-2.3.0.jar:2.3.0]
at groovy.lang.MetaClassImpl.populateMethods(MetaClassImpl.java:342) ~[groovy-2.3.0.jar:2.3.0]
at groovy.lang.MetaClassImpl.fillMethodIndex(MetaClassImpl.java:292) ~[groovy-2.3.0.jar:2.3.0]
at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3045) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:210) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:241) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:255) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:859) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:84) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186) ~[groovy-2.3.0.jar:2.3.0]
at nextflow.script.CliBinding.<init>(CliBinding.groovy:49) ~[main/:na]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_05]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_05]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_05]
at java.lang.reflect.Constructor.newInstance(Constructor.java:408) ~[na:1.8.0_05]
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190) ~[groovy-2.3.0.jar:2.3.0]
at nextflow.script.CliRunner.<init>(CliRunner.groovy:111) ~[main/:na]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_05]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_05]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_05]
at java.lang.reflect.Constructor.newInstance(Constructor.java:408) ~[na:1.8.0_05]
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190) ~[groovy-2.3.0.jar:2.3.0]
at nextflow.script.CliRunner.main(CliRunner.groovy:512) ~[main/:na]
Caused by: java.lang.ClassNotFoundException: java.util.HashMap$Entry
at java.net.URLClassLoader$1.run(URLClassLoader.java:372) ~[na:1.8.0_05]
at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[na:1.8.0_05]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_05]
at java.net.URLClassLoader.findClass(URLClassLoader.java:360) ~[na:1.8.0_05]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_05]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) ~[na:1.8.0_05]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_05]
... 42 common frames omitted



Any idea what is wrong?


Cheers,
Paolo

Reply | Threaded
Open this post in threaded view
|

Re: NoClassDefFoundError: java/util/HashMap$Entry with Java 8

Cédric Champeau
This is a very deep exception, happening during the initialization of a metaclass. What it says is that a class is referenced (Entry) but not found on classpath. Indeed, HashMap.Entry doesn't seem to be an inner class of Java 8 anymore. So one guess would be that a class used by CliRunner explicitly references HashMap.Entry, either as a field or in a method (return type or parameter).

Le 18/06/2014 10:58, Paolo Di Tommaso a écrit :
Is a Groovy 2.3.x app compiled with Java 7 supposed to run on Java 8? 

When I compile with Java 7 and run it with Java 8 I'm getting the following exception. 


ERROR nextflow.script.CliRunner - java.lang.NoClassDefFoundError: java/util/HashMap$Entry -- See the file '.nextflow.log' for more error details
java.lang.NoClassDefFoundError: java/util/HashMap$Entry
at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_05]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2688) ~[na:1.8.0_05]
at java.lang.Class.getDeclaredMethods(Class.java:1962) ~[na:1.8.0_05]
at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:84) ~[groovy-2.3.0.jar:2.3.0]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_05]
at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:81) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250) ~[groovy-2.3.0.jar:2.3.0]
at groovy.lang.MetaClassImpl.populateMethods(MetaClassImpl.java:342) ~[groovy-2.3.0.jar:2.3.0]
at groovy.lang.MetaClassImpl.fillMethodIndex(MetaClassImpl.java:292) ~[groovy-2.3.0.jar:2.3.0]
at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3045) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:210) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:241) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:255) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:859) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:84) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186) ~[groovy-2.3.0.jar:2.3.0]
at nextflow.script.CliBinding.<init>(CliBinding.groovy:49) ~[main/:na]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_05]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_05]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_05]
at java.lang.reflect.Constructor.newInstance(Constructor.java:408) ~[na:1.8.0_05]
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190) ~[groovy-2.3.0.jar:2.3.0]
at nextflow.script.CliRunner.<init>(CliRunner.groovy:111) ~[main/:na]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_05]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_05]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_05]
at java.lang.reflect.Constructor.newInstance(Constructor.java:408) ~[na:1.8.0_05]
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190) ~[groovy-2.3.0.jar:2.3.0]
at nextflow.script.CliRunner.main(CliRunner.groovy:512) ~[main/:na]
Caused by: java.lang.ClassNotFoundException: java.util.HashMap$Entry
at java.net.URLClassLoader$1.run(URLClassLoader.java:372) ~[na:1.8.0_05]
at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[na:1.8.0_05]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_05]
at java.net.URLClassLoader.findClass(URLClassLoader.java:360) ~[na:1.8.0_05]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_05]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) ~[na:1.8.0_05]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_05]
... 42 common frames omitted



Any idea what is wrong?


Cheers,
Paolo



-- 
Cédric Champeau
SpringSource - Pivotal
http://twitter.com/CedricChampeau
http://melix.github.io/blog
http://spring.io/ http://www.gopivotal.com/
Reply | Threaded
Open this post in threaded view
|

Re: NoClassDefFoundError: java/util/HashMap$Entry with Java 8

Paolo Di Tommaso
Wow. This was pretty ugly. 

There problem was that I had a couple of classes extending a HashMap, which declare a private HashMap.Entry field. internally that was raising that issue. 

I fixed using a Delegate pattern instead. 


Thanks Cedric,

Paolo

 


On Wed, Jun 18, 2014 at 2:17 PM, Cédric Champeau <[hidden email]> wrote:
This is a very deep exception, happening during the initialization of a metaclass. What it says is that a class is referenced (Entry) but not found on classpath. Indeed, HashMap.Entry doesn't seem to be an inner class of Java 8 anymore. So one guess would be that a class used by CliRunner explicitly references HashMap.Entry, either as a field or in a method (return type or parameter).

Le 18/06/2014 10:58, Paolo Di Tommaso a écrit :
Is a Groovy 2.3.x app compiled with Java 7 supposed to run on Java 8? 

When I compile with Java 7 and run it with Java 8 I'm getting the following exception. 


ERROR nextflow.script.CliRunner - java.lang.NoClassDefFoundError: java/util/HashMap$Entry -- See the file '.nextflow.log' for more error details
java.lang.NoClassDefFoundError: java/util/HashMap$Entry
at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_05]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2688) ~[na:1.8.0_05]
at java.lang.Class.getDeclaredMethods(Class.java:1962) ~[na:1.8.0_05]
at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:84) ~[groovy-2.3.0.jar:2.3.0]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_05]
at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:81) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250) ~[groovy-2.3.0.jar:2.3.0]
at groovy.lang.MetaClassImpl.populateMethods(MetaClassImpl.java:342) ~[groovy-2.3.0.jar:2.3.0]
at groovy.lang.MetaClassImpl.fillMethodIndex(MetaClassImpl.java:292) ~[groovy-2.3.0.jar:2.3.0]
at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3045) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:210) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:241) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:255) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:859) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:84) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186) ~[groovy-2.3.0.jar:2.3.0]
at nextflow.script.CliBinding.<init>(CliBinding.groovy:49) ~[main/:na]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_05]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_05]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_05]
at java.lang.reflect.Constructor.newInstance(Constructor.java:408) ~[na:1.8.0_05]
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190) ~[groovy-2.3.0.jar:2.3.0]
at nextflow.script.CliRunner.<init>(CliRunner.groovy:111) ~[main/:na]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_05]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_05]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_05]
at java.lang.reflect.Constructor.newInstance(Constructor.java:408) ~[na:1.8.0_05]
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) ~[groovy-2.3.0.jar:2.3.0]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190) ~[groovy-2.3.0.jar:2.3.0]
at nextflow.script.CliRunner.main(CliRunner.groovy:512) ~[main/:na]
Caused by: java.lang.ClassNotFoundException: java.util.HashMap$Entry
at java.net.URLClassLoader$1.run(URLClassLoader.java:372) ~[na:1.8.0_05]
at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[na:1.8.0_05]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_05]
at java.net.URLClassLoader.findClass(URLClassLoader.java:360) ~[na:1.8.0_05]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_05]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) ~[na:1.8.0_05]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_05]
... 42 common frames omitted



Any idea what is wrong?


Cheers,
Paolo



-- 
Cédric Champeau
SpringSource - Pivotal
http://twitter.com/CedricChampeau
http://melix.github.io/blog
http://spring.io/ http://www.gopivotal.com/