Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-5042

Regression: CloningClassLoader causes StackOverflowError in groovy

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0, 3.0.1, 3.0.2, 3.0.3
    • None
    • Class Loading
    • None

    Description

      I am unable to use a groovy class as a plexus component in maven 3 because groovy's metaclass mechanism calls Introspector.getBeanInfo() in constructors which in turn calls classloader.loadClass(beanClass.getName() + BEANINFO_SUFFIX) (the class name is "FooBar$_plexus2") which in turn causes CloningClassLoader to create a new clone of the class named "FooBar$plexus2BeanInfo". When "FooBar$_plexusBeanInfo" is instantiated groovy's the meta class mechanism again calls
      Introspector.getBeanInfo() on "FooBar$__plexus2".

      Example stack trace:

      at sis.buildtools.SisMapVersionsPhase.$getStaticMetaClass(VersionsMojo.groovy)
              at sis.buildtools.SisMapVersionsPhase.<init>(VersionsMojo.groovy:692)
              at sis.buildtools.SisMapVersionsPhase$__plexus2BeanInfo.<init>(Unknown Source)
              at sun.reflect.GeneratedConstructorAccessor5.newInstance(Unknown Source)
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
              at java.lang.Class.newInstance0(Class.java:355)
              at java.lang.Class.newInstance(Class.java:308)
              at java.beans.Introspector.instantiate(Introspector.java:1449)
              at java.beans.Introspector.findExplicitBeanInfo(Introspector.java:431)
              at java.beans.Introspector.<init>(Introspector.java:380)
              at java.beans.Introspector.getBeanInfo(Introspector.java:167)
              at groovy.lang.MetaClassImpl$15.run(MetaClassImpl.java:2940)
              at java.security.AccessController.doPrivileged(Native Method)
              at groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:2938)
              at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:2921)
              at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:166)
              at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:182)
              at sis.buildtools.SisMapVersionsPhase.$getStaticMetaClass(VersionsMojo.groovy)
              at sis.buildtools.SisMapVersionsPhase.<init>(VersionsMojo.groovy:692)
              at sis.buildtools.SisMapVersionsPhase$__plexus2BeanInfo.<init>(Unknown Source)
              at sun.reflect.GeneratedConstructorAccessor5.newInstance(Unknown Source)
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
              at java.lang.Class.newInstance0(Class.java:355)
              at java.lang.Class.newInstance(Class.java:308)
              at java.beans.Introspector.instantiate(Introspector.java:1449)
              at java.beans.Introspector.findExplicitBeanInfo(Introspector.java:431)
              at java.beans.Introspector.<init>(Introspector.java:380)
              at java.beans.Introspector.getBeanInfo(Introspector.java:167)
              at groovy.lang.MetaClassImpl$15.run(MetaClassImpl.java:2940)
              at java.security.AccessController.doPrivileged(Native Method)
              at groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:2938)
              at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:2921)
              at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:166)
              at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:182)
              at sis.buildtools.SisMapVersionsPhase.$getStaticMetaClass(VersionsMojo.groovy)
              at sis.buildtools.SisMapVersionsPhase.<init>(VersionsMojo.groovy:692)
              at sis.buildtools.SisMapVersionsPhase$__plexus2BeanInfo.<init>(Unknown Source)
              at sun.reflect.GeneratedConstructorAccessor5.newInstance(Unknown Source)
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
              at java.lang.Class.newInstance0(Class.java:355)
              at java.lang.Class.newInstance(Class.java:308)
              at java.beans.Introspector.instantiate(Introspector.java:1449)
              at java.beans.Introspector.findExplicitBeanInfo(Introspector.java:431)
              at java.beans.Introspector.<init>(Introspector.java:380)
              at java.beans.Introspector.getBeanInfo(Introspector.java:167)
              at groovy.lang.MetaClassImpl$15.run(MetaClassImpl.java:2940)
              at java.security.AccessController.doPrivileged(Native Method)
              at groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:2938)
              at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:2921)
              at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:166)
              at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:182)
              at sis.buildtools.SisMapVersionsPhase.$getStaticMetaClass(VersionsMojo.groovy)
              at sis.buildtools.SisMapVersionsPhase.<init>(VersionsMojo.groovy:692)
              at sis.buildtools.SisMapVersionsPhase$__plexus2BeanInfo.<init>(Unknown Source)
              at sun.reflect.GeneratedConstructorAccessor5.newInstance(Unknown Source)

      Attachments

        1. test-plug.zip
          3 kB
          Patrick Staton

        Activity

          People

            Unassigned Unassigned
            statop Patrick Staton
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: