0 Replies Latest reply on Jun 5, 2012 3:31 AM by Xavier Courangon

    Calling an EJB from a subsystem module

    Xavier Courangon Newbie

      Hi All,


      I try to use the JBoss AS deployment facility as my application configuration CRUD feature.


      Here is the idea :

      My application as some configuration objects in database. I need a CRUD user interface. This could be a GUI or a remote api (RMI, Webservice), ...

      But one of my user doesn't want to use these. He would like to paste his configurations as files within a file directory to "deploy it".

      OK I could code a Timer that track this directory but I think about another implementation.


      Why not using the AS deployment facility ?

      A could code a subsystem (as explained in the Extending JBoss AS 7 documention) with a DeploymentUnitProcessor class that implements the deploy/undeploy methods to call the CRUD application API.

      Also "deployed" configurations could be managed in the administration console (or with the CLI).


      My first question is : is it a really a good idea ?

      Now (because I didn't wait for the response ;-) I have this issue :

      My EAR application is deployed and publishes a CRUD Remote Session to managed configurations.


      From an external client (standalone client within Eclipse) all is well : I can remotly call the EJB.

      But from the subsystem I catch ClassNotFoundException : the Remote interface is not found by the org.jboss.modules.ModuleClassLoader when calling lookup().




          public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {

              String name = phaseContext.getDeploymentUnit().getName();

              if(name.endsWith("-config.xml")) {

                try {

                  IConfigurationManagerRemote remote = (IConfigurationManagerRemote)context.lookup(jndiName);


                } catch (NamingException e) {

                   throw new DeploymentUnitProcessingException(e);





      Here is the file module.xml :


      <module xmlns="urn:jboss:module:1.0" name="com.acme.deployer">


              <resource-root path="acme-subsystem.jar"/>

              <resource-root path="acme-ejb-client.jar"/




              <module name="javax.api"/>

              <module name="org.jboss.staxmapper"/>

              <module name="org.jboss.as.controller"/>

              <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.vfs"/>




      The IConfigurationManagerRemote interface is in acme-ejb-client.jar


      Any idea ?