[ 
https://issues.apache.org/jira/browse/GERONIMO-5946?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13028939#comment-13028939
 ] 

Jarek Gawor commented on GERONIMO-5946:
---------------------------------------

Committed a fix for this issue to xbean-reflect library in revision 1099531.

The ReflectionUtils code was loading the XbeanAsmParameterNameLoader and 
AsmParameterNameLoader classes in an indirect attempt to see if the dependent 
libraries (xbean-asm or asm) where actually available in the classloader. With 
Java's lazy class loading it, just loading XbeanAsmParameterNameLoader or 
AsmParameterNameLoader did not guarantee that the dependent library was also 
present. So the code was modified to actually check if a specific class in a 
given asm library can be loaded and to pick the right ParameterNameLoader based 
on that. 


> error when starting server with -noverify option
> ------------------------------------------------
>
>                 Key: GERONIMO-5946
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5946
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>    Affects Versions: 3.0
>            Reporter: Kevan Miller
>            Assignee: Jarek Gawor
>             Fix For: 3.0
>
>
> If you set the "-noverify" java option will result in the following exception 
> and server startup fails:
> {code}
> java.lang.NoClassDefFoundError: org/apache/xbean/asm/ClassReader
>         at 
> org.apache.xbean.recipe.XbeanAsmParameterNameLoader.createClassReader(XbeanAsmParameterNameLoader.java:201)
>         at 
> org.apache.xbean.recipe.XbeanAsmParameterNameLoader.getAllConstructorParameters(XbeanAsmParameterNameLoader.java:111)
>         at 
> org.apache.xbean.recipe.XbeanAsmParameterNameLoader.get(XbeanAsmParameterNameLoader.java:82)
>         at 
> org.apache.xbean.recipe.ReflectionUtil.getParameterNames(ReflectionUtil.java:906)
>         at 
> org.apache.xbean.recipe.ReflectionUtil.findConstructor(ReflectionUtil.java:636)
>         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.geronimo.tomcat.model.ExecutorType.getExecutor(ExecutorType.java:127)
>         at 
> org.apache.geronimo.tomcat.model.ServiceType.getService(ServiceType.java:281)
>         at 
> org.apache.geronimo.tomcat.model.ServerType.build(ServerType.java:300)
>         at 
> org.apache.geronimo.tomcat.TomcatServerGBean.<init>(TomcatServerGBean.java:141)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
> Method)
>         at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>         at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>         at 
> org.apache.xbean.recipe.ReflectionUtil$ConstructorFactory.create(ReflectionUtil.java:952)
>         at 
> org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:276)
>         at 
> org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
>         at 
> org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
>         at 
> org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:933)
>         at 
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:271)
>         at 
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:105)
>         at 
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:127)
>         at 
> org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance.java:560)
>         at 
> org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:386)
>         at 
> org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:460)
>         at 
> org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:226)
>         at 
> org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:702)
>         at 
> org.apache.geronimo.system.main.EmbeddedDaemon.doStartup(EmbeddedDaemon.java:211)
>         at 
> org.apache.geronimo.system.main.EmbeddedDaemon.execute(EmbeddedDaemon.java:91)
>         at 
> org.apache.geronimo.system.osgi.BootActivator$1.execute(BootActivator.java:107)
>         at org.apache.geronimo.main.Bootstrapper.execute(Bootstrapper.java:65)
>         at 
> org.apache.geronimo.cli.AbstractCLI.executeMain(AbstractCLI.java:65)
>         at org.apache.geronimo.cli.daemon.DaemonCLI.main(DaemonCLI.java:32)
> Caused by: java.lang.ClassNotFoundException: org.apache.xbean.asm.ClassReader
>         at 
> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
>         at 
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
>         at 
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
>         at 
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>         ... 36 more
> {code}
> Problem is that -noverify is turning off early detection of classloading 
> issues in the following org.apache.xbean.recipe.ReflectionUtil code:
> {code}
>  static
>   {
>     String[] impls = { "org.apache.xbean.recipe.XbeanAsmParameterNameLoader", 
> "org.apache.xbean.recipe.AsmParameterNameLoader" };
>     for (String impl : impls)
>       try {
>         Class loaderClass = 
> ReflectionUtil.class.getClassLoader().loadClass(impl).asSubclass(ParameterNameLoader.class);
>         parameterNamesLoader = (ParameterNameLoader)loaderClass.newInstance();
>         break;
>       }
>       catch (Throwable ignored)
>       {
>       }
>   }
> {code}
> With --noverify, the load of 
> "org.apache.xbean.recipe.XbeanAsmParameterNameLoader" will succeed, but fail 
> later. Without --noverify (i.e. -verify), the load of 
> "org.apache.xbean.recipe.XbeanAsmParameterNameLoader" fails in the above load.
>  

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to