1 2 Previous Next 21 Replies Latest reply on Aug 30, 2013 5:22 AM by aqtwrdnr Go to original post Branched to a new discussion.
      • 15. Re: Unable to deploy MDB in Jboss EAP 6
        aqtwrdnr

        @Justin Bertram: Thanks for explaining that.

         

        Do you maybe have a workaround for the other 'problem' I mentioned? I would like to specify the exact queue or topic at the EAR level, instead of from the ejb-jar level, because the ejb-jar might be used in multiple/different EARs (that possibly run in the same Application Server) and I would like to connect it to different queues from each EAR.

         

        My first approach, where I set the 'destination' ActivationConfigProperty to a java:app relative JNDI name and map those to a java:global one in the application.xml, didn't work, because the JNDI name is directly sent to HornetQ (and not resolved to the java:global one as JBoss does with other resources like data sources and simple JNDI bindings). See Re: Message-driven bean activation-config and JNDI.

         

        If there is no work-around, I will probably not use the @MessageDriven annotation, but manually (through a JNDI lookup) retrieve the ConnectionFactory and Destination to register the bean as a MessageListener.

         

        Thanks in advance!

         

        Barry NL

        • 16. Re: Unable to deploy MDB in Jboss EAP 6
          jbertram

          If you want different activation configuration properties for the same MDB in different environments/applications then the traditional approach is to use ejb-jar.xml (i.e. not annotations) and system property substitution.

           

          To be clear, the EJB 3 spec prohibits the invocation of javax.jms.Session.setMessageListener from an EJB.  See section 21.2.6 for more info.

          • 17. Re: Unable to deploy MDB in Jboss EAP 6
            aqtwrdnr
            To be clear, the EJB 3 spec prohibits the invocation of javax.jms.Session.setMessageListener from an EJB.  See section 21.2.6 for more info.

            Thanks for pointing this out!

             

            the traditional approach is to use ejb-jar.xml (i.e. not annotations) and system property substitution.

            I am not aware of this approach, is there any documentation on this? I do understand the ejb-jar.xml approach, but this would pinpoint all MDB to a single queue. How does this system property substitution work and would this mean I need to loosen my requirement to do all configuration through JNDI?

             

            After some reading (How do I migrate my application from WebLogic to AS 7 - JBoss AS 7.2 - Project Documentation Editor): the traditional approach does not meet my requirements either. When running multiple instances of the same MDB (in separate EARs), they would still connect to the same topic/queue, because the system property they all use in their ejb-jar.xml has the same (system-wide) value for all of them. I will probably use ejb-jar.xml with some maven filtering to get EAR specific JNDI names for my queues/topics.

             

            Thanks for taking the time.


            Barry NL

             

            Edit: added "After some reading" paragraph

            • 18. Re: Unable to deploy MDB in Jboss EAP 6
              jbertram

              I am not aware of this approach, is there any documentation on this?

              A quick Google search turned up http://blog.akquinet.de/2012/11/21/property-substitution-of-deployment-descriptor-in-eap6-and-jboss-as7/ which is a good synopsis.

               

              I do understand the ejb-jar.xml approach, but this would pinpoint all MDB to a single queue.

              I'm not sure what you mean.  An MDB can only consume from one destination at a time.  If you want multiple copies of the same MDB consuming from different destinations then simply package the same class into multiple different JAR files and provide each with the appropriate ejb-jar.xml.

               

              How does this system property substitution work and would this mean I need to loosen my requirement to do all configuration through JNDI?

              See the link above for a description of how it works.

               

              I don't quite understand your "requirement to do all configuration through JNDI" so I can't answer that part.

              • 19. Re: Unable to deploy MDB in Jboss EAP 6
                aqtwrdnr

                What I meant with "requirement to do all configuration through JNDI" is that I would like to deliver to our customers:

                • an EAR with our software
                • a set of JNDI bindings this EAR expects to be present.

                In the system property substitution approach, I would have to provide to our customers:

                • an EAR with our software
                • a set of JNDI names this EAR expects to be present.
                • a set of system properties this EAR expects to be present.

                 

                If you want multiple copies of the same MDB consuming from different destinations then simply package the same class into multiple different JAR files and provide each with the appropriate ejb-jar.xml.

                You are right, I didn't think of that. That is the cleanest approach, I think.

                 

                Is it mandatory for the MDB class to be in the same JAR as the ejb-jar.xml or is its only requirement to be on its classpath? In other words: can I have a JAR with only an ejb-jar.xml and have the referred MDB in the lib directory of the EAR? The reason I am asking is because the MDBs are in a separate Maven artifact. At the moment it has an ejb-jar.xml packaged into it, but this would change in the approach you mention above.

                 

                • 20. Re: Unable to deploy MDB in Jboss EAP 6
                  jbertram

                  Is it mandatory for the MDB class to be in the same JAR as the ejb-jar.xml or is its only requirement to be on its classpath? In other words: can I have a JAR with only an ejb-jar.xml and have the referred MDB in the lib directory of the EAR?

                  I don't know.

                  • 21. Re: Unable to deploy MDB in Jboss EAP 6
                    aqtwrdnr

                    Justin Bertram wrote:

                     

                    Is it mandatory for the MDB class to be in the same JAR as the ejb-jar.xml or is its only requirement to be on its classpath? In other words: can I have a JAR with only an ejb-jar.xml and have the referred MDB in the lib directory of the EAR?

                    I don't know.

                    @Justin Bertram: I've tested this and it works. Thanks for your time.


                    Barry NL

                    1 2 Previous Next