6 Replies Latest reply on Sep 16, 2004 6:50 PM by Chuck Harris

    MDB class loading question

    Chuck Harris Newbie

      If I have 2 mdb's, one a test and one a production, that run in the same jboss instance(3.2.5),
      will the test mdb load classes from the jars in its ear and the prod load classes from its ear? Or will there be a class loading problem? Ideally, I'd have a test and production sever and not have to worry but that is not feasable (cost).

        • 1. Re: MDB class loading question
          Elias Ross Master

          If you have your .ear files bundled correctly you won't have class loading issues.

          The MDB classes should be given different names (obviously). In your .ear put in a jboss-app.xml that defines a distinct class loader.

          • 2. Re: MDB class loading question
            Chuck Harris Newbie

            Thanks. Each mdb is a different class and listens on a different queue. Currently, I have the additional jars in each ear specified with a module tag in each application.xml. Will that do it?

            • 3. Re: MDB class loading question
              Elias Ross Master

              Sorry. I didn't mean to say they have to be different names, they can be the same name. I don't know why I said that.

              The stuff in application.xml should be services (.sar) ejb (.jar) and web apps (.war). The libraries get loaded from a classpath setting. There should be docs out there on setting this up.


              Typically, one can only find out if a configuration works by trying it...

              • 4. Re: MDB class loading question
                Chuck Harris Newbie

                Thanks for the help.
                I followed the link:
                and added a Class-Path : \packages\jboss-3.2.5\server\default\test\jar1.jar \packages\jboss-3.2.5\server\default\test\jar2.jar to the meta-inf\manifest.mf
                in the ejb jar. The ear deployed but did not process messages.
                The queue count increased but there was never any processing or logging or
                anything at all. Adding the classpath to the maniest in the ear caused
                an error - no meta-inf/application.xml found even though it was present in the ear. I tried
                and added a jboss-app.xml to the ear:

                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD JBOSS 3.2//EN"
                but I got class not found errors. With the above, I would need to add both jars
                anyway. What do I need to do to get the test mdb to use the ../test/ jars
                and the prod mdb to use the ../prod jars?

                • 5. Re: MDB class loading question
                  Elias Ross Master

                  The loader configuration has to be a valid javax.management.ObjectName not a class path.

                  The classpath is configured through the META-INF/MANIFEST.MF file which is created as part of your EJB .jar file. The manifest is not part of the .ear.

                  Your ear should look like:

                   joe.jar (ejb stuff)
                   joe.sar (MBeans)

                  Each .jar should have its own jboss.xml and ejb-jar.xml in META-INF.

                  • 6. Re: MDB class loading question
                    Chuck Harris Newbie

                    Thanks for the help with this. I got sick of messing with it. I am now running two instances of jboss, one for test and one for prod. Seems to be running fine. Thanks again.