Currency Type would only be found in the TempClassLoader's classpath right?
And getClass().getClassLoader() being the system classloader, would not be
able to find the EJB app classes.
Also I guess the problem would be existing even for user-defined annotations
in the bean code. Is my understanding right?



On Thu, May 28, 2009 at 2:09 PM, Jean-Sébastien Scrève <
[email protected]> wrote:

>
> Ok I looked at these issues. Seems to be tricky...
>
> Here is the stack trace I get :
>
> java.lang.reflect.InvocationTargetException
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
>        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
> Caused by: java.lang.NoClassDefFoundError:
> net/atos/xastory/csm/core/product/Currency
>         at java.lang.Class.getDeclaredMethods0(Native Method)
>        at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
>        at java.lang.Class.getDeclaredMethods(Class.java:1791)
>        at
> org.apache.openejb.finder.ClassFinder.<init>(ClassFinder.java:164)
>        at
> org.apache.openejb.finder.ClassFinder.<init>(ClassFinder.java:146)
>        at
>
> org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:786)
>        at
>
> org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:549)
>        at
>
> org.apache.openejb.config.AnnotationDeployer.deploy(AnnotationDeployer.java:184)
>        at
>
> org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:243)
>        at
>
> org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:597)
>        at
>
> org.apache.openejb.tomcat.catalina.TomcatWebAppBuilder.start(TomcatWebAppBuilder.java:245)
>        at
>
> org.apache.openejb.tomcat.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:58)
>        at
>
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
>        at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4148)
>        at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
>        at
> org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
>        at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
>        at
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
>        at
> org.apache.catalina.core.StandardService.start(StandardService.java:448)
>        at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
>        at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
>        ... 6 more
> Caused by: java.lang.ClassNotFoundException:
> net.atos.xastory.csm.core.product.Currency
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>        at java.lang.Class.forName0(Native Method)
>        at java.lang.Class.forName(Class.java:247)
>        at
> org.apache.openejb.core.TempClassLoader.loadClass(TempClassLoader.java:102)
>        at
> org.apache.openejb.core.TempClassLoader.loadClass(TempClassLoader.java:50)
>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>        ... 27 more
>
>
> Tomcat StandardClassLoader does not find the Currency type.
>
> To be honest, I'm a bit lost with classloaders. TempClassLoader is in
> charge
> of loading sessions beans and entities while Tomcat class loader loads all
> what is in openejb/lib ? Is that correct ?
> Still investigating...
>
> Regards,
>
> Jean-Sébastien Scrève.
>
>
> David Blevins wrote:
> >
> > Also looking at this info:
> > https://issues.apache.org/jira/browse/OPENJPA-646
> >
> > Jean-Sébastien, if you have a stacktrace of the ClassNotFoundException
> > that'd be great.
> >
> >
> > -David
> >
> >
> > On May 27, 2009, at 4:58 PM, David Blevins wrote:
> >
> >> Moving this to the dev list.
> >>
> >> Still looking over the info but the svn revision for the isEnum
> >> method pulls up this info:
> >>
> >> http://svn.apache.org/viewvc?view=rev&revision=720223
> >> http://issues.apache.org/jira/browse/OPENEJB-951
> >>
> >> -David
> >>
> >>
> >> On May 27, 2009, at 9:56 AM, Jean-Sébastien Scrève wrote:
> >>
> >>>
> >>> Hi,
> >>>
> >>> I have a pretty annoying problem with Enum types.
> >>>
> >>> I have the following session bean implementation :
> >>>
> >>> @WebService
> >>> @Stateless (name =
> >>> "net.atos.xastory.csm.contract.CatalogueStockManagementService")
> >>> @Local (CatalogueStockManagementService.class)
> >>> public class CatalogueStockManagementServiceImpl implements
> >>> net.atos.xastory.csm.contract.CatalogueStockManagementService {
> >>>
> >>>     public Price getPrice() {
> >>>             return new Price();
> >>>     }
> >>>
> >>>     private Currency getCurrency() {
> >>>             return net.atos.xastory.csm.core.product.Currency.EUR;
> >>>     }
> >>> }
> >>>
> >>> Price is a POJO. Currency is an Enum type.
> >>> I have a Class Not Found exception on the Currency type at OpenEJB
> >>> startup.
> >>> (OpenEJB + Tomcat).
> >>>
> >>> I dug into the problem and I think I found the problem.
> >>>
> >>> In TempClassLoader I see the following change :
> >>>
> >>> // Annotation classes must be loaded by the normal classloader
> >>> // So must Enum classes to prevent problems with the sun jdk.
> >>> if (isAnnotationClass(bytes) || isEnum(bytes)) {
> >>>           return Class.forName(name, resolve,
> >>> getClass().getClassLoader());
> >>> }
> >>>
> >>> isEnum was added recently and causes my problem. Was is the problem
> >>> we want
> >>> to avoid with Jdk ?
> >>> Shouldn't we try loading from TempClassLoader first then do a
> >>> Class.forName() ?
> >>>
> >>> I can fill up a JIRA if want to.
> >>>
> >>> Regards,
> >>>
> >>> Jean-Sébastien Scrève.
> >>>
> >>>
> >>> --
> >>> View this message in context:
> >>>
> http://www.nabble.com/Enum-class-loading-in-a-session-bean-tp23746554p23746554.html
> >>> Sent from the OpenEJB User mailing list archive at Nabble.com.
> >>>
> >>>
> >>
> >>
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Re%3A-Enum-class-loading-in-a-session-bean-tp23752987p23757608.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>
>

Reply via email to