8 Replies Latest reply on Mar 1, 2009 11:27 AM by Bernd Ruecker

    Own DLQ for EJB3-MDB via ActivationConfigProperty doesn't wo

    Bernd Ruecker Master

      Hi!

      currently I have a problem with an EJB3-MDB which should have an own DLQ configured. As far as I found this can be done via ActivationConfigProperties in EJB3.

      So I added these Annotations to my MDB:

      @MessageDriven(name="CommandMessageDrivenBean", activationConfig = {
       @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue")
       ,@ActivationConfigProperty(propertyName="destination", propertyValue="queue/CommandQueue")
       ,@ActivationConfigProperty(propertyName="user",propertyValue="root")
       ,@ActivationConfigProperty(propertyName="password",propertyValue="xxx")
       ,@ActivationConfigProperty(propertyName="DLQJNDIName", propertyValue="queue/CommandDLQ")
       ,@ActivationConfigProperty(propertyName="DLQUser", propertyValue="root")
       ,@ActivationConfigProperty(propertyName="DLQPassword",propertyValue="xxx")
       ,@ActivationConfigProperty(propertyName="DLQMaxResent",propertyValue="0")
      })
      public class CommandMDB implements MessageListener {
      


      But still the default DLQ (queue/DLQ) is used if an exception is thrown in the MDB. This puzzles me.

      If I configure a non existent queue in the ActivationConfigProperty "DLQJNDIName", I get an exception that the queue is not available:

      2009-02-20 13:11:10,517 WARN WARN [org.jboss.resource.adapter.jms.inflow.JmsActivation] (WorkManager(2)-11:) Failure in jms activation org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@716b8f(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@db19d3 destination=queue/CommandQueue isTopic=false tx=true durable=false reconnect=10 provider=java:/DefaultJMSProvider user=root pass=<not shown> maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/InvalidDLQ DLQUser=null DLQMaxResent=5)
      javax.naming.NameNotFoundException: queue/InvalidDLQ
       at org.jboss.ha.jndi.TreeHead.lookup(TreeHead.java:242)
       at org.jboss.ha.jndi.HAJNDI.lookup(HAJNDI.java:155)
       at sun.reflect.GeneratedMethodAccessor92.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java:312)
       at $Proxy255.lookup(Unknown Source)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
       at javax.naming.InitialContext.lookup(InitialContext.java:392)
       at org.jboss.util.naming.Util.lookup(Util.java:215)
       at org.jboss.resource.adapter.jms.inflow.dlq.AbstractDLQHandler.setupDLQDestination(AbstractDLQHandler.java:106)
       at org.jboss.resource.adapter.jms.inflow.dlq.AbstractDLQHandler.setup(AbstractDLQHandler.java:82)
       at org.jboss.resource.adapter.jms.inflow.dlq.JBossMQDLQHandler.setup(JBossMQDLQHandler.java:48)
       at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupDLQ(JmsActivation.java:369)
       at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:315)
       at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:635)
       at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
       at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:275)
       at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:756)
       at java.lang.Thread.run(Thread.java:619)
      

      So I think the property is read correctly...

      Any ideas?
      Thanks
      Bernd

        • 1. Re: Own DLQ for EJB3-MDB via ActivationConfigProperty doesn'
          jaikiran pai Master

           

          But still the default DLQ (queue/DLQ) is used if an exception is thrown in the MDB. This puzzles me.


          Works fine for me against a custom DLQ. On exception, the messages are sent to my custom DLQ.

          Can you post your console logs which show that the default DLQ is being used instead of yours? Also post your queue configuration file contents.


          • 2. Re: Own DLQ for EJB3-MDB via ActivationConfigProperty doesn'
            Bernd Ruecker Master

            Hi.

            I don't see anything about the DQL in the log, even on debug level?

            The only thing I see is the exception thrown:

            2009-02-25 09:12:47,214 ERROR ERROR [org.jboss.resource.adapter.jms.inflow.JmsServerSession] (WorkManager(2)-10:) Unexpected error delivering message delegator->JBossMessage[81510
            4]:PERSISTENT, deliveryId=0
            javax.ejb.EJBTransactionRolledbackException: No row with the given identifier exists: [org.jbpm.graph.exe.Token#88888888888]
             at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
             at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
             at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
             ...
            


            Here my queue configuration:

             <mbean code="org.jboss.jms.server.destination.QueueService"
             name="jboss.messaging.destination:service=Queue,name=CommandQueue"
             xmbean-dd="xmdesc/Queue-xmbean.xml">
             <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
            
             <attribute name="DLQ">jboss.messaging.destination:service=Queue,name=CommandDLQ</attribute>
             <attribute name="SecurityConfig">
             <security>
             <role name="JBossAdmin" read="true" write="true" />
             <role name="JBossAdmin_Role" read="true" write="true" />
             <role name="itInf_Role" read="true" write="true" />
             <role name="DLQ_Role" read="true" write="true" />
             <role name="guest" read="true" write="true" />
             </security>
             </attribute>
             </mbean>
            


            Thanks for any hints...

            • 3. Re: Own DLQ for EJB3-MDB via ActivationConfigProperty doesn'
              jaikiran pai Master

               

              "camunda" wrote:


              I don't see anything about the DQL in the log, even on debug level?



              From your first post, I was of the opinion that you did find something in the logs that indicated that your DLQ is not being used. From your first post:

              But still the default DLQ (queue/DLQ) is used if an exception is thrown in the MDB


              How did you verify this?


              • 4. Re: Own DLQ for EJB3-MDB via ActivationConfigProperty doesn'
                Bernd Ruecker Master

                 

                How did you verify this?

                By looking in the queue ;-)

                • 5. Re: Own DLQ for EJB3-MDB via ActivationConfigProperty doesn'
                  jaikiran pai Master

                   

                  By looking in the queue ;-)


                  Okay, so you do know where to look for in the jmx-console, that's good :)

                  From what i had tried in my sample application, i could see that the MessageCount (don't have the jmx-console in front of me right now so i might be using the wrong property name) on my custom DLQ was incremented when the messages from the MDB threw exception. Isn't that happening in your case?

                  The only few differences that i see in your configuration and mine is that i don't setup the custom DLQ from the xml and i don't have those security configurations in that xml. Try removing those from the xml and see if you see any difference. If not please post back with relevant details :)


                  • 6. Re: Own DLQ for EJB3-MDB via ActivationConfigProperty doesn'
                    Bernd Ruecker Master

                    In the jmx-console I see the counter of the default DLQ increasing, the one of the configured queue not. That's exactly my problem, the message is put into a DLQ, but the wrong one...

                    In the meantime I wrote a unit test as well whicch really checks the content of the DLQ, the message is routed wrongly.

                    The DQL attribute in the XML configuration was just a try, it even doesn't work without it.

                    • 7. Re: Own DLQ for EJB3-MDB via ActivationConfigProperty doesn'
                      jaikiran pai Master

                      Let's see if we can find something in the logs. In my server.log file (under %JBOSS_HOME%/server/< serverName>/log folder) i see this:

                      2009-02-27 17:07:51,666 DEBUG [org.jboss.resource.adapter.jms.inflow.JmsActivation] (WorkManager(2)-2) Setting up org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@2c0b34(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@5df015 destination=queue/tutorial/example destinationType=javax.jms.Queue tx=true durable=false reconnect=10 provider=java:/DefaultJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/tutorial/Junk DLQUser=null DLQMaxResent=5)

                      ...

                      2009-02-27 17:07:51,670 DEBUG [org.jboss.resource.adapter.jms.inflow.JmsActivation] (WorkManager(2)-2) Using context {java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces:org.jboss.naming:org.jnp.interfaces} for org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@2c0b34(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@5df015 destination=queue/tutorial/example destinationType=javax.jms.Queue tx=true durable=false reconnect=10 provider=java:/DefaultJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/tutorial/Junk DLQUser=null DLQMaxResent=5)


                      The queue/tutorial/Junk is my custom DLQ configured on the MDB:
                      @MessageDriven(activationConfig =
                       {
                       @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
                       @ActivationConfigProperty(propertyName="destination", propertyValue="queue/tutorial/example"),
                       @ActivationConfigProperty(propertyName="DLQJNDIName", propertyValue="queue/tutorial/Junk")
                       })
                      public class ExampleMDB ...
                      


                      What do your logs show?

                      • 8. Re: Own DLQ for EJB3-MDB via ActivationConfigProperty doesn'
                        Bernd Ruecker Master

                        Hi jaikiran, thanks for the reply!

                        Just to keep you informed: Since I am going on vacation a colleage will have a look at it, maybe he comes back to you...
                        Cheers
                        Bernd