IllegalStateException in EAR Deployment
ftg314159 Jan 11, 2011 12:30 PMI'm running into a strange case. I had an EJB app which I built under Ant; the EAR deploys just fine in both 5.1.GA and 6.0.Final. I switched to building with the maven-ear-plugin, and although the EAR structure looks virtually identical, I now get a ClassNotFoundException trying to deploy.
In the old case, the EAR looks like this:
(ejb-app).jar
derby-ds.xml
META-INF
application.xml (contains single <module><ejb></ejb></module> for (ejb-app).jar)
jboss-app.xml (contains single <module><service></service></module> for derby-ds.xml
MANIFEST.MF (default)
lib
util1.jar
util2.jar
In the new case, the EAR looks like this:
(ejb-app).jar
util1.jar
util2.jar
derby-ds.xml
META-INF
application.xml (contains single <module><ejb></ejb></module> for (ejb-app).jar)
jboss-app.xml (contains single <module><service></service></module> for derby-ds.xml
MANIFEST.MF (default)
and the deployment fails with a ClassNotFoundException for a class in util1.jar:
Deployment "vfs:///data/jboss/jboss-6.0.0.Final/server/default/deploy/dvd-ear-1.0-SNAPSHOT.ear" is in error due to the following reason(s): java.lang.ClassNotFoundException: org.profsoftsvcs.log.LogLogEntry from BaseClassLoader@136a2062{vfs:///data/jboss/jboss-6.0.0.Final/server/default/deploy/dvd-ear-1.0-SNAPSHOT.ear}
I tried several manual experiments:
1) Move util1.jar and util2.jar to a /lib directory
Result: JBoss complains that there is no module definition for lib/util1.jar and lib/util2.jar:
Deployment "vfs:///data/jboss/jboss-6.0.0.Final/server/default/deploy/dvd-ear-1.0-SNAPSHOT.ear" is in error due to the following reason(s): org.jboss.deployers.spi.DeploymentException: No module with relative path lib/ejb-ejb-1.0-SNAPSHOT.jar found in set of modules for vfs:///data/jboss/jboss-6.0.0.Final/server/default/deploy/dvd-ear-1.0-SNAPSHOT.ear [dvd-ejb-1.0-SNAPSHOT.jar, derby-ds.xml]
2) Add <module><java></java></module> entries to application.xml for uti1.jar and util2.jar
Result: JBoss complains that a Context already exists. Google found this error, but only as a cleanup issue when a prior error is encountered;
however, here there is no prior error, just the "Context already exists":
Caused by: java.lang.IllegalStateException: Context already exists with path 'dvd-ejb-1.0-SNAPSHOT.jar' contexts=[ContextInfoImpl{path= metaData=[META-INF - DEFAULT] classPath=[ClassPathEntryImpl{path=common-java-1.0-SNAPSHOT.jar}, ClassPathEntryImpl{path=dvd-ejb-1.0-SNAPSHOT.jar}, ClassPathEntryImpl{path=ejb-ejb-1.0-SNAPSHOT.jar}, ClassPathEntryImpl{path=}] comparator=org.jboss.system.deployers.LegacyDeploymentContextComparator}, ContextInfoImpl{path=dvd-ejb-1.0-SNAPSHOT.jar metaData=[META-INF - DEFAULT] classPath=[ClassPathEntryImpl{path=dvd-ejb-1.0-SNAPSHOT.jar}]}, ContextInfoImpl{path=ejb-ejb-1.0-SNAPSHOT.jar metaData=[META-INF - DEFAULT] classPath=[ClassPathEntryImpl{path=ejb-ejb-1.0-SNAPSHOT.jar}]}, ContextInfoImpl{path=derby-ds.xml metaData=[] classPath=null}]
3) Add <library-directory>/</library-directory> to jboss-app.xml
Result: same as in (2)
I'd love to turn on debug-level logging, but 6.0.0 doesn't appear to have a log4j config file any more.
What I'm trying to do is create an EAR which is as self-contained as possible, i.e. contains its own DataSource definitions, private versions of its utility JARs, etc. I could probably get this to work by copying the utilX JARs to /lib or /common/lib or ...server/XXX/lib, but that would defeat the purpose. The goal is to have the user drop the EAR into the deploy directory - period.
Any idea what there is about the new EAR that causes the problem ?