7 Replies Latest reply on Oct 18, 2005 2:16 PM by Keith Counsell

    Strange MDB behavior inside an EAR

    Keith Counsell Newbie

      I have an EAR that consists of a few utility JARs and an MDB. The EAR deploys without any error messages or warnings, but it is never invoked when messages hit the Queue. As far as I can tell no connection is ever made to the Queue in this configuration.

      The MDB happily receives messages from the Queue when it is deployed without the EAR wrapper and the utility JARs are in $JBOSS_HOME/lib/endorsed. Unfortunately, this is not a practical production strategy.

      For what it's worth, the Queue lives on another JBoss installation.

      Is there something obviously wrong or perhaps missing with what I'm doing? The only JBoss-specific deployment descriptor that I have is a jboss-xml in the MDB's META-INF directory. I'd appreciate any hints or pointers.

      Many thanks,
      Keith

        • 1. Re: Strange MDB behavior inside an EAR
          jaikiran pai Master

           

          "kcounsell" wrote:

          For what it's worth, the Queue lives on another JBoss installation.


          Do you mean, the MDB is listening to a remote-queue? If so how have your configured your MDB? Please post your jboss.xml contents

          • 2. Re: Strange MDB behavior inside an EAR
            Keith Counsell Newbie

             

            "jaikiran" wrote:
            Do you mean, the MDB is listening to a remote-queue? If so how have your configured your MDB? Please post your jboss.xml contents


            Yes, sorry. My jboss.xml is:

            <?xml version="1.0"?>
            <jboss>
             <enterprise-beans>
             <message-driven>
             <ejb-name>FormConsumer</ejb-name>
             <destination-jndi-name>queue/ProvidentDemoQueue</destination-jndi-name>
             <resource-ref>
             <res-ref-name>jms/ConnectionFactory</res-ref-name>
             <jndi-name>ConnectionFactory</jndi-name>
             </resource-ref>
             <!-- Remote connection to the queue. -->
             <invoker-bindings>
             <invoker>
             <invoker-proxy-binding-name>my-outside-mdb-invoker</invoker-proxy-binding-name>
             </invoker>
             </invoker-bindings>
             </message-driven>
             </enterprise-beans>
            </jboss>


            I have the corresponding invoker-proxy-binding element in server/default/conf/standardjboss.xml and provided an mbean for the queue in server/default/deploy/jms/remote-jms-ds.xml. Would it be useful to post those as well?

            • 3. Re: Strange MDB behavior inside an EAR
              Keith Counsell Newbie

              Thanks also for such a quick reply, jaikiran!

              • 4. Re: Strange MDB behavior inside an EAR
                jaikiran pai Master

                I think you will have to change the jms-ds.xml file under the server/default/deploy/jms directory to contain something like the following:

                <!--Jaikiran -->
                 <!--Adding my own JMS provider. This will be used to setup a 'destination'(queue/topic) on a remote m/c-->
                 <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
                 name="jboss.mq:service=JMSProviderLoader,name=RemoteMQProvider,server=ps2177">
                 <!--this name will be used in jboss.xml-->
                 <attribute name="ProviderName">JaikiranJMSProvider</attribute>
                 <!--Points to remote server-->
                 <attribute name="ProviderUrl">jnp://ps2177:1099</attribute>
                 <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JBossMQProvider</attribute>
                 <attribute name="QueueFactoryRef">UIL2XAConnectionFactory</attribute>
                 <attribute name="TopicFactoryRef">UIL2XAConnectionFactory</attribute>
                 </mbean>
                 <!--Jaikiran ends-->


                Please post the other config files as well

                • 6. Re: Strange MDB behavior inside an EAR
                  Keith Counsell Newbie

                  My remote-jms-ds.xml in the deploy/jms directory is very similar to what you suggest adding to jms-ds.xml, though I used the improved ProviderAdapterClass mentioned on the Wiki page.

                  <?xml version="1.0" encoding="UTF-8"?>
                  <!-- Provides a link to the remote JNDI service provider. -->
                  <server>
                   <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
                   name="jboss.mq:service=JMSProviderLoader,name=RemoteJMSProvider,server=localhost">
                   <!-- ProviderName specifies the default JNDI lookup name. -->
                   <attribute name="ProviderName">MyOutsideJMSProvider</attribute>
                   <attribute name="ProviderAdapterClass">
                   org.jboss.jms.jndi.JNDIProviderAdapter
                   </attribute>
                   <attribute name="FactoryRef">java:/XAConnectionFactory</attribute>
                   <attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>
                   <attribute name="TopicFactoryRef">java:/XAConnectionFactory</attribute>
                   <attribute name="Properties">
                   java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
                   java.naming.factory.url.pkgs=org.jnp.interfaces
                   java.naming.provider.url=localhost:1099
                   </attribute>
                   </mbean>
                  </server>


                  The snippet that I added to standardjboss.xml is:

                  <invoker-proxy-binding>
                   <name>my-outside-mdb-invoker</name>
                   <invoker-mbean>does-not-matter</invoker-mbean>
                   <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
                   <proxy-factory-config>
                   <JMSProviderAdapterJNDI>MyOutsideJMSProvider</JMSProviderAdapterJNDI>
                   <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
                   <MinimumSize>1</MinimumSize>
                   <KeepAliveMillis>30000</KeepAliveMillis>
                   <MaximumSize>15</MaximumSize>
                   <MaxMessages>1</MaxMessages>
                   <MDBConfig>
                   <ReconnectIntervalSec>10</ReconnectIntervalSec>
                   <DLQConfig>
                   <DestinationQueue>queue/DLQ</DestinationQueue>
                   <MaxTimesRedelivered>10</MaxTimesRedelivered>
                   <TimeToLive>0</TimeToLive>
                   </DLQConfig>
                   </MDBConfig>
                   </proxy-factory-config>
                  </invoker-proxy-binding>


                  The Wiki page is useful, and I actually followed it to get up and running initially. The strange part (to me, at least) is that this works as long as the MDB is deployed by itself, but not when it is in an EAR.

                  Thanks again,
                  Keith

                  • 7. Re: Strange MDB behavior inside an EAR
                    Keith Counsell Newbie

                    I evidently had something wrong in the EAR for half of the day.

                    When I deployed a fully exploded version on 4.0.2 it worked as expected, and when I deployed an archived version on 4.0.3 it worked, too. For the sake of completeness I deployed the archive on 4.0.2 again, and it now works, too.

                    Now if only I can figure out what I did wrong the first time through...