Shared Services

Latest response

I have a need to create a shared audit service that will be available to all applications running on the server. It seems the correct way to do this would be to create a statemless session bean, install it as a module, and make it global in the config file.

The creation of the stateless EJB works great. When I deploy it through the deployment directory (by dropping the .jar file there), it registers fine and works great.

When I then configure it to be a module in the static modules directory structure, it fails to load the bean.

What I did was create a module.xml file, point it at the jar, set up the dependencies, and set a global module in urn:jboss:domain:ee:1.1.

The jar IS available globally, as I can reference the classes in the jar from other applications deployed in the deployment directory. It just won't load the stateless bean. This is the same jar that works fine from the deployment directory.

I have searched for any documentation on how to make this work and cannot find any. Does anyone have a clue how to get this to load? Am I missing some kind of module initialization method or something? There is no error generated. The log looks fine. But the bean is never loaded to JNDI and does not become available for injection into other applications. I can make it work fine by using the JBoss-Structure xml and referencing a dynamic module.


<module xmlns="urn:jboss:module:1.1" name="com.wellsfargo.wbr.investments.auditservice"> <resources> <resource-root path="AuditService-0.0.1.jar"/> </resources> <dependencies> <!-- These come from org.jboss.as.messaging.--> <module name="javax.api"/> <module name="javax.jms.api"/> <module name="javax.transaction.api"/> <module name="org.hornetq"/> <module name="org.hornetq.ra"/> <module name="org.jboss.common-beans"/> <module name="org.jboss.as.transactions"/> <module name="org.jboss.netty"/> <module name="org.jboss.staxmapper"/> <module name="org.jboss.as.controller"/> <module name="org.jboss.as.ee"/> <module name="org.jboss.as.naming"/> <module name="org.jboss.as.network"/> <module name="org.jboss.as.server"/> <module name="org.jboss.modules"/> <module name="org.jboss.msc"/> <module name="org.jboss.logging"/> <module name="org.jboss.ironjacamar.impl"/> <module name="org.jboss.ironjacamar.api"/> <module name="org.jboss.as.connector" /> <module name="org.jboss.as.security"/> <module name="org.jboss.vfs"/> <module name="org.jboss.metadata"/> <module name="org.picketbox"/> <module name="org.jboss.jboss-transaction-spi"/> <module name="org.jboss.remote-naming"/> <module name="org.jboss.threads"/> <!-- JGroups is required only as an option to cluster HornetQ nodes --> <module name="org.jboss.as.clustering.jgroups" optional="true"/> <module name="org.jgroups" optional="true"/> <!-- For EJB integration --> <module name="org.jboss.as.ejb3" optional="true"/> <module name="javax.ejb.api"/> <module name="javax.persistence.api"/> <module name="javax.interceptor.api"/> <!-- org.jboss.util.deadlock.ApplicationDeadlockException --> <module name="org.jboss.common-core"/> <module name="org.jboss.marshalling"/> <module name="org.jboss.marshalling.river"/> </dependencies> </module> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ <subsystem xmlns="urn:jboss:domain:ee:1.1"> <global-modules> <module name="sun.jdk" slot="main"/> <module name="com.wellsfargo.wbr.investments.auditservice" slot="main"/> </global-modules> <spec-descriptor-property-replacement>false</spec-descriptor-property-replacement> <jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement> </subsystem>

Responses

Chris, I've edited your original post to include the markup necessary to display your code. When inserting a code block, put "~~~" above and below it, so that it shows up

like this

Chris,

Thanks for raising this issue. I am the JBoss Enterprise Application PLatform documentation team's leader and I will see if I can help find an answer for you.

Chris,

All deployments are modules, but not all modules are deployments. As you have found, an ejb.jar registered as a static module is available as a module but it is not deployed.

The correct method is as you mentioned, "I can make it work fine by using the JBoss-Structure xml and referencing a dynamic module", so specify a dependency in each deployment on your shared services deployment.

Thanks. I was afraid of that. I appreciate the answer.