what is the value of gbeanClassLoader and the thread context classloader ?
I got a classloader issue in the past, the jvm uses the context loader to load referenced classes in the target class, while in common mind, the classloader of the target classloader should be used to load those referenced classes.

2011/10/18 David Jencks <david_jencks@yahoo.com>
I'm seeing this when trying to start a gbean in my osgi friendly code:

java.lang.NoClassDefFoundError: Could not initialize class org.apache.geronimo.tomcat.TomcatServerGBean
       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:958)
       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:975)
       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:586)
       at org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:447)
       at org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:499)
       at org.apache.geronimo.kernel.config.ConfigurationExtender$StartConfiguration.run(ConfigurationExtender.java:472)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
       at java.lang.Thread.run(Thread.java:680)

Note that the starting point is the missing class.  In the debugger I can reproduce the problem with this:

Constructor c = gbeanClassLoader.loadClass(objectRecipe.getType().getName()).getConstructors()[0];
c.newInstance(null);

and the constructor seems to have all the parameter types and parameter annotations available.

This is using equinox 3.7.1.R37x_v20110808_1106

Does anyone have any ideas how to investigate what is wrong?

thanks
david jencks




--
Ivan