Distributed transactions with container-managed MDBs

          I have built a framework that employs a high rate of code reuse while abstracting
          the complexities of inter-application communication. This allows application
          developers to focus on solving their business needs and not worry about "the plumbing"
          between the applications.
          At this point, the framework is using container-managed MDBs for Topic destinations.
          MDBs were chosen because of their concurrent nature for processing JMS messages.
          Now that I have this framework up and running, I am trying to add distributed
          transaction support and am having trouble understanding what I need to do. Here
          is how the framework works:
          The MDB will recieve a message, unmarshall it into a business object, and then
          route that object to the appropriate business class where it is then processed
          accordingly. In most cases, the processing of this message object will require
          database interaction. If any error should occur while processing the message,
          all XAResources within the transaction should rollback and ultimately, the JMS
          message will be redelivered later.
          Here is what I'm trying to find out:
          1. When control is passed to an application and it gets a DB connection, will
          that DB resource be dynamically enlisted with the transaction?
          2. Must the DB connection come from the WLS DB pool to be enlisted with the transaction?
          I ask this because the current standard at this company is to use a home-grown
          DB connection pool for getting DB connections. This is due to the fact that not
          all applications here run in a WLS environment and they wanted a standard way
          of retrieving a DB connection across applications. They also sited problems with
          WLS 4.5.1 connection pool.
          3. The documentation states that only one database may be involved in a transaction.
          If a connection to another database is required, but not needed in the current
          transaction, will WLS ignore enlisting the 2nd DB resource, or throw an exception?
          4. Where can I find <B>detailed</B> information about this subject? Everything
          that I have read so far has barely scratched the surface for this specific topic.
          Thanks,
          Bob.
          

          Hi Bob,
          If you are using WLS's XA connection pool, then the XAResource associated with
          the XA connections are enlisted with the transaction transparently for you. Enlistments
          actually occur not at getConnection, but on demand when the JDBC objects are actually
          used.
          If you are not using WLS connection pools, then you would need to enlist the XAResource
          associated with the XA connections yourself. You can obtain the transaction associated
          with the current thread by calling weblogic.transaction.TxHelper.getTransaction(),
          and then call enlistResource on the transaction.
          Weblogic has provisions that allow one (and only one) non-XA connection pool to
          participate in a distributed transaction. In this case, you will get a SQLException
          when you try to obtain a connection from a second connection pool in the same
          distributed transaction. However, if you are using real XA connection pools,
          there is no limitation and any number of XA connection pools can participate in
          the same distributed transaction.
          We will try to incorporate more info in our online docs in the future.
          -- Priscilla Fung, BEA Systems, Inc.
          "Bob Peroutka" <[email protected]> wrote:
          >
          >I have built a framework that employs a high rate of code reuse while
          >abstracting
          >the complexities of inter-application communication. This allows application
          >developers to focus on solving their business needs and not worry about
          >"the plumbing"
          >between the applications.
          >
          >At this point, the framework is using container-managed MDBs for Topic
          >destinations.
          > MDBs were chosen because of their concurrent nature for processing JMS
          >messages.
          >
          >Now that I have this framework up and running, I am trying to add distributed
          >transaction support and am having trouble understanding what I need to
          >do. Here
          >is how the framework works:
          >
          >The MDB will recieve a message, unmarshall it into a business object,
          >and then
          >route that object to the appropriate business class where it is then
          >processed
          >accordingly. In most cases, the processing of this message object will
          >require
          >database interaction. If any error should occur while processing the
          >message,
          >all XAResources within the transaction should rollback and ultimately,
          >the JMS
          >message will be redelivered later.
          >
          >Here is what I'm trying to find out:
          >
          >1. When control is passed to an application and it gets a DB connection,
          >will
          >that DB resource be dynamically enlisted with the transaction?
          >
          >2. Must the DB connection come from the WLS DB pool to be enlisted with
          >the transaction?
          >
          >I ask this because the current standard at this company is to use a home-grown
          >DB connection pool for getting DB connections. This is due to the fact
          >that not
          >all applications here run in a WLS environment and they wanted a standard
          >way
          >of retrieving a DB connection across applications. They also sited problems
          >with
          >WLS 4.5.1 connection pool.
          >
          >3. The documentation states that only one database may be involved in
          >a transaction.
          > If a connection to another database is required, but not needed in the
          >current
          >transaction, will WLS ignore enlisting the 2nd DB resource, or throw
          >an exception?
          >
          >4. Where can I find <B>detailed</B> information about this subject?
          > Everything
          >that I have read so far has barely scratched the surface for this specific
          >topic.
          >
          >Thanks,
          >
          >Bob.
          

Similar Messages

  • SetRollbackOnly doesn't work on Container Managed MDB

    I have a Container Managed Message Driven Bean + an AQ Queue.
    In my onMessage, I call the messageContext.setRollbackOnly() but my message is removed from the queue!
    Is it the expected behavior??? It seems that there is a problem with the transactions (for container managed bean)!
    I am using oc4j 9.0.3 build 020725.1695 and oracle db 9.0.1.3 with the patch 2416054.
    Here is ejb-jar.xml :
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">
    <ejb-jar>
    <enterprise-beans>
    <message-driven>
         <ejb-name>test</ejb-name>
         <ejb-class>myPackage.MyMdb</ejb-class>
         <transaction-type>Container</transaction-type>
         <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
         <message-driven-destination>
              <destination-type>javax.jms.Queue</destination-type>
         </message-driven-destination>
    </message-driven>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>test</ejb-name>
    <method-name>onMessage</method-name>
    </method>
    <trans-attribute>RequiresNew</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    Laurent Lopez

    Laurent -- You cannot use "RequiresNew" as the trans-attribute for your MDB. You would use "Required". Here is an excerpt from section 15.4.7 of the EJB 2.0 spec.
    The onMessage method is invoked in the scope of a transaction determined by the transaction
    attribute specified in the deployment descriptor. If the bean is specified as using container-managed
    transaction demarcation, either the Required or the NotSupported transaction attribute must be
    used.[26]
    When a message-driven bean using bean-managed transaction demarcation uses the javax.transaction.
    UserTransaction interface to demarcate transactions, the message receipt that causes
    the bean to be invoked is not part of the transaction. If the message receipt is to be part of the transaction,
    container-managed transaction demarcation with the Required transaction attribute must be
    used.
    Thanks -- Jeff

  • Get error from SQL AGENT: The SSIS Runtime has failed to enlist the OLE DB connection in a distributed transaction with error 0x8004D024

    I am running SQL Agent that executes an SSIS process from sql server1. The SSIS process executes its SQL/tables/sp’s  against another sql server2.
    I get an error after adding data flow tasks with transaction supported within a sequence with transaction required. The error, “The SSIS Runtime has failed to enlist the OLE DB connection in a distributed transaction with error 0x8004D024 "The transaction
    manager has disabled its support for remote/network transactions"
    Prior to adding this sequence everything was working from sql agent, and there were other sequences with oledb destinations.
    Everything works when running within SSIS Package.
    I see this article on similar issue,
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/0bfa2569-8849-4884-8f68-8edf98a9b4fe/problem-to-execute-a-package-and-tasks-with-a-certain-transactionoption-property-i-need-help?forum=sqlintegrationservices
    “I had similar issue and solved by setting the following on both the machines. Allow Remote Clients, Allow Remote Administration,
    Allow Inbound Clients, Allow Outbound Clients, and TIP are enabled in Component Services/My Computer/Properties/MSDTC/Security Configuration.”
    I don’t want to remove transaction required for the “Remove Duplicates from Staging” sequence.
    Anyone seen this?
    Greg Hanson

    DTC was running on remote computer. The problem was it was no longer accepting transactions from remote servers. This was in SSIS so I had to turn to "Transaction Supported" for all Data Flow Transactions.
    Greg Hanson

  • Using Distributed Transaction with oracle 9i and VB

    How to I get distributed transaction to work between a COM + object in VB and oracle using MSDAORA.1 driver? I keep getting the following error:
    error number:
    -2147168229
    error description:
    Cannot connect to the transaction manager or the transaction manager is unavailable.

    Oracle 9i works great with VB.NET. I would recommend you to use Oracle Data Provider .NET (ODP.NET) as a database driver
    http://otn.oracle.com/tech/windows/odpnet/content.html
    for better performance and get full advantage of Oracle 9i features.
    Regards
    Jagriti
    OTN Team @IDC

  • Error in Distributed transactions with tx data source

              Hi, I need to write into two DB2 databases using two container managed entity beans
              from a container managed session bean. I use a JDBC 3.0 compatible JDBC driver
              and I have configured tx data source. When I run the session bean it gives me
              following exception.
              java.rmi.RemoteException: EJB Exception: ; nested exception is: javax.ejb.EJBException:
              EJB Exception:; nested exception is: java.sql.SQLException: Connection has already
              been created in this tx context for pool named DB2ConnectionPool2. Illegal attempt
              to create connection from another pool: DB2ConnectionPool1
              thank you Lahiru
              

              For a connection pool with xa-drivers, create a tx datasource and select 'Honor
              Global Transactions'. For a connection pool with non-xa drivers, create a tx datasource,
              select 'Honor Global transactions', and select 'Enable Two-phase commit'.
              "Lahiru Karunatilake" <[email protected]> wrote:
              >
              >Hi, I need to write into two DB2 databases using two container managed
              >entity beans
              >from a container managed session bean. I use a JDBC 3.0 compatible JDBC
              >driver
              >and I have configured tx data source. When I run the session bean it
              >gives me
              >following exception.
              >
              >java.rmi.RemoteException: EJB Exception: ; nested exception is: javax.ejb.EJBException:
              >EJB Exception:; nested exception is: java.sql.SQLException: Connection
              >has already
              >been created in this tx context for pool named DB2ConnectionPool2. Illegal
              >attempt
              >to create connection from another pool: DB2ConnectionPool1
              >
              >thank you Lahiru
              >
              

  • Distributed Transaction with MSSQServer7.0

    Hi,
              I'm trying to implement Distributed transaction using inet optima driver(XA
              compliant driver based on JDBC2.0) with MSSQL7.0 in weblogic6.0
              environment.I'm getting the following error.
              XA error: XAER_RMERR : A resource manager error has occured in the
              transaction branch start() failed on resource 'metadata' Internal error
              during start for XAResource 'metadata'
              Any help on fixing this is greatly appreciated.
              Thank You
              Kannan
              

              Hi Kannan,
              Did the XA connection pool start up successfully? (e.g. did you see messages like "<Connection for XA pool "xxx" created.>" in the server log?) Could you describe briefly what you are doing, and post the full stack trace and any relevant code snippet, config.xml etc?
              -- Priscilla Fung, BEA Systems, Inc.
              "kannan" <[email protected]> wrote:
              >Hi,
              >
              >I'm trying to implement Distributed transaction using inet optima driver(XA
              >compliant driver based on JDBC2.0) with MSSQL7.0 in weblogic6.0
              >environment.I'm getting the following error.
              >
              >XA error: XAER_RMERR : A resource manager error has occured in the
              >transaction branch start() failed on resource 'metadata' Internal error
              >during start for XAResource 'metadata'
              >
              >Any help on fixing this is greatly appreciated.
              >
              >Thank You
              >
              >Kannan
              >
              >
              >
              

  • EJB 3.0 Security with ACEGI and not with Container Managed Security

    Hi,
         Currently we are using EJB 2.0 in our project, We want to use EJB 3.0
         But for security we want to use Spring ACEGI Security and we don�t want to use container managed security (No Portability, Difficult, �)
         ACEGI supports Servlet/JSP security very well (I am able to call isUserInRole(), getUserPrincipal() because ACEGI implements by ServletRequestWrapper in a filter)
         But for EJB, it lacks this feature. (There is no standard EJB interceptor API as there is with servlets (using filters), so there's no generic way of modify in the EJB context for the invocation)
         Without using container managed security, Is there any way to propogate my security context from Servlet Layer to EJB Layer, So that I can use EJB Declartive security and getCallerPrincipal(), isCallerInRole() API.
         For more info please see this thread http://forum.springframework.org/showthread.php?t=26514
         Why don�t you provide standard EJB interceptor API as there is with servlets (using filters), so there I am able add security identity to EJB context.
         I am eagerly waiting for the reply

    Reason: javax.naming.NameNotFoundException: jdbc not bound
    Although i am quite new to this as well i would say that there is a problem with your connection with the database.
    It seems it cannot connect to Mysql.
    have you download the mysql package library and imported it ?
    Also in your deploy folder in you Jboss
    have you altered the jdbc to connect to you database in your dataset ? ( i am not sure about mysql, but postgre reguired this)
    Most probably it would be the same in mysql.
    <connection-url>jdbc:postgresql://127.0.0.1:5432/Dissertation</connection-url>
    Not sure if this is what you reguire, i am new at this my self

  • Session creation with container managed security

    I implemented container managed security, first question does the container creates session automatically when login is successful ?
    second is there a way to do some processing when a user is authenticated like some event gets fired and listeners are called ?

    You have to enclose input component into an <h:form></h:form>.
    Note that the various Form components available in JSF will not let you specify the target action, everything is a post-back.
    I suggest you this article: [J2EE Security - A JSF based Login Form|http://groundside.com/blog/DuncanMills.php?title=j2ee_security_a_jsf_based_login_form&more=1&c=1&tb=1&pb=1]
    [Is This User Logged In?|http://mowyourlawn.com/blog/?p=6]

  • Transaction in container managed environment

    I am mulitiple DAO methods to insert/update into the different tables of the same database.Every time,in each DAO method ,I am taking a connection from wsad connection pool(no XAdatasource) and returning it back to the pool at end of the method.Now,I want to enforce a transaction (CMP) made up of all these dao database update methods.So,container will automatically take care of the commit or rollback operation.Will using a single connection object across all the methods solve the purpose?Is their any other way to do it?

    Call all the DAO methods from a single session bean method, this will run all the update methods under a transaction. but here forget about the number of times u may have look up for the connections. but ur transaction is managed by the container.

  • Distributed transaction (JDBC+JMS), durable MDB, NullPointException in weblogic

              I am cross posting to transaction & jms, sorry if this is a mistake...
              We have a setup where JMS messages are published to a topic. The posting is transacted
              (XA) and is a consequence of a CMP update so JMS and JDBC (Oracle OCI) cooperate
              to commit, or not.
              Most of the time, transactions issue just a few JMS messages but at least once
              a day, we issue hundred of thousands of such messages (max has been about 600000
              but typically 300000).
              Our setup is four instances of Weblogic 6.1SP3 (two clustered, two not), the topic
              is on one of them (all 3 other servers connect to that instance to publish) and
              we have a couple MDBs deployed only on the instance that has the JMSServer and
              they all listen to the local topic. The transactionnal settings of these MDBs
              is CMT and XA (because the beans will write to the DB). Furthermore, these MDB
              have been setup to be durable. One of these is just a logger MDB with 20 instances
              max.
              It worked fine for a couple weeks but we have been running into problems for the
              past two days. All of a sudden, the server no longer responds to weblogic.ADMIN
              PING. The server log indicates the following error repetitively (MB of logs just
              of this)
              ####<13 nov. 03 23:15:41 CET> <Alert> <JMS> <XXXXXXX> <send1> <ExecuteThread:
              '32' for queue: 'default'> <> <> <040060> <JMSServer "OutputServerSend1", unhandled
              exception during rollback, java.lang.NullPointerException.>
              java.lang.NullPointerException
              at weblogic.jms.backend.BEDurableTopicMessageInfo.rollbackReceiveTran(BEDurableTopicMessageInfo.java:352)
              at weblogic.jms.backend.BEXATranEntrySubscribe.startRollback(BEXATranEntrySubscribe.java:145)
              at weblogic.jms.backend.BEXATranEntry.execute(BEXATranEntry.java:127)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              The logger MDB seems to have started processing the JMS messages. This means that
              the transaction that included the JMS message publishing must have commited. Unfortunatly,
              there are only 20 log lines before the server restart, so the server must have
              hanged although it did commit the messages processed by the logger since the log
              messages are apparently not repeated. I have no idea why. I think this is coherant
              with the fact that exception above seems to relate to subscribers.
              When we restart the server, the topic gets purged and seem to be processed (we
              have not found a way to verify that each message has been processed but it's looking
              good)
              Any ideas ?
              Thanks
              Philippe
              

              I am cross posting to transaction & jms, sorry if this is a mistake...
              We have a setup where JMS messages are published to a topic. The posting is transacted
              (XA) and is a consequence of a CMP update so JMS and JDBC (Oracle OCI) cooperate
              to commit, or not.
              Most of the time, transactions issue just a few JMS messages but at least once
              a day, we issue hundred of thousands of such messages (max has been about 600000
              but typically 300000).
              Our setup is four instances of Weblogic 6.1SP3 (two clustered, two not), the topic
              is on one of them (all 3 other servers connect to that instance to publish) and
              we have a couple MDBs deployed only on the instance that has the JMSServer and
              they all listen to the local topic. The transactionnal settings of these MDBs
              is CMT and XA (because the beans will write to the DB). Furthermore, these MDB
              have been setup to be durable. One of these is just a logger MDB with 20 instances
              max.
              It worked fine for a couple weeks but we have been running into problems for the
              past two days. All of a sudden, the server no longer responds to weblogic.ADMIN
              PING. The server log indicates the following error repetitively (MB of logs just
              of this)
              ####<13 nov. 03 23:15:41 CET> <Alert> <JMS> <XXXXXXX> <send1> <ExecuteThread:
              '32' for queue: 'default'> <> <> <040060> <JMSServer "OutputServerSend1", unhandled
              exception during rollback, java.lang.NullPointerException.>
              java.lang.NullPointerException
              at weblogic.jms.backend.BEDurableTopicMessageInfo.rollbackReceiveTran(BEDurableTopicMessageInfo.java:352)
              at weblogic.jms.backend.BEXATranEntrySubscribe.startRollback(BEXATranEntrySubscribe.java:145)
              at weblogic.jms.backend.BEXATranEntry.execute(BEXATranEntry.java:127)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              The logger MDB seems to have started processing the JMS messages. This means that
              the transaction that included the JMS message publishing must have commited. Unfortunatly,
              there are only 20 log lines before the server restart, so the server must have
              hanged although it did commit the messages processed by the logger since the log
              messages are apparently not repeated. I have no idea why. I think this is coherant
              with the fact that exception above seems to relate to subscribers.
              When we restart the server, the topic gets purged and seem to be processed (we
              have not found a way to verify that each message has been processed but it's looking
              good)
              Any ideas ?
              Thanks
              Philippe
              

  • Problem in Distributed transaction with Oracle 8.1.7 and Weblogic 7.0

              Hi,
              I am using two unmanaged weblogic 7.0 servers and oracle 8.1.7 enterprise edition.
              I am using oracle.jdbc.xa.client.OracleXADataSource for creating connection pool
              in weblogic. The pool gets created fine but when connection it is getting used
              it throws up following error.
              java.sql.SQLException: ORA-02044: transaction manager login denied: transaction
              in progress
              ORA-06512: at "SYS.JAVA_XA", line 0
              ORA-06512: at line 1
              at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
              at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
              at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
              at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
              at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
              at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
              at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
              at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1900)
              at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
              at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:407)
              at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:171)
              at weblogic.jdbc.jta.VendorXAResource.start(VendorXAResource.java:41)
              at weblogic.jdbc.jta.DataSource.start(DataSource.java:569)
              I don't know what is causing this problem.Please send me the pointers.
              Regards,
              Vikash
              

    ID is a NUMBER and id.toString() is not a number, for
    example it ca be a null reference.
    well we tryed also this version :
    ps.setLong(1, id.longValue());
    moreover the exception wasn't thrown for the value of id :56 but was thrown for the value of id : 88. Hence I think it is a case of something other than my code.
    michal

  • Distributed Transaction with EJB 3.0 / JPA

    I did some testing here and it proved to work. I would like someone to tell me if this is really true.
    I have many Stateless Session Bean and Entity Beans, using EJB 3.0 with JPA. The Persistence Unit is configured using JTA transaction type. Some of them are deployed in different app server instances.
    Consider an EJB "A" executing EJBs "B" and "C", both in different containers (remote).
    Both B and C use EntityManager to save data into the database.
    Let�s say "A"�s method doit() first execute "B" succesfully and when executing "C", it fails. Will the whole transaction be rolledback?
    The scenarios I tried it proved to work. But I want a second opinion.
    Thanks
    ps: I was using OracelAS/OC4J

    yes, that is how transactions are supposed to work across app servers. granted, that is assuming that the secondary methods are all using the "REQUIRED" (the default if unspecified) or "SUPPORTS" transaction types. you can change this by using some of the other transaction types, depending on what relationship you want between the various methods.

  • MDB container managed transaction demarcation not working in wls 6.1 beta

    I have an MDB which sends the messages it receives onto another JMS
              destination within the onMessage method. These messages are not sent to
              the JMS destination unless I explicitly use a transacted session for the
              destination and subsequently commit the session. If I set the transacted
              parameter to Session as false the messages are sent. If I set the
              transacted parameter to true the messages will only be output if the
              session is committed. This is the standard behaviour for a JMS session
              but this is not the correct behaviour for an MDB running with
              container-managed transaction demarcation.
              For a start the transacted parameter to session should be ignored when
              run in the context of a container transaction and the commit method
              should thrown an exception as it is not allowed within the context of a
              container transaction.
              This is the MDB code and the deployment descriptor: -
              public class MessageBean implements MessageDrivenBean, MessageListener
              private String topicName = null;
              private TopicConnectionFactory topicConnectionFactory = null;
              private TopicConnection topicConnection = null;
              private TopicSession topicSession = null;
              private Topic topic = null;
              private TopicPublisher topicPublisher = null;
              private TextMessage textMessage=null;
              private transient MessageDrivenContext messageDrivenContext = null;
              private Context jndiContext;
              public final static String
              JMS_FACTORY="weblogic.examples.jms.TopicConnectionFactory";
              public final static String
              TOPIC="weblogic.examples.jms.exampleTopic";
              public MessageBean()
              public void setMessageDrivenContext(MessageDrivenContext
              messageDrivenContext)
              this.messageDrivenContext = messageDrivenContext;
              public void ejbCreate()
              public void onMessage(Message inMessage)
              try
              jndiContext = new InitialContext();
              topicConnectionFactory =
              (TopicConnectionFactory)jndiContext.lookup(JMS_FACTORY);
              topic = (Topic) jndiContext.lookup(TOPIC);
              topicConnection =
              topicConnectionFactory.createTopicConnection();
              topicConnection.start();
              // The transacted parameter should be ignored in the context of a
              container tx
              topicSession = topicConnection.createTopicSession(true,
              Session.AUTO_ACKNOWLEDGE);
              topicPublisher = topicSession.createPublisher(topic);
              textMessage = (TextMessage)inMessage;
              topicPublisher.publish(inMessage);
              // this is illegal in a container transaction
              topicSession.commit();
              topicConnection.close();
              catch (JMSException je)
              throw new EJBException(je);
              catch (NamingException ne)
              throw new EJBException(ne);
              public void ejbRemove()
              <?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>
              <display-name>MessageBean</display-name>
              <ejb-name>MessageBean</ejb-name>
              <ejb-class>MessageBean</ejb-class>
              <transaction-type>Container</transaction-type>
              <message-driven-destination>
              <destination-type>javax.jms.Queue</destination-type>
              </message-driven-destination>
              <security-identity>
              <description></description>
              <run-as>
              <description></description>
              <role-name></role-name>
              </run-as>
              </security-identity>
              </message-driven>
              </enterprise-beans>
              <assembly-descriptor>
              <container-transaction>
              <method>
              <ejb-name>MessageBean</ejb-name>
              <method-name>*</method-name>
              </method>
              <trans-attribute>Required</trans-attribute>
              </container-transaction>
              </assembly-descriptor>
              </ejb-jar>
              

    Please see the response in the EJB newsgroup.
              Also, could you kindly only post to a single newsgroup?
              Thanks.
              "Jimmy Johns" <[email protected]> wrote in message
              news:[email protected]...
              > I have an MDB which sends the messages it receives onto another JMS
              > destination within the onMessage method. These messages are not sent to
              > the JMS destination unless I explicitly use a transacted session for the
              >
              > destination and subsequently commit the session. If I set the transacted
              >
              > parameter to Session as false the messages are sent. If I set the
              > transacted parameter to true the messages will only be output if the
              > session is committed. This is the standard behaviour for a JMS session
              > but this is not the correct behaviour for an MDB running with
              > container-managed transaction demarcation.
              >
              > For a start the transacted parameter to session should be ignored when
              > run in the context of a container transaction and the commit method
              > should thrown an exception as it is not allowed within the context of a
              > container transaction.
              >
              > This is the MDB code and the deployment descriptor: -
              >
              > public class MessageBean implements MessageDrivenBean, MessageListener
              > {
              > private String topicName = null;
              > private TopicConnectionFactory topicConnectionFactory = null;
              > private TopicConnection topicConnection = null;
              > private TopicSession topicSession = null;
              > private Topic topic = null;
              > private TopicPublisher topicPublisher = null;
              > private TextMessage textMessage=null;
              > private transient MessageDrivenContext messageDrivenContext = null;
              >
              > private Context jndiContext;
              >
              > public final static String
              > JMS_FACTORY="weblogic.examples.jms.TopicConnectionFactory";
              > public final static String
              > TOPIC="weblogic.examples.jms.exampleTopic";
              >
              > public MessageBean()
              > {
              > }
              >
              > public void setMessageDrivenContext(MessageDrivenContext
              > messageDrivenContext)
              > {
              > this.messageDrivenContext = messageDrivenContext;
              > }
              >
              > public void ejbCreate()
              > {
              > }
              >
              > public void onMessage(Message inMessage)
              > {
              > try
              > {
              > jndiContext = new InitialContext();
              > topicConnectionFactory =
              > (TopicConnectionFactory)jndiContext.lookup(JMS_FACTORY);
              > topic = (Topic) jndiContext.lookup(TOPIC);
              > topicConnection =
              > topicConnectionFactory.createTopicConnection();
              > topicConnection.start();
              > // The transacted parameter should be ignored in the context of a
              > container tx
              > topicSession = topicConnection.createTopicSession(true,
              > Session.AUTO_ACKNOWLEDGE);
              > topicPublisher = topicSession.createPublisher(topic);
              > textMessage = (TextMessage)inMessage;
              > topicPublisher.publish(inMessage);
              > // this is illegal in a container transaction
              > topicSession.commit();
              > topicConnection.close();
              > }
              > catch (JMSException je)
              > {
              > throw new EJBException(je);
              > }
              > catch (NamingException ne)
              > {
              > throw new EJBException(ne);
              > }
              > }
              >
              > public void ejbRemove()
              > {
              > }
              > }
              >
              >
              >
              >
              > <?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>
              > <display-name>MessageBean</display-name>
              > <ejb-name>MessageBean</ejb-name>
              > <ejb-class>MessageBean</ejb-class>
              > <transaction-type>Container</transaction-type>
              > <message-driven-destination>
              > <destination-type>javax.jms.Queue</destination-type>
              > </message-driven-destination>
              > <security-identity>
              > <description></description>
              > <run-as>
              > <description></description>
              > <role-name></role-name>
              > </run-as>
              > </security-identity>
              > </message-driven>
              > </enterprise-beans>
              > <assembly-descriptor>
              > <container-transaction>
              > <method>
              > <ejb-name>MessageBean</ejb-name>
              > <method-name>*</method-name>
              > </method>
              > <trans-attribute>Required</trans-attribute>
              > </container-transaction>
              > </assembly-descriptor>
              > </ejb-jar>
              >
              >
              >
              >
              >
              >
              >
              >
              

  • Does Oracle 8.1.5 with weblogic 6.1 sp2 suppports Distributed Transactions ---A really night Mare

              Which version of jdbc thin driver should i use to achieve distributed transaction
              with oracle 8.1.5 in weblogic 6.1 sp2
              right now if iam using the driver classes provided in weblogic.jar iam gettig the
              following Exception
              AccountBean.ejbCreate( id = accountId, initial balance = $ 3000.0)
              java.sql.SQLException: XA error: XAER_RMERR : A resource manager error has occured
              in the transaction branch start(
              ) failed on resource 'OracleXAPool' Unexpected error during start for XAResource
              'OracleXAPool': null
              at weblogic.jdbc.jta.DataSource.enlist(DataSource.java:1044)
              at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1010)
              at weblogic.jdbc.jta.Connection.getXAConn(Connection.java:148)
              at weblogic.jdbc.jta.Connection.prepareStatement(Connection.java:226)
              at weblogic.jdbc.rmi.internal.ConnectionImpl.prepareStatement(ConnectionImpl.java:135)
              at weblogic.jdbc.rmi.SerialConnection.prepareStatement(SerialConnection.java:76)
              at examples.ejb.basic.beanManaged.AccountBean.ejbCreate(Unknown Source)
              at examples.ejb.basic.beanManaged.AccountBean_g1748h_Impl.ejbCreate(AccountBean_g1748h_Impl.java:172)
              at java.lang.reflect.Method.invoke(Native Method)
              at weblogic.ejb20.manager.DBManager.create(DBManager.java:492)
              at weblogic.ejb20.manager.DBManager.remoteCreate(DBManager.java:462)
              at weblogic.ejb20.internal.EntityEJBHome.create(EntityEJBHome.java:190)
              at examples.ejb.basic.beanManaged.AccountBean_g1748h_HomeImpl.create(AccountBean_g1748h_HomeImpl.java:76)
              at examples.ejb.basic.beanManaged.AccountBean_g1748h_HomeImpl_WLSkel.invoke(Unknown
              Source)
              at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:288)
              at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:93)
              at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:257)
              at weblogic.rmi.internal.BasicServerRef.dispatch(BasicServerRef.java:158)
              at weblogic.rmi.internal.ServerRequest.sendOneWayRaw(ServerRequest.java:92)
              at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:112)
              at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:253)
              at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:220)
              at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:35)
              at $Proxy126.create(Unknown Source)
              at examples.wtc.atmi.simpapp.ToupperBean.putMessage(ToupperBean.java:194)
              at examples.wtc.atmi.simpapp.ToupperBean_8roqg7_EOImpl.putMessage(ToupperBean_8roqg7_EOImpl.java:284)
              at examples.wtc.atmi.simpapp.ToupperBean_8roqg7_EOImpl_WLSkel.invoke(Unknown
              Source)
              at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:288)
              at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:257)
              at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              Regards
              Ranga Rao
              

              Oracle Server 8.1.5 does not provide support for 2PC.
              Full XA support is provided from version 8.1.7.
              Sergi
              "Lawrence" <[email protected]> wrote:
              >
              >Ranga,
              >Please use classes12.zip for this.If you still find problem, please let
              >me know.
              >Thanks
              >Lawrence
              >
              >"Ranga Rao" <[email protected]> wrote:
              >>
              >>
              >>Which version of jdbc thin driver should i use to achieve distributed transaction
              >>with oracle 8.1.5 in weblogic 6.1 sp2
              >>
              >>right now if iam using the driver classes provided in weblogic.jar iam
              >gettig
              >>the
              >>following Exception
              >>
              >>////////////////////////////////////////////////////////////////////////////////////////////
              >>AccountBean.ejbCreate( id = accountId, initial balance = $ 3000.0)
              >>java.sql.SQLException: XA error: XAER_RMERR : A resource manager error
              >has
              >>occured
              >>in the transaction branch start(
              >>) failed on resource 'OracleXAPool' Unexpected error during start for XAResource
              >>'OracleXAPool': null
              >> at weblogic.jdbc.jta.DataSource.enlist(DataSource.java:1044)
              >> at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1010)
              >> at weblogic.jdbc.jta.Connection.getXAConn(Connection.java:148)
              >> at weblogic.jdbc.jta.Connection.prepareStatement(Connection.java:226)
              >> at weblogic.jdbc.rmi.internal.ConnectionImpl.prepareStatement(ConnectionImpl.java:135)
              >> at weblogic.jdbc.rmi.SerialConnection.prepareStatement(SerialConnection.java:76)
              >> at examples.ejb.basic.beanManaged.AccountBean.ejbCreate(Unknown
              >>Source)
              >> at examples.ejb.basic.beanManaged.AccountBean_g1748h_Impl.ejbCreate(AccountBean_g1748h_Impl.java:172)
              >> at java.lang.reflect.Method.invoke(Native Method)
              >> at weblogic.ejb20.manager.DBManager.create(DBManager.java:492)
              >> at weblogic.ejb20.manager.DBManager.remoteCreate(DBManager.java:462)
              >> at weblogic.ejb20.internal.EntityEJBHome.create(EntityEJBHome.java:190)
              >> at examples.ejb.basic.beanManaged.AccountBean_g1748h_HomeImpl.create(AccountBean_g1748h_HomeImpl.java:76)
              >> at examples.ejb.basic.beanManaged.AccountBean_g1748h_HomeImpl_WLSkel.invoke(Unknown
              >>Source)
              >> at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:288)
              >> at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:93)
              >> at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:257)
              >> at weblogic.rmi.internal.BasicServerRef.dispatch(BasicServerRef.java:158)
              >> at weblogic.rmi.internal.ServerRequest.sendOneWayRaw(ServerRequest.java:92)
              >> at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:112)
              >> at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:253)
              >> at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:220)
              >> at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:35)
              >> at $Proxy126.create(Unknown Source)
              >> at examples.wtc.atmi.simpapp.ToupperBean.putMessage(ToupperBean.java:194)
              >> at examples.wtc.atmi.simpapp.ToupperBean_8roqg7_EOImpl.putMessage(ToupperBean_8roqg7_EOImpl.java:284)
              >> at examples.wtc.atmi.simpapp.ToupperBean_8roqg7_EOImpl_WLSkel.invoke(Unknown
              >>Source)
              >> at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:288)
              >> at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:257)
              >> at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
              >> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              >> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              >>/////////////////////////////////////////////////////////////////////////////////
              >>
              >>Regards
              >>Ranga Rao
              >>
              >>
              >
              

  • Container-managed / bean-managed transaction demarcation

    I am trying to make sure I understand container-managed and bean-managed transaction demarcation and in particular where you have one bean calling another bean. What happens where one of the beans has container-managed transaction demarcation and the other bean-managed transaction demarcation. In fact the initial question to ask is, is this allowed?
    Lets use an application scenario to illustrate the issue. The application has a payment transaction. Payments can be received in one of two ways:
    1. As a payment at a branch where the individual payment is processed on a client application and resulting in the processing of a single payment transaction.
    2. As a batch of payments received from a bank containing, potentially, thousands of payment transactions.
    The proposed implementation for this uses two session beans. The first is a Payment session bean that implements the business logic as appropriate calling entity beans to persist the change. The second is a BatchPayment session bean. This processes the batch of payment transactions received from the bank. The BatchPayment reads through the batch of payments from a bank calling the Payment session bean for each payment transaction.
    Lets look at the transactional properties of both session beans. In order to support the client application the Payment session bean can implicitly enforce transactional integrity and is therefore set to container-managed transaction demarcation. However the BatchPayment session bean will want to explicitly specify transaction demarcation for performance reasons. The transactional "commit" process is relatively expensive. When processing a large batch of transactions rather than performing a commit after every transaction is processed we want to perform the commit after a number of transactions have been processed. For example, we may decide that after every 100 transactions have been processed we commit. The processing will have a shorter elapsed time as we have not had to perform 99 commit processes. So the BatchPayment session bean will want to explicitly specify its transaction demarcation and will therefore be defined with bean-managed transaction demarcation.
    How would this be implemented? A possible solution is:
    Payment session bean implemented with container-managed transaction demarcation with transaction scope set to Required.
    BatchPayment session bean implemented with bean-managed transaction demarcation with transaction scope set to Required.
    When the client application is run it calls the Payment bean and the container-managed transaction demarcation ensures the transactional integrity of that transaction.
    When a BatchPayment process is run it explicitly determines the transaction demarcation. Lets say that after every 100 Payment transactions (through 100 calls to the Payment session bean) have been processed the BatchPayment bean issues a commit. In this scenario however we have mixed container-managed and bean-managed transaction demarcation. Hence my original question. Can container-managed and bean-managed transaction demarcation be mixed? If not how is it possible to implement the requirements as described above?
    Thanks for any thoughts.
    Paul

    BatchPayment session bean implemented with bean-managed transaction demarcation with transaction scope set to Required.Didn't quite understand this sentence.... if it's BMT it has no declarative transaction attributes such as "Required"....
    Anyway, first of all I'll have to ask, Why at all would you want to commit in the middle of the business method? to get as much through as possible before a potential crash? :-)
    Can container-managed and bean-managed transaction demarcation be mixed?Yes, of course. Just remember that the "direction" you are refering to ->
    a BMT SB that propagates it's transaction to a method in a CMT SB that is demarcated with "Required" is the simplest case. If it were "reversed", or for that matter any BMT that might be called within an active transaction context must perform logic to manipulate the transaction state. For instance(and most common case), checking to see if a transaction is active and if so not to do anything(just use the one that is already active).
    If not how is it possible to implement the requirements as described above?You could also implement this scenario with CMTs all the way through. your BatchPayment SB could consist of two methods, one (say, execute(Collection paymentsToExecute) ) with "Supports", and another(say executeBatchUnit(Collection paymentsToExecute, int beginIndex, int endIndex) ) with "RequiresNew".
    then have the first just call the other with indexes denoting each time a group of payments.
    Still, it does seem more suitable using BMT for these kind of things.....
    Hope this helped....

Maybe you are looking for

  • How do I to fix 2 Console reported errors in Mac OS 10.4.11

    When I start up my old G4 with OS 10.4.11, its Console reports 2 errors, as shown on the screen shot below There are many "plists", so I do not know which one needs correcting. In my System I located  "/en" here: "~System/Library/Frameworks/Foundatio

  • LZW Patent expired 2 years ago.  Why no JAI Support?

    The Unisys patent on the LZW algorithm expired in 2003 and 2004. Why is there no support for it in JAI yet? http://www.unisys.com/about__unisys/lzw

  • How to disable buttons in Search help screen ?

    Hi All, How do we disable Print button in customer search help ? We want that nobody should be able to take a printout of Customers from Search help result. Hence we want to disable the print button which comes in Search help. Any idea how do we go a

  • Imac Video

    I have a 20 inch Imac could the graphics be upgraded ??? Some one help Thanks Robou (rau-boo)

  • Reuse of existing packages for saving data?

    Hi, I'm pretty new to APEX so I lack the in-depth know-how how to do certain tasks. We want to build a simple management application for a customer and reuse as much code as possible to keep the price low. For example, there are procedures in package