EJB joining transaction in cmt

Hi
i want to join my cmt(container managed transaction) method in existing transaction which is created in web tier(servlet)
is it possible to use user transaction class like this.
Context context = new InitialContext();
UserTransaction userTransaction =
(UserTransaction) context.lookup("java:comp/UserTransaction");
userTransaction.begin();
// Perform cmt methods
userTransaction.commit();
how can i solve this problem.
Thanks for your reply.

Repost -- See http://forums.sun.com/thread.jspa?threadID=5430241&tstart=0

Similar Messages

  • Configuring toplink with EJB to transactional control "CMT"

    I try to use the EJB transaction CMT but I need to configure toplink to use a transactional control of my EJB container. some body knows how can i do this? and how can I configure the toplink to get JNDI datasource?
    Best Regards

    I dont think there is anything in Toplink you need to configure for CMT. All the transactional attributes are specified in the ejb-jar.xml file and I dont think you can edit this file using the Workbench or the Sessions Editor. With CMP the Workbench gives you an option to either overwrite this file or update but there is no way to "update" for transactional attributes. You can look at the examples for CMP (under folder advanced) that shows you how to use entity beans with Toplink in a CMP environment and you can look at the ejb-jar.xml file for more information.
    Configuring Toplink to get JNDI data source is easy-thats defined in the sessions.xml. Just open the sessions.xml using the sessions editor and click on login tab and then enter in the data source information.
    I try to use the EJB transaction CMT but I need to
    configure toplink to use a transactional control of
    my EJB container. some body knows how can i do this?
    and how can I configure the toplink to get JNDI
    datasource?
    Best Regards

  • Javax.ejb.EJBException: Transaction aborted

    Hello everyone, I am new in javaEE6. When i try to develop and simple example i meet this error but i can't find which code line cause it. I use JSF EJB3.1 EclipseLink JPA 2.0 in Glassfish v3 and developed in Netbean6.8. Here is my Stack trace .
    Caused by: javax.ejb.EJBException: Transaction aborted
         at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:4997)
         at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4756)
         at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1955)
         at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1906)
         at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:198)
         at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:84)
         at $Proxy158.createUsers(Unknown Source)
         at home.tuan.bussiness.__EJB31_Generated__UsersEJB__Intf____Bean__.createUsers(Unknown Source)
         at home.tuan.controller.UsersController.doCreateUser(UsersController.java:40)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sun.el.parser.AstValue.invoke(AstValue.java:234)
         at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
         at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:98)
         at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
         ... 32 more
    Caused by: javax.transaction.RollbackException: Transaction marked for rollback.
         at com.sun.enterprise.transaction.JavaEETransactionImpl.commit(JavaEETransactionImpl.java:450)
         at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.commit(JavaEETransactionManagerSimplified.java:837)
         at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:4991)
         ... 48 more
    Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.0.v20091127-r5931): org.eclipse.persistence.exceptions.DatabaseException
    Internal Exception: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "." at line 1, column 29.
    Error Code: -1
    Call: INSERT INTO ChatDatabase.dbo.Users (UserName, Pass) VALUES (?, ?)
         bind => [er, w]
    Query: InsertObjectQuery(home.tuan.model.Users@825299)My Entity is:
    package home.tuan.model;
    import java.io.Serializable;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import javax.persistence.NamedQueries;
    import javax.persistence.NamedQuery;
    import javax.persistence.Table;
    * @author minhtuan
    @Entity
    @Table(name = "Users", catalog = "ChatDatabase", schema = "dbo")
    public class Users implements Serializable {
        private static final long serialVersionUID = 1L;
        @Id  
        @Column(name = "UserName")
        private String userName;
        @Column(name = "Pass")
        private String pass;
        public Users() {
        public Users(String userName, String pass) {
            this.userName = userName;
            this.pass = pass;
        public String getUserName() {
            return userName;
        public void setUserName(String userName) {
            this.userName = userName;
        public String getPass() {
            return pass;
        public void setPass(String pass) {
            this.pass = pass;
    }My session bean is:
    package home.tuan.bussiness;
    import home.tuan.model.Users;
    import java.util.ArrayList;
    import java.util.List;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    import javax.persistence.Query;
    * @author minhtuan
    @Stateless
    public class UsersEJB {
      @PersistenceContext(unitName="MavenTestPU")
      private EntityManager em ;
      public Users createUsers(Users newUser){
          em.persist(newUser);
          return newUser;
    }My controller class is:
    package home.tuan.controller;
    import home.tuan.bussiness.UsersEJB;
    import home.tuan.model.Users;
    import java.util.ArrayList;
    import java.util.List;
    import javax.ejb.EJB;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.RequestScoped;
    import javax.persistence.EntityTransaction;
    import javax.persistence.Persistence;
    import javax.transaction.UserTransaction;
    * @author minhtuan
    @ManagedBean(name="UsersController")
    @RequestScoped
    public class UsersController {
        /** Creates a new instance of UsersController */
        @EJB
        UsersEJB userEJB;
        Users newUser = new Users();
        List<Users> listUsers = new ArrayList<Users>();
        public String doNewUser(){
            return "index.jsp";
        public String doCreateUser(){
            System.out.println("Den day rui");
            System.out.println(newUser.getUserName());
            System.out.println(newUser.getPass());
            newUser = userEJB.createUsers(newUser);
            return "index.jsp";
        public List<Users> getListUsers() {
            return listUsers;
        public void setListUsers(List<Users> listUsers) {
            this.listUsers = listUsers;
        public Users getNewUser() {
            return newUser;
        public void setNewUser(Users newUser) {
            this.newUser = newUser;
    }And my persistence.xml is:
    <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
      <persistence-unit name="MavenTestPU" transaction-type="JTA">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <class>home.tuan.model.Users</class>
        <properties>
            <!--
          <property name="javax.persistence.jdbc.url" value="jdbc:sqlserver://localhost:1433;databaseName=ChatDatabase"/>
          <property name="javax.persistence.jdbc.password" value="12345"/>
          <property name="javax.persistence.jdbc.driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
          <property name="javax.persistence.jdbc.user" value="sa"/>
          -->
           <property name="eclipselink.target-database" value="SQLSERVER"/>
           <property name="eclipselink.jdbc.driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
           <property name="eclipselink.jdbc.url" value="jdbc:sqlserver://localhost:1433;databaseName=ChatDatabase"/>
                <!--<property name="eclipselink.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>-->
                <!--<property name="eclipselink.jdbc.url" value="jdbc:derby:chapter10DB;create=true"/>-->
           <property name="eclipselink.jdbc.user" value="sa"/>
           <property name="eclipselink.jdbc.password" value="12345"/>
                <!--property name="eclipselink.ddl-generation" value="update"/-->
                <!--property name="eclipselink.ddl-generation" value="drop-and-create-tables"/-->
           <property name="eclipselink.logging.level" value="INFO"/>
        </properties>
      </persistence-unit>
    </persistence>Thanks in advance
    Edited by: ActiveDean on Dec 24, 2009 4:38 PM

    You need to step through a debugger and find the source of your problem as something is clearly going wrong and causing the transaction to roll back. That is all that message tells us.
    m

  • EJB nested transaction handling.

    My situation closely relates to the round-trip planning problem. I have a series of say 5 EJBs (session and entity both involved) doing a particular work. If an error occurs at the EJB 5 stage, I don't want to rollback the work done in EJB 1 and 2 but I want EJB 3 onwards to rollback. Is this kind of nested transaction model possible. Please note that I want to use container-managed-transactions. If not possible, please guide me how can I use bean-managed-transaction to solve it? Thanks in advance for any help.

    Yes, it is possible, but you have to make sure that ANY call to EJB 3 through that method has the same requirements:
    EJB 1 - Transaction = Required
    EJB 2 - Transaction = Required
    EJB 3 - Transaction = Requires New (starts a new transaction, "holds" the one from 1 & 2)
    EJB 4 - Transaction = Requires
    EJB 5 - Transaction = Requires

  • Help-Problem in calling JMS  inside an EJB having  transaction attribute Required New

              Hi,
              Version wl 5.1 service pack 8
              OS - unix
              I am using a Container managed bean say Bean1(transaction attribute Required)
              which in one of its method is trying to call another EJB say Bean2 which has the
              transaction attribute set to "RequiredNew".Inside the method in Bean2 i have my
              JMS funtions coded to persist to database.JMS uses Queue connection factory and
              is an non transaction JMS session.The JMS server is running in a separate weblogic
              server and not in the server where EJB is deployed.I use the url of the JMS server
              and get the context of that server and connect my JMS.
              The problem that i am facing is
              I do the transaction in bean1 and the i make the call to bean2 to do the JMS work
              and i can see the JMS doing the insert in the table and everthing works fine.But
              after few seconds i can see the exception/message seen on the console of the weblogic
              server where my JMS server is running as below
              Tue Sep 04 15:57:09 CDT 2001:<I> <TX> Transaction (TxC (30486015, xid = 99963563
              2756_5, timeout = 30, txState = Marked Rollback, root = 829817264280676325S10.51
              .110.237:[7001,7001,7002,7002,7001,-1]/326) rolled back after 30 sec.
              After this happen i dont see any roll back in either bean1 or bean2 or the JMS
              insert is rolled back.
              I don't know why this exception is thrown and no effects on the rollback and it
              works the way i wanted.But the only thing that keeps bothering me is the rollback
              and why does this happen.
              Thanks
              Krish.
              

    The exception your seeing is troubling - if the tran is rolled
              back than whatever work is associated should also roll back. I suggest
              instrumenting your code to see if the tran rolling back is the same tran
              that is being used for the transactional application work that appears to succeed.
              Also, try forcing a rollback, you may see that the EJB work truly rolls back
              while the JMS work does not.
              I'm not really familiar with 5.1, but I know there is a fundamental limitation to one
              phase commits, this means that the JDBC connection pool used by JMS as well
              as that used by the EJB must be one and the same - I'm not exactly sure how
              it works, but I'm pretty sure multiple servers can share the same connection pool.
              This post seems unrelated to clustering, if you need further help, I
              suggest posting in the ejb or transaction newsgroups.
              Krish wrote:
              > Hi,
              >
              > Version wl 5.1 service pack 8
              > OS - unix
              >
              > I am using a Container managed bean say Bean1(transaction attribute Required)
              > which in one of its method is trying to call another EJB say Bean2 which has the
              > transaction attribute set to "RequiredNew".Inside the method in Bean2 i have my
              > JMS funtions coded to persist to database.JMS uses Queue connection factory and
              > is an non transaction JMS session.The JMS server is running in a separate weblogic
              > server and not in the server where EJB is deployed.I use the url of the JMS server
              > and get the context of that server and connect my JMS.
              >
              > The problem that i am facing is
              >
              > I do the transaction in bean1 and the i make the call to bean2 to do the JMS work
              > and i can see the JMS doing the insert in the table and everthing works fine.But
              > after few seconds i can see the exception/message seen on the console of the weblogic
              > server where my JMS server is running as below
              >
              > Tue Sep 04 15:57:09 CDT 2001:<I> <TX> Transaction (TxC (30486015, xid = 99963563
              > 2756_5, timeout = 30, txState = Marked Rollback, root = 829817264280676325S10.51
              > 110.237:[7001,7001,7002,7002,7001,-1]/326) rolled back after 30 sec.
              >
              >
              > After this happen i dont see any roll back in either bean1 or bean2 or the JMS
              > insert is rolled back.
              >
              > I don't know why this exception is thrown and no effects on the rollback and it
              > works the way i wanted.But the only thing that keeps bothering me is the rollback
              > and why does this happen.
              >
              > Thanks
              >
              > Krish.
              

  • EJB Entity transaction rollback problem

              Hello,
              I have created 2 beans one is a Stateless Session and the other a Bean Managed Entity Bean. The SS Bean has methods to retrieve an Oracle Connection from a DataSource defined connection pool, and to close a connection. The entity bean I have created is responsible for insterting a new record into one of the tables in my database.
              I have a client app that calls the ejbCreate method on the entity bean at which point the Entity EJB takes control, gets a valid connection from the SS EJB, runs a simple working SQL SELECT statement (obtaining correct values), and then attempts to perform an insert into a table using a prepared statement. My problem is that the application runs fine without any errors and all calls are made and all calls seem to be working fine. I have checked to make sure that the Datasource I am using is AutoCommit= false and it is and there are no exceptions being thrown in my EJB's but yet it appears as though the SQL statements executeUpdate() command is not being committed as their is no rows created in the database. Does anyone know what I may be doing wrong. I have all ACL parameters set up correctly and as I stated before the entire app runs without errors and I do have a SELECT statment that is working properly within the same method as the INSERT statement which is not!!! Please send any suggestions!!
              Justin
              

              I am using CMT, it is activated by default on Entity Beans I believe. The bean itself is marked as TX_REQUIRED so I believe all the methods automatically are all TX_REQUIRED.
              Here is my Bean ejbCreate Method, My PK class, and my ejb-jar.xml file-- I've pasted them below for convenience.
              ejbCreate:
                   public CustomerPK ejbCreate(String aUserName, String aPassword, String aFirstName,
                        String aMiddleInit, String aLastName, String aEmailAddr)
                        throws javax.ejb.CreateException {
                   Connection conn=null;
                   long nextPrsnID;
                   long nextCustID;
                   if (verifyParams(aUserName, aPassword, aFirstName, aMiddleInit,
                        aLastName, aEmailAddr)) {
                   if (isUniqueUserName(aUserName)) {
                   try {
                        conn=getConnection();
                        conn.setAutoCommit(false);
                        nextPrsnID=addPerson(conn,aFirstName,aMiddleInit,aLastName); // adds a person to the person table consists of just simple SQL
                        nextCustID=addCustomer(conn,nextPrsnID, aUserName,aPassword, aEmailAddr); //adds a customer to the customer table
                        // SET THE BEAN MANAGED PUBLIC VARIABLES
                        this.userName=aUserName;
                        this.password=aPassword;
                        this.firstName=aFirstName;
                        this.middleInit=aMiddleInit;
                        this.lastName=aLastName;
                        this.emailAddr=aEmailAddr;
                        this.personID=nextPrsnID;
                        this.custID=nextCustID;
                        conn.commit(); // with this statement here the transaction goes through otherwise the DB will not be updated
                   catch (Exception e){
                        throw new javax.ejb.CreateException("Experiencing Database Problems-- Unrecoverable Error"); // rollback transaction
                   finally{
                        cleanup(conn,null); // close the connection
                   else {           // UserName already exists
                   throw new javax.ejb.CreateException("Sorry username already exists please choose another one");
                   else {          // Registration parameters were not verifiable
                   throw new javax.ejb.CreateException("Registration paramater rules were violated");
                   CustomerPK custPK=new CustomerPK(nextCustID);
                   return custPK;
              EJB CUSTOMER PRIMARY KEY CLASS:
              public class CustomerPK implements java.io.Serializable {
              // PRIMARY KEY VARIABLES
              public long CustomerID;
              public CustomerPK(long aCustomerID) {
              this.CustomerID=aCustomerID;
              public CustomerPK() {
              public String toString(){
              return ((new Long(CustomerID)).toString());
              public boolean equals(Object aComparePK){
              if (this.CustomerID==((CustomerPK)aComparePK).CustomerID){
                   return true;
              return false;
              public int hashCode(){
              return ((new Long(CustomerID).toString()).hashCode());
              } // END-CLASS
              CUSTOMER ejb-jar.xml
              <?xml version="1.0"?>
              <!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>
              <entity>
                   <ejb-name>Customer</ejb-name>
                   <home>CustomerHome</home>
                   <remote>Customer</remote>
                   <ejb-class>CustomerBean</ejb-class>
                   <persistence-type>Bean</persistence-type>
                   <prim-key-class>CustomerPK</prim-key-class>
                   <reentrant>False</reentrant>
                   <resource-ref>
              <res-ref-name>jdbc/DeveloperPool</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
              </resource-ref>
              </entity>
              </enterprise-beans>
              <assembly-descriptor>
              <container-transaction>
                   <method>
                   <ejb-name>Customer</ejb-name>
                   <method-intf>Remote</method-intf>
                   <method-name>*</method-name>
                   </method>
                   <trans-attribute>Required</trans-attribute>
              </container-transaction>
              </assembly-descriptor>
              </ejb-jar>
              "Cameron Purdy" <[email protected]> wrote:
              >Are you using CMT? Have you marked the methods as REQUIRED?
              >
              >Peace,
              >
              >--
              >Cameron Purdy
              >Tangosol, Inc.
              >http://www.tangosol.com
              >+1.617.623.5782
              >WebLogic Consulting Available
              >
              >
              >"Justin Jose" <[email protected]> wrote in message
              >news:[email protected]...
              >>
              >> Hello,
              >>
              >> I have created 2 beans one is a Stateless Session and the other a Bean
              >Managed Entity Bean. The SS Bean has methods to retrieve an Oracle
              >Connection from a DataSource defined connection pool, and to close a
              >connection. The entity bean I have created is responsible for insterting a
              >new record into one of the tables in my database.
              >> I have a client app that calls the ejbCreate method on the entity bean at
              >which point the Entity EJB takes control, gets a valid connection from the
              >SS EJB, runs a simple working SQL SELECT statement (obtaining correct
              >values), and then attempts to perform an insert into a table using a
              >prepared statement. My problem is that the application runs fine without
              >any errors and all calls are made and all calls seem to be working fine. I
              >have checked to make sure that the Datasource I am using is AutoCommit=
              >false and it is and there are no exceptions being thrown in my EJB's but yet
              >it appears as though the SQL statements executeUpdate() command is not being
              >committed as their is no rows created in the database. Does anyone know
              >what I may be doing wrong. I have all ACL parameters set up correctly and
              >as I stated before the entire app runs without errors and I do have a SELECT
              >statment that is working properly within the same method as the INSERT
              >statement which is not!!! Please send any suggestions!!
              >>
              >> Justin
              >
              >
              

  • MDB and EJB in transactions

    Hi ,
              I have an MDB running on weblogic 8.2 and calling a remove ejb running on a different machine. After getting home interface when I tried to create the remote object Iam getting the following error.
              java.lang.NullPointerException
              at weblogic.transaction.internal.PropagationContext.useNewMethod(PropagationContext.java:866)
              at weblogic.transaction.internal.PropagationContext.writeExternal(PropagationContext.java:169)
              at weblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:100)
              at weblogic.common.internal.ChunkedObjectOutputStream.writeObjectWL(ChunkedObjectOutputStream.java:122)
              at weblogic.rjvm.MsgAbbrevOutputStream.setTxContext(MsgAbbrevOutputStream.java:122)
              at weblogic.rjvm.BasicOutboundRequest.setTxContext(BasicOutboundRequest.java:156)
              at weblogic.rmi.internal.BasicRemoteRef.getOutboundRequest(BasicRemoteRef.java:106)
              at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:276)
              at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:244)
              Can any body tell what could be the reason. The message sent from MDB to ejb is a transactional message.
              Thanks in advance
              Manikyala

    I suggest posting to the EJB newsgroup.
              (1) Transactions certainly are supported for remote services. This is a common use case.
              (2) Your problem seemed to occur when getting the remote home - but likely would not occur when actually using it. Since I think (not 100% sure) that the action of obtaining the remote home need not be transactional, I previously suggested suspending the transactions, but only for the duration of the call to get the remote home.
              Tom
              > Hi Tom,
              >
              > Looks like what Iam doing is not correct.
              >
              > Iam calling a remote ejb which on a different server
              > from my MDB. Iam using t3 to get the context. Also in
              > the weblogic-ejb-jar.xml I put transaction value as
              > Required.
              >
              > Now I replaced that with NotSupported and problem is
              > solved.
              >
              > The conclusion is (if Iam not wrong) when creating a
              > remote home we should not use transactions since the
              > remote service is not participating in transaction.
              >
              > Thanks again Tom
              >
              >
              > Manikyala

  • EJB 3.0 (MDB) CMT does partial Tx commit in hibernate

    Seems like CMT (MDB) does partial commit.+
    A secnario like this: we are using EJB3.0 combination with Hibernate
    1. Some message sent to queue.
    2. MDB listner who listen the queue its onMessage method is invoked. See below for MDB configurations.
    @TransactionManagement(TransactionManagementType.CONTAINER)
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    3. Some Handler is called from MDB say ResponseHandler.
    4. We called 2 update operation from this handler.
    ResponseHandler#updateTable1() with below set of execution
    |__ em.merg(table1Entity);
    |__ em.flush()
    ResponseHandler#updateTable2() with below set of execution
    |__ em.merg(table2Entity);
    |__ em.flush()
    Problem:+
    I can see only one table1 is get updated. Table2 is not updated with latest value though MDB class is container managed...
    Hibernate query logs: In logs i can see update operation for both the tables
    Hibernate: update table1...
    Hibernate: update table2...
    PS: We can't see this problem in case we put debug breakpoint on first line of onMessage() method of MDB
    class ResponseListner implements MessageListener
    public void onMessage(final Message message)
    Logger.info("ResponseListner.onMessage() : Entered"); //breakpoint line (breakpoint is here)
    Weblogic transaction logs+
    ####<Apr 4, 2012 4:49:09 PM IST> <Debug> <JTAXA> <inlinapplication001> <applicationServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <api.user1> <> <> <1333538349228> <BEA-000000> <BEA1-0012DE77F7FE1343F773: null: XA.prepare(rm=WLStore_application_cluster_domain2_applicationServerJDBCStore, xar=WLStore_application_cluster_domain2_applicationServerJDBCStore234212480>
    ####<Apr 4, 2012 4:49:09 PM IST> <Debug> <JTAXA> <inlinapplication001> <applicationServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <api.user1> <> <> <1333538349228> <BEA-000000> <startResourceUse, Number of active requests:1, last alive time:0 ms ago.>
    ####<Apr 4, 2012 4:49:09 PM IST> <Debug> <JTAXA> <inlinapplication001> <applicationServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <api.user1> <BEA1-0012DE77F7FE1343F773> <> <1333538349233> <BEA-000000> <BEA1-0012DE77F7FE1343F773: null: XA.prepare DONE:ok>
    ####<Apr 4, 2012 4:49:09 PM IST> <Debug> <JTAXA> <inlinapplication001> <applicationServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <api.user1> <BEA1-0012DE77F7FE1343F773> <> <1333538349233> <BEA-000000> <endResourceUse, Number of active requests:0>
    ####<Apr 4, 2012 4:49:09 PM IST> <Debug> <JTAJDBC> <inlinapplication001> <applicationServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <api.user1> <BEA1-0012DE77F7FE1343F773> <> <1333538349233> <BEA-000000> <JDBC LLR pool='com.application.ds' xid='BEA1-0012DE77F7FE1343F773' tbl='WL_LLR_applicationSERVER': begin write XA record table=WL_LLR_applicationSERVER recLen=529>
    ####<Apr 4, 2012 4:49:09 PM IST> <Debug> <JTAJDBC> <inlinapplication001> <applicationServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <api.user1> <BEA1-0012DE77F7FE1343F773> <> <1333538349234> <BEA-000000> <JDBC LLR pool='com.application.ds' xid='BEA1-0012DE77F7FE1343F773' tbl='WL_LLR_applicationSERVER': after write XA record>
    ####<Apr 4, 2012 4:49:09 PM IST> <Debug> <JTAJDBC> <inlinapplication001> <applicationServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <api.user1> <BEA1-0012DE77F7FE1343F773> <> <1333538349234> <BEA-000000> <JDBC LLR pool='com.application.ds' xid='BEA1-0012DE77F7FE1343F773' tbl='WL_LLR_applicationSERVER': commit one-phase=false>
    ####<Apr 4, 2012 4:49:09 PM IST> <Debug> <JTAJDBC> <inlinapplication001> <applicationServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <api.user1> <BEA1-0012DE77F7FE1343F773> <> <1333538349239> <BEA-000000> <JDBC LLR pool='com.application.ds' xid='BEA1-0012DE77F7FE1343F773' tbl='WL_LLR_applicationSERVER': commit complete>
    ####<Apr 4, 2012 4:49:09 PM IST> <Debug> <JTAXA> <inlinapplication001> <applicationServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <api.user1> <> <> <1333538349240> <BEA-000000> <startResourceUse, Number of active requests:1, last alive time:0 ms ago.>
    ####<Apr 4, 2012 4:49:09 PM IST> <Debug> <JTAXA> <inlinapplication001> <applicationServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <api.user1> <BEA1-0012DE77F7FE1343F773> <> <1333538349243> <BEA-000000> <BEA1-0012DE77F7FE1343F773: null: XA.commit DONE (rm=WLStore_application_cluster_domain2_applicationServerJDBCStore, xar=WLStore_application_cluster_domain2_applicationServerJDBCStore234212480>
    ####<Apr 4, 2012 4:49:09 PM IST> <Debug> <JTAXA> <inlinapplication001> <applicationServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <api.user1> <BEA1-0012DE77F7FE1343F773> <> <1333538349243> <BEA-000000> <endResourceUse, Number of active requests:0>
    ####<Apr 4, 2012 4:49:10 PM IST> <Info> <Health> <inlinapplication001> <applicationServer> <weblogic.GCMonitor> <<anonymous>> <> <> <1333538350589> <BEA-310002> <39% of the total memory in the server is free>
    ####<Apr 4, 2012 4:49:26 PM IST> <Debug> <JTAXA> <inlinapplication001> <applicationServer> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <BEA1-0014DE77F7FE1343F773> <> <1333538366645> <BEA-000000> <ResourceDescriptor[WLStore_application_cluster_domain2__WLS_applicationServer]: getOrCreate gets rd: name = WLStore_application_cluster_domain2__WLS_applicationServer
    resourceType = 2
    registered = true
    scUrls = applicationServer+10.19.216.10:5003+application_cluster_domain2+t3+
    xar = WLStore_application_cluster_domain2__WLS_applicationServer1926833320
    healthy = true
    lastAliveTimeMillis = 1333538336966
    numActiveRequests = 0
    >

    You have to add the property toplink.ddl-generation.output-mode to your persistence.xml file, for example:
    <?xml version="1.0" encoding="windows-1252" ?>
    <persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
    version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
    <persistence-unit name="model">
    <jta-data-source>jdbc/jdm-akoDS</jta-data-source>
    <properties>
    <property name="toplink.logging.level" value="INFO"/>
    <property name="toplink.target-database" value="Oracle"/>
    <property name="toplink.ddl-generation" value="drop-and-create-tables"/>
    <property name="toplink.ddl-generation.output-mode" value="database"/>
    </properties>
    </persistence-unit>
    </persistence>

  • Can i call Bean managed EJB with transaction attribute Required New

              I am calling a BeanManaged EJB which has a transaction attribute
              set to Required New from a container managed bean. Does it create a new transaction
              other than the Bean managed transaction. Do i really need a required new field
              transaction attribute.All i need is user controlled transaction.Do i need to set
              the transaction aatibute.
              Thanks
              Krish.
              

    Hi Krish,
              The question does not make much sense.
              I would suggest that you set all your tx settings to "Required" unless you
              have a specific reason to do otherwise, and in those few instances that you
              have a specific reason to do otherwise, then change it in just those places.
              Peace,
              Cameron Purdy
              Tangosol Inc.
              << Tangosol Server: How Weblogic applications are customized >>
              << Download now from http://www.tangosol.com/download.jsp >>
              "KRISH" <[email protected]> wrote in message
              news:[email protected]..
              >
              > I am calling a BeanManaged EJB which has a transaction attribute
              > set to Required New from a container managed bean. Does it create a new
              transaction
              > other than the Bean managed transaction. Do i really need a required new
              field
              > transaction attribute.All i need is user controlled transaction.Do i need
              to set
              > the transaction aatibute.
              >
              > Thanks
              >
              > Krish.
              >
              

  • Override EJB 3 transaction interceptor in OC4J 10.1.3 possible?

    Hi
    I'm using OC4J 10.1.3 with EJB 3 container managed transactions. I need to override the default transaction interceptor to add some additionnal logic that needs to be aware that a transaction will be commited, and I don't see any other way to do this since normal interceptors are not aware that a transaction is about to be commited when the method exits. Is there a way to do that?
    TIA
    Eric

    Anybody? Since I'm using Bean Managed Transactions, should the transaction context be propagated through each call? When I do the same kind of test with Container Managed Transactions I can see that the transaction propagation is working... I thought it is supposed to work in both cases, the only difference being that with BMT the bean itself is managing the transaction...
    Please, any help would be greatly appreciated...
    Eric

  • JMS publisher inheriting EJB container transaction

              I have trawled through the archives but just need to clarify :-
              How can I have an Session EJB which send messages to a JMS Queue inherit the EJB
              container managed transaction from the session bean, such that if the EJB rollsback
              the message will as well ?
              1) Firstly is this possible with container managed transactions ?
              2) Should I use a transacted (true) or non-transacted (false)
              Session ?
              queueConnection.createQueueSession(true,0); or
              queueConnection.createQueueSession(false,0); or
              3) Unless I call queueSession.commit() the message never seems to get there, but
              if I call commit() it seems to arrive at the MessageDriven bean IMMEDIATELY, i.e
              before the Session bean's transaction has committed. Do I need to commit() ?
              Any help would be appreciated.
              I have tried
              

              Pete wrote:
              > I have trawled through the archives but just need to clarify :-
              >
              > How can I have an Session EJB which send messages to a JMS Queue inherit the EJB
              > container managed transaction from the session bean, such that if the EJB rollsback
              > the message will as well ?
              >
              > 1) Firstly is this possible with container managed transactions ?
              Yes.
              > 2) Should I use a transacted (true) or non-transacted (false)
              > Session ?
              >
              > queueConnection.createQueueSession(true,0); or
              > queueConnection.createQueueSession(false,0); or
              >
              non-transacted, otherwise you will get the behavior in (3)
              ensure that the connection factory used has the
              "UserTransactionsEnabled" flag configured to true
              > 3) Unless I call queueSession.commit() the message never seems to get there, but
              > if I call commit() it seems to arrive at the MessageDriven bean IMMEDIATELY, i.e
              > before the Session bean's transaction has committed. Do I need to commit() ?
              >
              > Any help would be appreciated.
              > I have tried
              This is a frequently-asked question. See the JMS FAQ for details, also
              check out the tranaction chapter of the JMS programmer's guide, and, if
              your interested in performance considerations, check out the WebLogic
              JMS Performance Guide white-paper available on dev2dev.bea.com.
              

  • EJB - MDB Transaction

              Hi,
              I am trying to configure a transaction to span between one Stateless EJB and MANY
              JMS Messages sent to a topic consumed via a MDB.
              I have a Stateless EJB Services called copyOffers(List offerIds). For each offerId
              in OfferIds it sends a JMS Message to the CopyOffer Topic. I have one MDB subscribed
              to the Topic that does the work of copying the ONE offer it was provided. I also,
              have configured the JMSReplyTo with a temp. Topic so that all the CopyOfferMDBs
              can notify the Stateless EJB when they are done.
              I want all the EJB and MDB calls to act within ONE transaction. The Stateless
              Session Bean is marked as REQUIRED and the MDB is marked as CONTAINER and also
              REQUIRED.
              Here is what I have done...
              If I mark my JMS Connection Factory as User Transaction Enabled = true... ALL
              the MDB messages are only delivered once the Stateless EJB is commited. Then each
              MDB is in its own transaction.
              I can not get all the MDBs and the EJB to be in ONE transaction whereby if ONE
              MDB failed ALL failed.
              Any ideas?
              Thanks,
              Mike Porter
              

    Cool!
              There is no standard J2EE API or WebLogic J2EE extension
              for handling multiple asynchronous workers
              in the same transaction, but there is a supported non-J2EE
              "back-door". Use the (free) Tuxedo java client's "tpacall()"
              methods, and program your EJBs to be Tuxedo aware. (Tuxedo
              is BEA's "C" based app server, but no Tuxedo server is needed.)
              http://edocs.bea.com/wls/docs81/wtc.html
              I do not know of any customers without a Tuxedo background that
              are doing this. But, if you are interested, the "wtc" newsgroup
              should be able to get you started.
              Tom
              P.S. The alternative is to use multiple transactions, which
              inform some stateful central location when they are done. This
              stateful thing could be an entity bean. This requires extra
              code for failure cases - as it requires code for detecting the
              failures in the first place, code for fixing up the failed
              transaction(s), and for undoing the committed transactions(s).
              This kind of code is generally referred to as
              "compensating transactions", and, as you can imagine, sometimes
              gets pretty hairy pretty fast...
              Mike Porter wrote:
              > I was afraid of that.
              >
              > Any ideas how I can asynchronously handle multiple workers(IE:my offer copiers)
              > in one transaction. I thought JMS would help but I guess not.
              >
              > Thanks,
              >
              > Mike
              >
              > Tom Barnes <[email protected]> wrote:
              >
              >>Hi Mike,
              >>
              >>As with any messaging system, the production of a message can
              >>not participate in the same transaction as the consumption of
              >>a message. The producer's commit call is what makes
              >>the message available for consumption.
              >>
              >>You may want to read the "transactions" chapter of the
              >>JMS Programmer's guide.
              >>
              >>Tom
              >>
              >>
              >>Mike Porter wrote:
              >>
              >>>Hi,
              >>>
              >>>I am trying to configure a transaction to span between one Stateless
              >>
              >>EJB and MANY
              >>
              >>>JMS Messages sent to a topic consumed via a MDB.
              >>>
              >>>I have a Stateless EJB Services called copyOffers(List offerIds). For
              >>
              >>each offerId
              >>
              >>>in OfferIds it sends a JMS Message to the CopyOffer Topic. I have one
              >>
              >>MDB subscribed
              >>
              >>>to the Topic that does the work of copying the ONE offer it was provided.
              >>
              >>I also,
              >>
              >>>have configured the JMSReplyTo with a temp. Topic so that all the CopyOfferMDBs
              >>>can notify the Stateless EJB when they are done.
              >>>
              >>>
              >>>I want all the EJB and MDB calls to act within ONE transaction. The
              >>
              >>Stateless
              >>
              >>>Session Bean is marked as REQUIRED and the MDB is marked as CONTAINER
              >>
              >>and also
              >>
              >>>REQUIRED.
              >>>
              >>>Here is what I have done...
              >>>If I mark my JMS Connection Factory as User Transaction Enabled = true...
              >>
              >>ALL
              >>
              >>>the MDB messages are only delivered once the Stateless EJB is commited.
              >>
              >>Then each
              >>
              >>>MDB is in its own transaction.
              >>>
              >>>I can not get all the MDBs and the EJB to be in ONE transaction whereby
              >>
              >>if ONE
              >>
              >>>MDB failed ALL failed.
              >>>
              >>>Any ideas?
              >>>
              >>>Thanks,
              >>>
              >>>Mike Porter
              >>>
              >>
              >
              

  • How can I control the EJB's Transaction with entity bean

    If I use entity bean, the Transaction is managed by container.and I want to create JDBC Connection by myselft ,not the Datasource,how is the transaction is controlled by the container,if transaction is not controlled ,how can I control it??

    Hi,
    If you want to control the transaction your self then you need to use javax.transaction.UserTransaction interface and methods defined by it.
    Hope this helps
    Vishal

  • Security.properties, ejb.properties, transaction.interoperability

    My team is attempting to upgrade our app to Java 1.4.2_04. We have a Java application that is using J2EE. We keep getting exceptions in our log file pertaining to the above file names 'not found'.
    If these are required files, can anyone help us figure out what the format, etc of these files should be so that we can get rid of these exceptions?

    Hi,
    I am also getting these exceptions in my application. Could you please let me know what you did to get rid of these.
    Regards,
    Akhil

  • Ejb interceptor and CMT transaction

    hi all,
    i have one stateless session bean using CMT.
    And it has been intercept by ejb interceptor.
    actually, i try to catch all the exception from session bean method using interceptor.
    eg.
    try {
    target2 = invocation.proceed();
    return target2;
    } catch (Exception e) {
    But i can't catch some kind of SQLException. because it looks like transaction doesn't commit after invocation.proceed();
    So, i can only catch those exception from caller.
    Is there any way to solve it?
    is there any way to catch all the exception from interceptor ?
    With Regards,
    WP

    Thanks for reply.
    we do not support to use requires_new because we may have another ejb layer(caller) and our ejb may need to join transaction of caller.
    So, i would like to choose EntityManager.flush().
    Then, I have DAO layer to insert record to db. Something like generic DAO and it is supported for all kinds of entity.
    So, when we invoke two times DAO layer from our stateless session bean method, how it will behave?
    I mean in the following ejb method, both DAO call can be in same transaction?
    eg. DAO
    public void create(T t) {
    entityManager.persist(t);
    entityManager.flush();
    EJB Method
    @TransactionAttribute(value = TransactionAttributeType.REQUIRED)
    public void performInsert(){
    dao.create(EmployeeEntity);
    dao.create(AddressEntity);
    }

Maybe you are looking for