Access classpath resource from other EAR in the same deployment
wolfgangv_pb Sep 8, 2014 9:00 AMHi,
after hours of reading the documentation I'm still stuck. Here is my problem:
My deployment consists of 2 EAR files:
- connectors-1.0-SNAPSHOT.ear
--- META-INF/jboss-deployment-structure.xml
--- connectors-1.0-SNAPSHOT.jar
----- my/app/spring/applicationContext.xml
--- ...
- server.ear
--- META-INF/jboss-deployment-structure.xml
--- server-impl.jar
--- ...
The Server implementation (server-impl.jar) uses Spring with file based configuration (applicationContext.xml). One of the configuration files is located in the connectors.jar within the connectors.ear.
Following the documentation of modules and dependencies my deployment-structure files now look like this:
connectors-1.0-SNAPSHOT.ear/META-INF/jboss-deployment-structure.xml:
<jboss-deployment-structure>
<module name="deployment.connectors" slot="main">
<resources>
<resource-root path="connectors-1.0-SNAPSHOT.jar"/>
</resources>
</module>
</jboss-deployment-structure>
server.ear/META-INF/jboss-deployment-structure.xml:
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="deployment.connectors"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
When deploying the ear files, there are no error messages about undefined modules, so the dependency from server.ear to "deployment.connectors" appears to be valid.
But: When Spring tries to access an applicationContext located in the connectors-1.0-SNAPSHOT.jar, it fails with
2014-09-08 14:28:47,056 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "server.ear")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.subunit.\"server.ear\".\"server-impl.jar\".component.StartupListener.START" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"server.ear\".\"server.jar\".component.StartupListener.START: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
Caused by: javax.ejb.EJBException: JBAS014580: Unexpected Error
Caused by: java.lang.ExceptionInInitializerError
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SERVER' defined in URL [file:/D:/Programme/Wildfly/configuration/contexts.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [my/app/spring/applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [my/app/spring/applicationContext.xml] cannot be opened because it does not exist
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [my/app/spring/applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [my/app/spring/applicationContext.xml] cannot be opened because it does not exist
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [my/app/spring/applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [my/app/spring/applicationContext.xml] cannot be opened because it does not exist
Caused by: java.io.FileNotFoundException: class path resource [my/app/spring/applicationContext.xml] cannot be opened because it does not exist"}}
Any ideas?
Thank you very much in advance for your help,
Wolfgang