ClassNotFoundException for annotations defined in JAR files an used in EJB's
deployed within an EAR
---------------------------------------------------------------------------------------------------
Key: GERONIMO-4618
URL: https://issues.apache.org/jira/browse/GERONIMO-4618
Project: Geronimo
Issue Type: Bug
Security Level: public (Regular issues)
Components: deployment
Affects Versions: 2.1.4
Environment: Linux 2.6.24 x86_64
Reporter: Frank Meilinger
Priority: Critical
We have an EAR fle with an EJB jar and a utils jar file. This Utils jar file
contains an annotation, which is used at the EJB Interface. The directory
layout of the EAR file is defined in the following way:
EAR/
|--- ejbs.jar
|---lib/
| ---utils.jar
(the problem is the same, if we copy the utils.jar in the root directory of the
EAR file).
When we deploy the EAR file we got the following error:
009-04-09 14:30:51,813 ERROR [Deployer] Deployment failed due to
java.lang.NoClassDefFoundError: a/b/c/OurAnnotation
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.xbean.finder.ClassFinder.<init>(ClassFinder.java:164)
at
org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.createInheritedClassFinder(AnnotationDeployer.java:1260)
at
org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:900)
at
org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:489)
at
org.apache.openejb.config.AnnotationDeployer.deploy(AnnotationDeployer.java:169)
at
org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:152)
at
org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:456)
at
org.apache.geronimo.openejb.deployment.EjbModuleBuilder.configureApplication(EjbModuleBuilder.java:641)
at
org.apache.geronimo.openejb.deployment.EjbModuleBuilder.getEjbJarInfo(EjbModuleBuilder.java:578)
at
org.apache.geronimo.openejb.deployment.EjbModuleBuilder.initContext(EjbModuleBuilder.java:500)
at
org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:595)
at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:255)
at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:134)
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.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
at
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:867)
at
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
at
org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand.doDeploy(AbstractDeployCommand.java:116)
at
org.apache.geronimo.deployment.plugin.local.DistributeCommand.run(DistributeCommand.java:61)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: a.b.c.OurAnnotation
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:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at
org.apache.geronimo.kernel.classloader.TemporaryClassLoader.loadClass(TemporaryClassLoader.java:104)
at
org.apache.geronimo.kernel.classloader.TemporaryClassLoader.loadClass(TemporaryClassLoader.java:62)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 27 more
The Annotation in this sample has the name "a.b.c.OurAnnotation".
The problem only disappear, when we copy the "utils.jar" (which contains our
annotation) file in the geronimo's "lib/endorsed" directory and restart
geronimo- (this is no solution but it makes the problem more clear). So it
seems that the geronimo's classloader which is active at deploy time does not
find classes which are included in the EAR file itself and needed at deploy
time.
The same EAR file can be deployed on GlassFish without problems.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.