2 Replies Latest reply on Jan 16, 2013 9:33 AM by dinabandhu

    Adding module dependencies dynamically - JBoss 7

    gaspar

      We have one main application with addons that are deployed as separate applications. This separate applications, are depnent on the main ear which is no problem. But the main application would also need to see the classes of the "plugins". Reason beeing, plugin may extend some data transfer objects which are than forwarded (by the main application) to the client, but if the main application doesn't "see" thoose extended classes the forwarding will fail with class not found exception. One solution would be to serialize the data within the plugin before sending it to the main application, so the forwarding deals with a string. However I would like to avoid this, unless realy neccesary. So i wonder if there is a possibility to add module dependecy (like using jboss-deployment-structure.xml but dynamicaly) to a running application and how? or should i take another approach.

        • 1. Re: Adding module dependencies dynamically - JBoss 7
          ctomc

          Hi,

           

          did you look at jboss modules API?

          source can be found here https://github.com/jbossas/jboss-modules

          some documentation can be found here https://docs.jboss.org/author/display/MODULES/Home

           

          Basicly what you can do is load modules dynamicly and use its classloaders for the work you need.

           

          But given description you provided, i would recomend you to write an AS extension as you will then have much more fine grained control of what is going on and how dependancies are are handled especaly if you dynamicly add deployments this could be done really simple by adding custom deployment processor and then reacting on some special deployments you have.

           

          --

          tomaz

          • 2. Re: Adding module dependencies dynamically - JBoss 7
            dinabandhu

            Hi,

             

            Sorry for bumping a old thread but this is exactly what I am trying to do without much success. I have created a AS extension for the framework and have a custom deployment processor in the freamwork extension which can detect plugin deployments. But I am at a loss on how to make the plugins classes available to the framework. I have searched for some examples on google and gone throuhg jboss modules API documents (http://docs.jboss.org/jbossmodules/latest/api/) but not really clear on how can I add a dependency from the framework to the plugin from the deployment processors deploy method.

             

            I am very new to this and quite possibly missing something obvious. I would appreciate any help on this very much.

             

            Regards,

            Dinabandhu