SONIC MQ - Message Driven Bean with CMT

Hi guys,
I am having hard time with MDB having container managed transaction with TX attribute required. I am using RAD 6.0.1 and the JMS provider is Sonic MQ.I have defined XAConnectionFactory on Sonic side. The MDB runs without any error, but when I shut down the app server the message appears back in the queue. When I use transaction attribute as NOT SUPPORTED everything runs as normal.
Am I missing something on the configuration here?
I am seeing the XA implementation classes in the sonic jar file, but do I need their resource adaptor from sonic?
Thanks
Matt

The current version of the white-paper that Raffi
          refers to covers through 7.0. For 8.1 see also
          http://edocs.bea.com/wls/docs81/ConsoleHelp/jms_config.html#accessing_foreign_providers
          and
          http://edocs.bea.com/wls/docs81/jms/j2ee_components.html
          these features can often make integration easier.
          Tom
          Raffi wrote:
          > Doug,
          >
          > You can find very detailed information on this topic at the link below. All
          > you need to do is specify the destination-jndi-name, initial-context-factory,
          > provider-url, and connection-factory-jndi-name in weblogic-ejb-jar.xml for the
          > non-BEA JMS provider for that specific MDB.
          >
          > ftp://edownload:[email protected]/pub/downloads/jmsproviders.pdf
          >
          > Hope that helps!
          >
          > Raffi
          >
          > Doug Chew <[email protected]> wrote:
          >
          >>Can someone give me an example on how to setup a message driven bean
          >>with a foreign JMS provider using the foreign JMS provider's implementation
          >>of a connection factory. i.e. binding the foreign JMS provider's connection
          >>factory to the JNDI tree.
          >>
          >>Thanks
          >
          >
          

Similar Messages

  • Message Driven Beans with "Required" CMT and duplicate delivery of messages

    Hi,
    Let's pretend that an MDB is configured with CMT and the "Required" transaction attribute. Let's suppose that it has received a message and is busy processing it in a transaction that might take some time to complete.
    Is a JEE container required to ensure that while a message is being handled by an MDB in a transaction that's neither completed nor rolled back, no dupes of the same message should be delivered to another instance of the same MDB?

    user572625 wrote:
    Hi,
    Let's pretend that an MDB is configured with CMT and the "Required" transaction attribute. Let's suppose that it has received a message and is busy processing it in a transaction that might take some time to complete.
    Is a JEE container required to ensure that while a message is being handled by an MDB in a transaction that's neither completed nor rolled back, no dupes of the same message should be delivered to another instance of the same MDB?First, define "dupe".
    Note that the main reason to use JEE technology over simpler frameworks is robustness, so if I understand your slightly vague question correctly, you can make the safe assumption that the answer is yes.

  • Message Driven Bean with Java Message Queue down

    I have the following problem deploying my application.
    It uses JMS and a remote openMQ for communication between servers. The problem is that the connection is not fully reliable so it can be up or down. For reconnecting I set the jms reconnect glassfish property so it reconnects if at some moment the connection gets lost. The problem arises when i try to deploy the application and there is no connection. It looks like it keeps retrying the connection but the application does not finish deployment until connection is available.
    Is it possible to configure it in any way that the deployment continues even if there is no connection and keeps retrying until there is connection available?
    Thanks a lot.
    Approach 1
    I'm trying to run the MDB initialization in a different thread. I tried both
    I'm trying to assign a different thread to the MDB by two ways changing sun-ejb.jar.xml
            <bean-pool>
                <steady-pool-size>1</steady-pool-size>
                <resize-quantity>1</resize-quantity>
                <max-pool-size>1</max-pool-size>
                <pool-idle-timeout-in-seconds>60</pool-idle-timeout-in-seconds>
            </bean-pool>and also with
            <use-thread-pool-id>a-new-thread-pool</use-thread-pool-id>But I had no luck. Looks like it's waiting for this thread to end since it looks like it's getting the new thread but it waits for that thread to end to finish starting application so, in my case, application doesn't get deployed correctly..
    Approach 2
    I tried to run jms service in a different thread also...
    asadmin create-resource-adapter-config --threadpools a-new-thread-pool jmsraNo luck

    You could try the JMSJCA resource adapter ( [https://jmsjca.dev.java.net/|https://jmsjca.dev.java.net/] ) ; this is expressly designed to allow a MDB to be deployed even though the MQ broker is not available. It will then try to establish the connection in a background thread.
    Nigel

  • Example for message-style with Message Driven Bean

    hi,
    Can i have some examples of webservices message-style with
    MDB?....
    thanks

    The current version of the white-paper that Raffi
              refers to covers through 7.0. For 8.1 see also
              http://edocs.bea.com/wls/docs81/ConsoleHelp/jms_config.html#accessing_foreign_providers
              and
              http://edocs.bea.com/wls/docs81/jms/j2ee_components.html
              these features can often make integration easier.
              Tom
              Raffi wrote:
              > Doug,
              >
              > You can find very detailed information on this topic at the link below. All
              > you need to do is specify the destination-jndi-name, initial-context-factory,
              > provider-url, and connection-factory-jndi-name in weblogic-ejb-jar.xml for the
              > non-BEA JMS provider for that specific MDB.
              >
              > ftp://edownload:[email protected]/pub/downloads/jmsproviders.pdf
              >
              > Hope that helps!
              >
              > Raffi
              >
              > Doug Chew <[email protected]> wrote:
              >
              >>Can someone give me an example on how to setup a message driven bean
              >>with a foreign JMS provider using the foreign JMS provider's implementation
              >>of a connection factory. i.e. binding the foreign JMS provider's connection
              >>factory to the JNDI tree.
              >>
              >>Thanks
              >
              >
              

  • Help : Message Driven bean seeing the same message multiple times.

    ( We are using weblogic 8.1 on Solaris )
    We have a bunch of message driven beans with the transaction type as 'Container' and the acknowledge-mode mode as auto-acknowledge. They are consuming messages from a weblogic Queue ( javax.jms.Queue ). The MBD container is also weblogic 8.1.
    We have 7 instances of the bean consuming messages.
    Most of the messages are picked up and processed only once as expected.
    But randomly we are seeing that sometimes the same message is delivered again ( Message.getJmsRedelivered = true ) eventhough it was once picked up and processed successfully once.
    We are completely lost and our production machine is in big trouble as a result of this.
    ( Is it possible that weblogic uses unreliable UDP for acknowledging messages. If yes where do we change this setting )
    Any help will be greatly appreciated
    Thanks
    --sony
    ================ejb-jar.xml BEGIN
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
    <ejb-jar>
    <enterprise-beans>
    <message-driven>
    <description>DslUpdtDdpostPrcsrMDB</description>
    <ejb-name>DslUpdtDdpostPrcsrMDB</ejb-name>
    <ejb-class>
    com.bellsouth.snt.idm.ejb.wfac.DslUpdtDdpostPrcsrMDB
    </ejb-class>
    <transaction-type>Container</transaction-type>
    <message-selector>
    <![CDATA[ idm_state = 'dsl_updt_dd_post' ]]>
    </message-selector>
    <acknowledge-mode>auto-acknowledge</acknowledge-mode>
    <message-driven-destination>
    <destination-type>javax.jms.Queue</destination-type>
    </message-driven-destination>
    <env-entry>
              <env-entry-name>MDB_NAME</env-entry-name>
              <env-entry-type>java.lang.String</env-entry-type>
              <env-entry-value>dsl_updt_dd_post</env-entry-value>
    </env-entry>
    <!--security-identity><use-caller-identity/></security-identity-->
    <resource-ref>
    <res-ref-name>jms/QueueConnectionFactory</res-ref-name>
    <res-type>javax.jms.QueueConnectionFactory</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    </message-driven>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>DslUpdtDdpostPrcsrMDB</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    ================ejb-jar.xml END
    ================weblogic-ejb-jar.xml BEGIN
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN' 'http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd'>
    <weblogic-ejb-jar>
    <weblogic-enterprise-bean>
    <ejb-name>DslUpdtDdpostPrcsrMDB</ejb-name>
    <message-driven-descriptor>
    <pool>
    <max-beans-in-free-pool>10</max-beans-in-free-pool>
    <initial-beans-in-free-pool>0</initial-beans-in-free-pool>
    </pool>
    <destination-jndi-name>
    idm.jms.clip.WfacClipResponseQueue
    </destination-jndi-name>
    <connection-factory-jndi-name>
    idm.jms.IdmXaJmsQueueConnectionFactory
    </connection-factory-jndi-name>
    </message-driven-descriptor>
    <transaction-descriptor>
    <trans-timeout-seconds>
    300
    </trans-timeout-seconds>
    </transaction-descriptor>
    <reference-descriptor>
    <resource-description>
    <res-ref-name>jms/QueueConnectionFactory</res-ref-name>
    <jndi-name>idm.jms.IdmXaJmsQueueConnectionFactory</jndi-name>
    </resource-description>
    </reference-descriptor>
    <jndi-name>jms.DslUpdtDdpostPrcsrMDB</jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    ================weblogic-ejb-jar.xml END

    The transaction attribute for the MDB is set to 'Required'. Is it possible
    that your application logic may process the message successfully even in
    case of a transaction roll back? If the transaction rolls back, the message
    will be re-delivered.
    There is some docs on exactly-once processing which may help
    http://e-docs.bea.com/wls/docs81/ejb/message_beans.html#1147208
    --Sathish
    <Sony Antony> wrote in message news:[email protected]...
    ( We are using weblogic 8.1 on Solaris )
    We have a bunch of message driven beans with the transaction type as
    'Container' and the acknowledge-mode mode as auto-acknowledge. They are
    consuming messages from a weblogic Queue ( javax.jms.Queue ). The MBD
    container is also weblogic 8.1.
    We have 7 instances of the bean consuming messages.
    Most of the messages are picked up and processed only once as expected.
    But randomly we are seeing that sometimes the same message is delivered
    again ( Message.getJmsRedelivered = true ) eventhough it was once picked
    up and processed successfully once.
    We are completely lost and our production machine is in big trouble as a
    result of this.
    ( Is it possible that weblogic uses unreliable UDP for acknowledging
    messages. If yes where do we change this setting )
    Any help will be greatly appreciated
    Thanks
    --sony
    ================ejb-jar.xml BEGIN
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise
    JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
    <ejb-jar>
    <enterprise-beans>
    <message-driven>
    <description>DslUpdtDdpostPrcsrMDB</description>
    <ejb-name>DslUpdtDdpostPrcsrMDB</ejb-name>
    <ejb-class>
    com.bellsouth.snt.idm.ejb.wfac.DslUpdtDdpostPrcsrMDB
    </ejb-class>
    <transaction-type>Container</transaction-type>
    <message-selector>
    <![CDATA[ idm_state = 'dsl_updt_dd_post' ]]>
    </message-selector>
    <acknowledge-mode>auto-acknowledge</acknowledge-mode>
    <message-driven-destination>
    <destination-type>javax.jms.Queue</destination-type>
    </message-driven-destination>
    <env-entry>
    <env-entry-name>MDB_NAME</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>dsl_updt_dd_post</env-entry-value>
    </env-entry>
    <!--security-identity><use-caller-identity/></security-identity-->
    <resource-ref>
    <res-ref-name>jms/QueueConnectionFactory</res-ref-name>
    <res-type>javax.jms.QueueConnectionFactory</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    </message-driven>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>DslUpdtDdpostPrcsrMDB</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    ================ejb-jar.xml END
    ================weblogic-ejb-jar.xml BEGIN
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic
    8.1.0 EJB//EN'
    'http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd'>
    <weblogic-ejb-jar>
    <weblogic-enterprise-bean>
    <ejb-name>DslUpdtDdpostPrcsrMDB</ejb-name>
    <message-driven-descriptor>
    <pool>
    <max-beans-in-free-pool>10</max-beans-in-free-pool>
    <initial-beans-in-free-pool>0</initial-beans-in-free-pool>
    </pool>
    <destination-jndi-name>
    idm.jms.clip.WfacClipResponseQueue
    </destination-jndi-name>
    <connection-factory-jndi-name>
    idm.jms.IdmXaJmsQueueConnectionFactory
    </connection-factory-jndi-name>
    </message-driven-descriptor>
    <transaction-descriptor>
    <trans-timeout-seconds>
    300
    </trans-timeout-seconds>
    </transaction-descriptor>
    <reference-descriptor>
    <resource-description>
    <res-ref-name>jms/QueueConnectionFactory</res-ref-name>
    <jndi-name>idm.jms.IdmXaJmsQueueConnectionFactory</jndi-name>
    </resource-description>
    </reference-descriptor>
    <jndi-name>jms.DslUpdtDdpostPrcsrMDB</jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    ================weblogic-ejb-jar.xml END

  • Message-driven bean CMT can not be supported

    Hi,
    I�m trying to use IBM MQSeries 5.3 with S1AS7. The AS and MQ run under W2K SP3. At first I had no problem with deploying and running samples. I used C:\Sun\AppServer7\samples\ejb\mdb\simple\
    I was able to put a test message into MQSeries queue and I saw it was processed by the MDB
    Then I decided to change <transaction-type> from �Bean� to �Container� and I added <assembly-descriptor> where I set <trans-attribute> as �Required�.
    Here is my new ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
    <!-- Copyright 2002 Sun Microsystems, Inc. All rights reserved. -->
    <ejb-jar>
    <display-name>SimpleMessageJAR</display-name>
    <enterprise-beans>
    <message-driven>
    <display-name>SimpleMessageEJB</display-name>
    <ejb-name>SimpleMessageEJB</ejb-name>
    <ejb-class>samples.ejb.mdb.simple.ejb.SimpleMessageBean</ejb-class>
    <transaction-type>Container</transaction-type>
    <message-driven-destination>
    <destination-type>javax.jms.Queue</destination-type>
    </message-driven-destination>
    </message-driven>
    </enterprise-beans>
    <assembly-descriptor>
         <container-transaction>
              <method>
                   <ejb-name>SimpleMessageEJB</ejb-name>
                   <method-name>onMessage</method-name>
                   <method-params>
                        <method-param>javax.jms.Message</method-param>
                   </method-params>
              </method>
              <trans-attribute>Required</trans-attribute>
         </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    In this case I have the following server.log
    [15/Dec/2002:15:29:00] FINE ( 1700): Requesting Server Session at: 1039955340843
    [15/Dec/2002:15:29:00] FINE ( 1700): Got Server Session at: 1039955340859(1039955340843)
    [15/Dec/2002:15:29:00] INFO ( 1700): CORE3282: stdout: In SimpleMessageBean.SimpleMessageBean()
    [15/Dec/2002:15:29:00] FINEST ( 1700): Thread[MQQueueAgent (MYASQUEUE),5,RMI Runtime]: got session: com.sun.enterprise.jms.SessionWrapperBase@3c9616 from com.iplanet.ias.ejb.containers.IASServerSessionImpl@3508c0
    [15/Dec/2002:15:29:00] INFO ( 1700): CORE3282: stdout: In SimpleMessageBean.setMessageDrivenContext()
    [15/Dec/2002:15:29:00] INFO ( 1700): CORE3282: stdout: In SimpleMessageBean.ejbCreate()
    [15/Dec/2002:15:29:00] FINEST ( 1700): start(): calling notify... com.iplanet.ias.ejb.containers.IASServerSessionImpl@3508c0
    [15/Dec/2002:15:29:00] FINEST ( 1700): run(): after wait ... com.iplanet.ias.ejb.containers.IASServerSessionImpl@3508c0
    [15/Dec/2002:15:29:00] FINEST ( 1700): Thread[Thread-28,5,RMI Runtime]: run(): calling Session.run() ... com.iplanet.ias.ejb.containers.IASServerSessionImpl@3508c0
    [15/Dec/2002:15:29:00] FINEST ( 1700): Thread[Thread-28,5,RMI Runtime]: message-driven bean container onMessage :
    JMS Message class: jms_text
    JMSType: null
    JMSDeliveryMode: 1
    JMSExpiration: 0
    JMSPriority: 0
    JMSMessageID: ID:414d5120514d5f636c6f7564202020200628fc3d2000020f
    JMSTimestamp: 1039955340820
    JMSCorrelationID:null
    JMSDestination: null
    JMSReplyTo: null
    JMSRedelivered: false
    JMS_IBM_PutDate:20021215
    JMSXAppID:C:\WINNT\system32\mmc.exe
    JMS_IBM_Format:MQSTR
    JMS_IBM_PutApplType:11
    JMS_IBM_MsgType:8
    JMSXUserID:alex
    JMS_IBM_PutTime:12290082
    JMSXDeliveryCount:1
    111111111111111111
    [15/Dec/2002:15:29:00] FINEST ( 1700): beforeMessageDelivery() not called
    [15/Dec/2002:15:29:00] INFO ( 1700): MDB00040: [mdb-simple:SimpleMessageEJB]: Message-driven bean CMT can not be supported.
    [15/Dec/2002:15:29:00] SEVERE ( 1700): MDB0008: Session.run() throws Exception [Message-driven bean CMT can not be supported.]
    [15/Dec/2002:15:29:00] SEVERE ( 1700): MDB0009: Session.run() throws Exception
    java.lang.RuntimeException: Message-driven bean CMT can not be supported.
         at com.sun.enterprise.jms.SessionWrapperBase.run(SessionWrapperBase.java:200)
         at com.iplanet.ias.ejb.containers.IASServerSessionImpl.run(IASServerSessionImpl.java:191)
         at java.lang.Thread.run(Thread.java:536)
    [15/Dec/2002:15:29:00] FINEST ( 1700): Thread[Thread-28,5,RMI Runtime]: in run(): return object com.iplanet.ias.ejb.containers.IASServerSessionImpl@3508c0 to pool ...
    [15/Dec/2002:15:29:00] FINEST ( 1700): run(): before wait ... com.iplanet.ias.ejb.containers.IASServerSessionImpl@3508c0
    If I use internal AS JMS I don�t have any trouble. Everything works fine.
    Why it is possible to use MDB CMT with internal AS JMS provider?
    What should I do to create MDB CMT with IBM MQSeries?
    Alexei Gladkov

    Hi Alexei,
    Sun ONE Application Server 7 does not support CMT MDBs with 3rd party JMS providers. (As you note, BMT MDBs work with MQSeries and Sun ONE App Server).
    With the advent of the next J2EE CA spec version (1.5) and J2EE 1.4, a standard means of hooking JMS providers into app servers and MDBs will be made available. Shortly after J2EE 1.4 is released, you'll see this support in Sun ONE App Server.
    From the J2EE 1.4 spec: "The Connector API now supports integration with asynchronous messaging systems, including the ability to plug in JMS providers."
    Thanks,
    Chris

  • Message Driven Bean: problem with @RunAs annotation

    I am having a problem using the @RunAs annotation in a message driven bean.
    I would like the code in my onMessage() method to be executed with a specific role/user, so I want to use the @RunAs annotation to achieve this.
    I am running weblogic 10.0.
    I have created the following in weblogic console:
    - Group "TestGroup"
    - User "TestUser", member of "TestGroup"
    - Global Role "TestRole", role condition: "Group : TestGroup"
    The MDB:
    package be.cegeka.test.mdb;
    import javax.annotation.Resource;
    import javax.annotation.security.RunAs;
    import javax.ejb.ActivationConfigProperty;
    import javax.ejb.MessageDriven;
    import javax.ejb.MessageDrivenContext;
    import javax.jms.Message;
    import javax.jms.MessageListener;
    @MessageDriven(
              mappedName = "testQueue",
              name = "TestMDB",
              activationConfig = {
                        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
    @RunAs("TestRole")
    public class TestMDB implements MessageListener {
         @Resource
         private MessageDrivenContext mdContext;
          * {@inheritDoc}}
         public void onMessage(Message msg) {
              System.out.println("Handling message for user "
                        + mdContext.getCallerPrincipal().getName());
    }[u]The ejb-jar.xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
    version="3.0">
         <assembly-descriptor>
              <security-role>
                   <description>
                        Test Role.
                   </description>
                   <role-name>TestRole</role-name>
              </security-role>
         </assembly-descriptor>
    </ejb-jar>
    The weblogic-ejb-jar.xml file:
    <weblogic-ejb-jar xmlns="http://www.bea.com/ns/weblogic/10.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.bea.com/ns/weblogic/10.0 http://www.bea.com/ns/weblogic/10.0/weblogic-ejb-jar.xsd">
         <security-role-assignment>
              <role-name>TestRole</role-name>
              <principal-name>TestUser</principal-name>
         </security-role-assignment>
    </weblogic-ejb-jar>I would have thought that the onMessage of the MDB would print "Handling message for user TestUser", but instead it prints "Handling message for user <anonymous>".
    It seems as though the @RunAs annotation has no effect. Although I specified the role TestRole (mapped to the user TestUser), the code still seems to be executed by user anonymous.
    Am I missing something?
    Any help would be much appreciated! I've been looking at this poblem for quite a while now.

    Both beans (the MDB on WLS 10 and the session bean on WLS 8.1) use container managed transactions.
    For the MDB I do not explicitly set the transaction attributes, so it should default to container managed transactions.
    For the stateless session bean I have specified the following in the ejb-jar.xml file:
    <ejb-jar>
      <display-name>Weblogic8Service</display-name>
      <enterprise-beans>
        <session>
          <ejb-name>Weblogic8Service</ejb-name>
          <home>be.cegeka.rszv.test.session.Weblogic8ServiceRemoteHome</home>
          <remote>be.cegeka.rszv.test.session.Weblogic8ServiceRemote</remote>
          <ejb-class>be.cegeka.rszv.test.session.Weblogic8ServiceBean</ejb-class>
          <session-type>Stateless</session-type>
          <transaction-type>Container</transaction-type>
        </session>
      </enterprise-beans>
      <assembly-descriptor>
        <container-transaction>
          <method>
            <ejb-name>Weblogic8Service</ejb-name>
            <method-name>*</method-name>
          </method>
          <trans-attribute>Required</trans-attribute>
        </container-transaction>
      </assembly-descriptor>
    </ejb-jar>So as far as I understand it the transaction starts at the MDB (upon receival of a message). The transaction for the remote call to the stateless session bean (in the onMessage() of the MDB) is included in the transaction of the MDB and gets committed when the onMessage() method finishes and the transaction of the MDB itself gets committed.
    Correct me if I'm wrong here.

  • WLS Cluster with Message Driven Beans and MQSeries on more than one Host

              With the Examples of http://developer.bea.com/jmsproviders.jsp and http://developer.bea.com/jmsmdb.jsp
              a MDB can be
              configured to work with MQSeries with one WLS Server. This works only, if a Queuemanager
              is started at the same Host that runs the WLS Server too.
              And the QueueConnectionFactory (QCF) is configured to TRANSPORT(BIND).
              In my configuration should be two WLS Servers and one JMS Queue (MQS) with the
              Queuemanager.
              A Message Driven Bean is deployed on both WLS Servers wich should get the Messages
              of this Queue.
              If one of the two WLS Servers fails the other WLS Server with the corresponding
              MDB should get the Messages of the
              MQSeries Queue.
              If the QCF is configured to TRANSPORT(Client) the Message Driven Bean can't start
              and the following Exception is thrown:
              <Jul 18, 2001 3:52:49 PM CEST> <Error> <J2EE> <Error deploying EJB Component :
              mdb_deployed
              weblogic.ejb20.EJBDeploymentException: Error deploying Message-Driven EJB:; nested
              exception is:
              javax.jms.JMSException: MQJMS2005: failed to create MQQueueManager for
              'btsun1a:TEST'
              javax.jms.JMSException: MQJMS2005: failed to create MQQueueManager for 'btsun1a:TEST'
              at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:434)
              I'm wondering, because their is a MQQueueManager on btsun1a; all Servers throws
              the same Exception when the MDB is deployed.
              The configuration of JMSadmin on both Hosts is the following:
              dis qcf(myQCF2)
              HOSTNAME(btsun1a)
              CCSID(819)
              TRANSPORT(CLIENT)
              PORT(1414)
              TEMPMODEL(SYSTEM.DEFAULT.MODEL.QUEUE)
              QMANAGER(TEST)
              CHANNEL(JAVA.CHANNEL)
              VERSION(1)
              dis q(myQueue)
              CCSID(819)
              PERSISTENCE(APP)
              TARGCLIENT(JMS)
              QUEUE(MYQUEUE)
              EXPIRY(APP)
              QMANAGER(TEST)
              ENCODING(NATIVE)
              VERSION(1)
              PRIORITY(APP)
              I think only TRANSPORT(CLIENT) can be used when i don't wan't to install a Queue
              and a QueueManager on each WLS Server.
              Does anybody know a problem of WLS 6.0 SP2 to cope with TRANSPORT(CLIENT)?
              

              With the Examples of http://developer.bea.com/jmsproviders.jsp and http://developer.bea.com/jmsmdb.jsp
              a MDB can be
              configured to work with MQSeries with one WLS Server. This works only, if a Queuemanager
              is started at the same Host that runs the WLS Server too.
              And the QueueConnectionFactory (QCF) is configured to TRANSPORT(BIND).
              In my configuration should be two WLS Servers and one JMS Queue (MQS) with the
              Queuemanager.
              A Message Driven Bean is deployed on both WLS Servers wich should get the Messages
              of this Queue.
              If one of the two WLS Servers fails the other WLS Server with the corresponding
              MDB should get the Messages of the
              MQSeries Queue.
              If the QCF is configured to TRANSPORT(Client) the Message Driven Bean can't start
              and the following Exception is thrown:
              <Jul 18, 2001 3:52:49 PM CEST> <Error> <J2EE> <Error deploying EJB Component :
              mdb_deployed
              weblogic.ejb20.EJBDeploymentException: Error deploying Message-Driven EJB:; nested
              exception is:
              javax.jms.JMSException: MQJMS2005: failed to create MQQueueManager for
              'btsun1a:TEST'
              javax.jms.JMSException: MQJMS2005: failed to create MQQueueManager for 'btsun1a:TEST'
              at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:434)
              I'm wondering, because their is a MQQueueManager on btsun1a; all Servers throws
              the same Exception when the MDB is deployed.
              The configuration of JMSadmin on both Hosts is the following:
              dis qcf(myQCF2)
              HOSTNAME(btsun1a)
              CCSID(819)
              TRANSPORT(CLIENT)
              PORT(1414)
              TEMPMODEL(SYSTEM.DEFAULT.MODEL.QUEUE)
              QMANAGER(TEST)
              CHANNEL(JAVA.CHANNEL)
              VERSION(1)
              dis q(myQueue)
              CCSID(819)
              PERSISTENCE(APP)
              TARGCLIENT(JMS)
              QUEUE(MYQUEUE)
              EXPIRY(APP)
              QMANAGER(TEST)
              ENCODING(NATIVE)
              VERSION(1)
              PRIORITY(APP)
              I think only TRANSPORT(CLIENT) can be used when i don't wan't to install a Queue
              and a QueueManager on each WLS Server.
              Does anybody know a problem of WLS 6.0 SP2 to cope with TRANSPORT(CLIENT)?
              

  • "Message Driven Bean" doesn't work with Sun App Server

    Hello all,
    i have a little bit problems, running a simple "Message Driven Bean" under the Sun App Server. The deployment of it works fine, but after starting the SUN App Server i get the following error message:
    An error occurred during the message-driven beancontainer initialization at runtime. The most common cause for this is that the physical resource(e.g. Queue) from which the message-driven bean is consuming either does not exist or has been configured incorrectly. Another common error is that the message-driven bean implementation class does not correctly implement the required javax.ejb.MessageBean or MessageListener interfaces.
    Has anybody a workaround for this problem?
    The queue seems to be correctly installed. A simple client programm from the Sun Tutorial (Consumer & Producer) works fine without any Errors or Exceptions.
    I am a little bit confused, because the queue seems to work with the client programms but not with a MDB running on the SUN App Server.
    Thanks for you help!
    Greetings
    Manuel

    Hello Mr Manuel!
    could you plz help me with the steps for creating a message driven bean using netbeans ver 5.0(with Sun Java� System Application Server Platform Edition 8.2 )
    I just know how to work with Session beans & Entity Bean, and am try to learn to work on Message Driven Beans too. there are no proper tutorials where i can find steps for creating these..
    I need the steps from the scratch.,like creating QueueConnection Factory & Destination etc..
    It will be gr8 if you can help me with this at the earliest .
    Thank you
    Bye

  • Asynchronous request/reply with message driven beans?

    HI,
    Can I implement requet/reply with message driven beans in an asynchronous way? If so can somebody give me some hints?
    I read that this can be done by creating a temporary queue on the producer and then calling setJMSReplyTo methond on the request message and passing in the temporary queue. By how do you specify a response message in the MessageDrivenBean, MessageListener class with only onMessage()?
    Thanks

    The MDB can only really be used for the server side of a request-response.
    I'd recommend you look at Lingo which implements request-response remoting using JMS...
    http://lingo.codehaus.org/Example
    James
    http://logicblaze.com/
    Open Source SOA

  • B2B using JMS and Processing Messages with Message Driven Beans

    We want to be able to use B2B to send messages to a JMS queue and then process messages from B2B using a Message Driven Bean. Is this supported.
    We are using B2B 10.2.0.2 with Patchset 4.

    Hello,
    In 10.1.2.0.2 B2B , as part of the internal Delivery channel B2B can only send and receive messages from JMS queues.
    Rgds,Ramesh

  • How to transaction in the message driven bean?

              hello
              i write a message driven bean,that monitor the weblogic message queue,when a "Order"
              object is witten to the queue,the mdb get it and write it to a entity bean "Orderinfo".all
              of above logic is within the "onMessage" method of the mdb.
              i want to encapsulate the flow in a transaction,see my code snippet of the onMessage
              method:
              ObjectMessage objMsg = (ObjectMessage) msg;
              OrderVO orderVO = (OrderVO) objMsg.getObject();
              System.out.println(orderVO.booklist);
              OrderinfoHome orderinfoHome = (OrderinfoHome) ctx.lookup(
              "java:/comp/env/orderinfo");
              Orderinfo orderinfo = orderinfoHome.create(orderVO.orderID);
              orderinfo.setAddress(orderVO.address);
              orderinfo.setCustname(orderVO.custName);
              orderinfo.setEmail(orderVO.email);
              orderinfo.setBooklist(orderVO.booklist);
              orderinfo.setPrice(new BigDecimal(orderVO.price));
              and deploy descriptor snippet(ejb-jar.xml):
              <assembly-descriptor>
              <container-transaction>
              <method>
              <ejb-name>orderMDB</ejb-name>
              <method-name>*</method-name>
              </method>
              <trans-attribute>Required</trans-attribute>
              </container-transaction>
              </assembly-descriptor>
              i think during this transaction,there are two action:geting the object from the
              queue and saving it to entity bean.in order to test the transaction,i modify the
              jndi name of entity bean in the code to a WRONG one.redeploy my program,and send
              a message to the queue,the mdb is activated,then the exception is thrown because
              of the wrong jndi name.after that,i check the message queue,find that it is empty.why?i
              think if the second action of the transaction is fail,the transaction should roll
              back,the message should be send BACK to the queue.
              i also ty to use the "javax.transaction.UserTransaction" in the onMessage method,but
              the follwing exception is thrown:
              javax.transaction.NotSupportedException: Another transaction is associated with
              this thread.................................
              who can help me,if any wrong with me,and how to use the transaction with the message
              driven bean?
              thank you.
              

    The transaction should rollback if the MDB throws an
              exception. Try changing your MDB code to
              call "setRollbackOnly()" on the EJB
              context (instead of throwing an exception) to see
              if that works. If calling "setRollbackOnly()" fixes
              the problem - then please contact customer support
              and report a bug.
              zbcong wrote:
              > hello
              >
              > i write a message driven bean,that monitor the weblogic message queue,when a "Order"
              > object is witten to the queue,the mdb get it and write it to a entity bean "Orderinfo".all
              > of above logic is within the "onMessage" method of the mdb.
              > i want to encapsulate the flow in a transaction,see my code snippet of the onMessage
              > method:
              >
              >
              > ObjectMessage objMsg = (ObjectMessage) msg;
              > OrderVO orderVO = (OrderVO) objMsg.getObject();
              > System.out.println(orderVO.booklist);
              > OrderinfoHome orderinfoHome = (OrderinfoHome) ctx.lookup(
              > "java:/comp/env/orderinfo");
              > Orderinfo orderinfo = orderinfoHome.create(orderVO.orderID);
              > orderinfo.setAddress(orderVO.address);
              > orderinfo.setCustname(orderVO.custName);
              > orderinfo.setEmail(orderVO.email);
              > orderinfo.setBooklist(orderVO.booklist);
              > orderinfo.setPrice(new BigDecimal(orderVO.price));
              >
              >
              > and deploy descriptor snippet(ejb-jar.xml):
              >
              >
              > <assembly-descriptor>
              > ............
              > ...........
              >
              > <container-transaction>
              > <method>
              > <ejb-name>orderMDB</ejb-name>
              > <method-name>*</method-name>
              > </method>
              > <trans-attribute>Required</trans-attribute>
              > </container-transaction>
              > </assembly-descriptor>
              >
              >
              > i think during this transaction,there are two action:geting the object from the
              > queue and saving it to entity bean.in order to test the transaction,i modify the
              > jndi name of entity bean in the code to a WRONG one.redeploy my program,and send
              > a message to the queue,the mdb is activated,then the exception is thrown because
              > of the wrong jndi name.after that,i check the message queue,find that it is empty.why?i
              > think if the second action of the transaction is fail,the transaction should roll
              > back,the message should be send BACK to the queue.
              >
              > i also ty to use the "javax.transaction.UserTransaction" in the onMessage method,but
              > the follwing exception is thrown:
              >
              > javax.transaction.NotSupportedException: Another transaction is associated with
              > this thread.................................
              >
              > who can help me,if any wrong with me,and how to use the transaction with the message
              > driven bean?
              >
              > thank you.
              >
              >
              

  • Message Driven Bean and transaction handling

    We are using container managed transactions with MDB's running on OC4J version 10.1.2. We have two database serveres, both running Oracle 10g.
    The MDB consume messages from the AQ-database through JMS (connected to a JDBC datasource registered as "jdbc/OracleAQDS").
    The MDB onMessage() code update the second database, using a JDBC datasource registered as "jdbc/OracleDBDS".
    We need atomic behaviour - if the MDB enforce a roll-back we want the updates aginst the second database to be rolled-back as well.
    (1) Should we use XA-datasources since AQ and DB runs on two different servers or do the OC4J container "magically" provide two-phase-commit for us?
    (2) If the MDB does a roll-back we would like to add an error record to a database table. Can we configure a third datasource and prevent if from beeing part of the container managed MDB roll-back?
    (3) When the MDB force a roll-back, is there some way for us to override the retry-delay in our Java code? If we catch certain errors during processing in onMessage we know that it is not necessary to retry for at least one hour (while less severe errors should be retried in just seconds).

    {color:#008000}Hi Friends,
    Thought of updating the answers for my questions in case somebody else would find it helpful.
    {color}
    {color:#999999}{color:#00ccff}I'm trying to make message driven bean and use the OnListener method.
    But since I'm doing this for the first time I have very limited knowledge.
    The following are my doubts :
    1. Should I have a main function while using the MDB?{color}
    {color:#008000} There is no need for any main function.{color}
    {color:#00ccff}2. Is it mandatory to have JNDI setup done?
    {color} {color}{color:#008000} There is no need for any JNDI setup done. But you need to configure the details on the
    Websphere by creating valid entries inside Resources namely -
    Queue Connection Factory, Queues and Listener Ports under the server.
    Thanks,
    Arun Prithviraj{color}

  • Can you set isolation levels of message-driven bean transactions?

    The problem: I have 3 different message-driven beans which each get a different type of message, except for a field that is common to all. That field is used as the primary key of an entity object. The message-driven beans configured to use a container managed transaction. Each message-driven bean, in processing the message, first does a lookup by primary key to see if the object associated with the key exists, and if it does not, it requests the entity's home object to create it. After that, they do further processing. The problem is that sometimes all the beans simultaneously get a message, resulting in each bean checking for the entity object at about the same time, and if they fail to find it (because none of them has created it yet), each creates an object, all with the same primary key. This is not caught until the beans start to complete their onMessage method, which I believe results in the container committing the transaction. One of the transactions will be committed successfully, while the other two will fail, get rolled back, and then be retried with the same message. The second time through, the other beans will find the entity object (since it has been created and committed) and they will complete correctly. In the end, they right thing occurs, except that there is a troubling exception or 2 in the log telling about the constraint violation (with the primary key) and the rollback. If it was just me, that would be fine, but our customer does not like to see exceptions in the log; that indicates to him that something is wrong.
    So, I am looking for someway to make sure that the actions of the message-driven beans are serialized. One suggestion from a colleague was to set the isolation level of the transactions being used by the container in processing the message-driven beans' onMessage method. However, the documentation does not mention any way to do this for a message-driven bean. Suggestions?
    Is the use of a UserTransaction a better way to do this? If I acquire a UserTransaction within the onMessage method of a message-driven bean, can I set its isolation level? How would this work? When I get a UserTransaction, does each client get a different transaction, or do they all get the same one?

    (1) The WebLogic JMS "unit-of-order" feature is a heavily adopted feature that was specifically designed to handle similar use cases - see the JMS developer guide for extensive documentation. In your use case, if "key" is used to define UOO, then there's no limit on the number of keys that can be processed concurrently, but messages for any particular key will be processed single-threaded in the order in which they were first submitted.
    Note that if you're using distributed destinations, the UOO feature is still fully supported - but the developer and/or administrator needs to decide whether to configure the destination to use "hash" or "path service" based routing (the JMS UOO edoc outlines the trade-offs).
    (2) Another alternative is to use a single MDB with max-beans-free-pool that processes all three types (as the other poster suggested). I think this assumes all MDBs run on the same JVM.
    (3) Another alternative is to use multiple queues, with a single MDB on each Q. Where some sort of hash algorithm is used to determine which Q is for the key. This approach is a "hand-coded" variant of the approach in (1) with "hash" based routing enabled...
    (4) If all MDBs actually do run in the same JVM, a third alternative is to use code the application to use a common lock to protect each key, eg, something like:
    // assume MyLock is simply a class with a "reference counter"
    // assume some global "staticHM" hash map that is all MDBs can access
    onMessage() {
    MyLock lock = null;
    key= msg.getKey();
    synchronized(staticHM) {
    lock = staticHM.get();
    if (lock = null) {
    lock = new lock();
    staticHM.put(key, new lock());
    lock.incRefCount();
    try {
    synchronized(lock) {
    // only one onMessage will be able to lock a particular key at a time
    do your work;
    } finally {
    synchronized(staticHT) {
    if (lock.defRefCount() == 0) staticHM.remove(lock);
    if (lock = null) staticHM.put(key);
    If multiple threads get a message with the same key, then only one thread at a time will work on the key.
    Hope this helps,
    Tom

  • JBoss message driven bean calling a session bean

    Hi guys, can you please help me? I want my mdb to call my session bean....can you provide me some examples of ejb-jar.xml and jboss.xml with regards to this configuration....thanks...im creating my deployment descriptors manually

    Here is a little example, I hope it will help you.
    ejb-jar.xml
    =============================================
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar >
    <enterprise-beans>
    <!-- Session Beans -->
    <session >
    <display-name>TestSessionEJB</display-name>
    <ejb-name>TestSession</ejb-name>
    <home>mdbtest.interfaces.TestSessionHome</home>
    <remote>mdbtest.interfaces.TestSession</remote>
    <local-home>mdbtest.interfaces.TestSessionLocalHome</local-home>
    <local>mdbtest.interfaces.TestSessionLocal</local>
    <ejb-class>mdbtest.session.TestSessionEJB</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    ... </session>
    <!-- Message Driven Beans -->
    <message-driven >
    <description><![CDATA[]]></description>
    <display-name>TestMessageEJB</display-name>
    <ejb-name>TestMessage</ejb-name>
    <ejb-class>mdbtest.message.TestMessageEJB</ejb-class>
    <transaction-type>Container</transaction-type>
    <message-selector></message-selector>
    <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
    <message-driven-destination>
    <destination-type>javax.jms.Queue</destination-type>
    <subscription-durability>NonDurable</subscription-durability>
    </message-driven-destination>
    <ejb-local-ref >
    <ejb-ref-name>ejb/TestEjb</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local-home>mdbtest.interfaces.TestSessionLocalHome</local-home>
    <local>mdbtest.interfaces.TestSessionLocal</local>
    <ejb-link>TestSession</ejb-link>
    </ejb-local-ref>
    </message-driven>
    </enterprise-beans>
    </ejb-jar>
    jboss.xml:
    =============================================
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
    <jboss>
    <enterprise-beans>
    <session>
    <ejb-name>TestSession</ejb-name>
    <jndi-name>ejb/MdbTest/TestSession</jndi-name>
    <local-jndi-name>TestSessionLocal</local-jndi-name>
    <configuration-name>Standard Stateless SessionBean</configuration-name>
    </session>
    <message-driven>
    <ejb-name>TestMessage</ejb-name>
    <destination-jndi-name>queue/MyTestQueue</destination-jndi-name>
    <configuration-name>Standard Message Driven Bean</configuration-name>
    </message-driven>
    </enterprise-beans>
    <resource-managers>
    </resource-managers>
    </jboss>

Maybe you are looking for