2 Replies Latest reply on Apr 10, 2004 9:20 PM by adrian.brock

    MDB hangs in CMT

    pongsor

      Hi, All

      I'm developing a workflow management server based on JMS.
      I'm using a MDB(uEngineWorkProcessorEJB) that uses several CMP entity beans (ProcessDefinitionRepository, ProcessInstanceRepository, ProcessVariableRepository), when my MDB is invoked, there an transaction error occurs and right after the MDB hangs (timeout). the error message is the well-known one:

      Prepare called on a local tx. Use of local transactions on a jta transaction with more than one branch may result in inconsistent data in some cases of failure.


      The ejbjar is
       <message-driven>
       <ejb-name>uEngineWorkProcessorEJB</ejb-name>
       <ejb-class>org.uengine.queue.workqueue.WorkProcessorBean</ejb-class>
       <transaction-type>Container</transaction-type>
       <message-selector>MessageFormat = 'Version 1.0'</message-selector>
       <acknowledge-mode>auto-acknowledge</acknowledge-mode>
       <message-driven-destination>
       <destination-type>javax.jms.Queue</destination-type>
       </message-driven-destination>
      
       <security-identity>
       <run-as><role-name>everyone</role-name></run-as>
       </security-identity>
       <resource-ref>
       <res-ref-name>jms/QueueFactory</res-ref-name>
       <res-type>javax.jms.QueueConnectionFactory</res-type>
       <res-auth>Container</res-auth>
       </resource-ref>
       <ejb-local-ref>
       <ejb-ref-name>ProcessDefinitionRepositoryHomeLocal</ejb-ref-name>
       <ejb-ref-type>Entity</ejb-ref-type>
       <local-home>org.uengine.persistence.processdefinition.ProcessDefinitionRepositoryHomeLocal</local-home>
       <local>org.uengine.persistence.processdefinition.ProcessDefinitionRepositoryLocal</local>
      
       <!-- jboss specific -->
       <ejb-link>ProcessDefinitionRepositoryEJB</ejb-link>
       </ejb-local-ref>
       ....
       </message-driven>



      The MDB couldn't work till the transaction settings were disabled like following:

      <container-transaction>
       <!--method>
       <ejb-name>uEngineWorkProcessorEJB</ejb-name>
       <method-name>*</method-name>
       </method-->
       <method>
       <ejb-name>ProcessDefinitionRepositoryEJB</ejb-name>
       <method-name>*</method-name>
       </method>
       <method>
       <ejb-name>ProcessDefinitionRepositoryEJB</ejb-name>
       <method-name>*</method-name>
       </method>
       <method>
       <ejb-name>ProcessInstanceRepositoryEJB</ejb-name>
       <method-name>*</method-name>
       </method>
       <method>
       <ejb-name>ProcessVariableRepositoryEJB</ejb-name>
       <method-name>*</method-name>
       </method>
       <trans-attribute>Required</trans-attribute>
       </container-transaction>


      I guess the cause is my MDB tries an unsafe transaction or something like a deadlock..

      Can anybody help me?

        • 1. Re: MDB hangs in CMT
          pongsor

          I just found very interesting thing:

          My MDB's onMessage includes some code openning a URL connection with 'URL.openStream()' method, I found the thread waits there permanently by 'Object.wait()' method.
          JMS and URL seems to make some collision..

          Does anyone know about this?

          • 2. Re: MDB hangs in CMT

            Not without a stacktrace or example code so we know what you are talking about.