GitHub user ebourg opened a pull request:
https://github.com/apache/geronimo-xbean/pull/12
EmptyVisitor used in AsmParameterNameLoader may cause a
ClassNotFoundException
Hi,
We've been hit by an exception when building wagon in Debian with xbean
4.3. The unit tests for wagon-file failed with this exception:
java.lang.ClassNotFoundException:
org.apache.xbean.asm5.original.commons.EmptyVisitor
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at
org.apache.xbean.recipe.ReflectionUtil.<clinit>(ReflectionUtil.java:47)
at
org.apache.xbean.recipe.ObjectRecipe.findFactory(ObjectRecipe.java:563)
at
org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:274)
at
org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
at
org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
at
org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:49)
at
org.codehaus.plexus.component.builder.XBeanComponentBuilder.createComponentInstance(XBeanComponentBuilder.java:158)
at
org.codehaus.plexus.component.builder.XBeanComponentBuilder.build(XBeanComponentBuilder.java:123)
at
org.codehaus.plexus.component.manager.AbstractComponentManager.createComponentInstance(AbstractComponentManager.java:181)
at
org.codehaus.plexus.component.manager.PerLookupComponentManager.getComponent(PerLookupComponentManager.java:51)
at
org.codehaus.plexus.DefaultComponentRegistry.getComponent(DefaultComponentRegistry.java:327)
at
org.codehaus.plexus.DefaultComponentRegistry.lookup(DefaultComponentRegistry.java:163)
at
org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:373)
at
org.codehaus.plexus.PlexusTestCase.lookup(PlexusTestCase.java:204)
at
org.apache.maven.wagon.WagonTestCase.getWagon(WagonTestCase.java:209)
at
org.apache.maven.wagon.StreamingWagonTestCase.testFailedGetToStream(StreamingWagonTestCase.java:64)
We can see that the static initializer in `ReflectionUtil` instantiates
`AsmParameterNameLoader` at line 47. This statement is reached after checking
at line 44 that `org.apache.xbean.asm5.ClassReader` is not available (as well
as all the classes from xbean-asm5-shaded if I'm not mistaken). But
`AsmParameterNameLoader` uses the `EmptyVisitor` from xbean-asm5-shaded for its
`AllParameterNamesDiscoveringVisitor`, and this triggers the
`ClassNotFoundException` because the class is not available.
I replaced the `EmptyVisitor` with the `ClassVisitor` from ASM in
`AsmParameterNameLoader` and it seems to work.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ebourg/geronimo-xbean trunk
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/geronimo-xbean/pull/12.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #12
----
commit 363c46c8928444fc40079fbe1fb78c5d95500566
Author: Emmanuel Bourg <[email protected]>
Date: 2015-08-07T00:07:35Z
Replaced EmptyVisitor in AsmParameterNameLoader with ClassVisitor
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---