Spring class in jboss module cannot see class from EJB
tony_green Aug 16, 2013 9:59 AMI have a custom jboss module that contains spring 3 JARS. The module.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.example.spring3" slot="main">
<resources>
<resource-root path="jackson-core-2.1.2.jar"/>
<resource-root path="jackson-databind-2.1.2.jar"/>
<resource-root path="aopalliance-1.0.jar"/>
<resource-root path="asm-3.1.jar"/>
<resource-root path="aspectjrt-1.6.0.jar"/>
<resource-root path="aspectjweaver-1.6.0.jar"/>
<resource-root path="cglib-2.2.jar"/>
<resource-root path="spring-aop-3.2.3.RELEASE.jar"/>
<resource-root path="spring-beans-3.2.3.RELEASE.jar"/>
<resource-root path="spring-context-3.2.3.RELEASE.jar"/>
<resource-root path="spring-context-support-3.2.3.RELEASE.jar"/>
<resource-root path="spring-core-3.2.3.RELEASE.jar"/>
<resource-root path="spring-expression-3.2.3.RELEASE.jar"/>
<resource-root path="spring-web-3.2.3.RELEASE.jar"/>
<resource-root path="spring-webmvc-3.2.3.RELEASE.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.servlet.api"/>
<module name="javax.jms.api"/>
<module name="javax.annotation.api"/>
<module name="org.apache.commons.logging"/>
</dependencies>
</module>
I have an EAR that contains an EJB. This EJB contains a Singleton called com.example.MyBean. The EJB layout is:
myear.ear
myejb.jar
I have a WAR deployment that contains an application context xml file. It does a JNDI lookup on the Singleton and injects it into a Spring MVC Controller. The jboss-deployment-structure.xml for this WAR looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="deployment.myear.ear.myejb.jar"/>
<module name="com.example.spring3">
<imports>
<include path="META-INF/*.xml"/>
</imports>
</module>
</dependencies>
</deployment>
</jboss-deployment-structure>
When I deploy my WAR, I get this exception:
Caused by: java.lang.ClassNotFoundException: com.example.MyBean from [Module "com.example.spring3:main" from local module loader @7e94fde1 (roots: /home/gary/jboss-as-7.1.1.Final/modules)]n
It looks like my custom jboss module can't see the classes from my EJB. If I comment out the reference to my com.example.spring3 module and include all the JARs in this module in my WAR, everything works fine. Is there a way of specifying in jboss-deployment-structure.xml that I want the JBoss module to see the classes from the EJB JAR? I've tried setting export="true" but I still get the same error.