Transaction problem in ejb

Hi
I have a problem related to CMP entity beans.
I am using Oracle 9i and weblogic 6.1
Here is the description of the problem.
The transaction attribute of all the beans is set to 'Required'.
I have a PersonBean (CMP) in Person.jar mapping to Person table along with other
beans.
I have a MemberBean(CMP) in Member.jar file mapping to Member table along with
many other beans.
There is a one to many relation ship between person and member tables in Oracle
9i database :
Id in the person table is the P_Key and Person_Id in Member table is the related
foreign key.
No relationship was made between Person and Member beans as there were in two
different jar files with different deployment descriptors.
I have a stateless session bean PersonService bean.
There is a method in PersonService bean called createPerson(String name);
This method creates Person in the database using Person p = PersonHome.create(),
long personId = p.getId()..returns the primary key of the person.
PersonService calls createMember(long personId) now.
which will try to create a Member record in the database using the personId.
Now the Member bean fails to create and the transaction is rolled back with a
foreign_key violation exception.
because it cannot locate the Person EJB Primary key entry in the underlying table.
But the EJB cache is still inserted properly with Person EJB (findByPrimaryKey
works).
I feel that Member bean is not able to participate in the same transaction of
the Person bean inspite of keeping the transaction attribute to 'Required'.
When I keep the transaction of Person bean to 'RequiresNew', then the transation
of createPerson is getting committed and Member is starting a New transaction
and it gets created.
But I donot want like this.
I want all the beans to be participating in the same transaction.
According to Oracle / Weblogic documentation the default database isolation mode
Read_Committed should allow participants in transaction to see uncommitted data
while participants outside the transaction see only committed data. I have tried
other dataabase isolation modes (such as Read_Uncommitted, "Serializable") these
appear to either create other problems or not have an affect.
Any solution to this problem is highly appreciated.
Thanks
Lavanya

Previously our code was running on Weblogic where
methodA() -> Transaction Attribute -> Supports
methodB() -> Transaction Attribute -> Required
But in JBOSS in order to run the same thing we have to do
methodA() -> Transaction Attribute -> Required
methodB() -> Transaction Attribute -> Required
Any Pointers??

Similar Messages

  • A Major Transaction Problem!

    "A" is a record which has already been inserted into a table(TBL).
    "insert(Y)" is a method that inserts a given record -Y- into TBL.
    "foo(X)" is a method that takes a record as a parameter and queries it on a view(VIEW). This view is a
    huge select statement that selects from TBL.
    Here is the problem:
    insert(B);
    foo( A ); /* returns true */
    but
    insert(B); /* B does not exist in TBL */
    foo(B); /* returns false and catches an exception that "A" is not found! */
    insert(Y) method is a CMP EJB method but foo(X) uses JDBC to access DBMS.
    so what can cause this transaction problem?
    thanks in advance,
    -selcuk

    Hi,
    Maybe foo is running in a different transaction than insert?
    Some possible causes:
    -you are starting a new transaction for foo, either via the UserTransaction or via REQUIRES_NEW
    -you are using a regular JDBC driver for foo instead of an XADataSource.
    Did you try to set foo's transaction attribute to REQUIRED?
    Best,
    Guy
    http://www.atomikos.com

  • Problem with EJB skeleton classloader

    Hi
    We have been migrating an enterprise application from Weblogic 7 to 9.2 and experienced strange problem with EJBs. Our EAR contains (beside the other elements) an EJB module with EJBs and some common POJO classes inside. At the deploy and run phase everything seems working fine, but when the remote client invokes a method which receives one of the common classes as a parameter we get ClassNotFoundException on the server side (talking precisely, the exception is thrown from the EJB skeleton, trying to unmarshall the parameter).
    It seems that our EJB's skeletons do not see the classes from EAR. We have tried moving the common classes to the APP-INF/lib directory or placing them at the root of EAR archive and adding reference in Manifest file of EJB module and it won't help.
    The only workaround we've found is to add the missing classes to the server classpath but this is unacceptable (however, it works).
    We are not using any custom classloader hierarchy.
    The other JARs have no problem loading the content of our EJB module (including the common classes, which cause the problem).
    So, why is the RMI classloader ommiting our application contents?

    The problem was fixed by upgrading to version 9.2.1

  • Assignment of transaction attributes in ejb-jar.xml

    Hi all,
    I'm going through the employee example from the book "Java programming in SAP web application server". I have followed the instrucstions to the letter and have triple checked that i did not miss anything.
    During the part "Defining Transaction Control", when i go to the "Assembly" tab, choose "Container-transaction" and click add; i get the following error message.
    You have to create and reference EJBs first. Afterwards you can choose them here.
    Newly created EJBs are referenced automatically in the ejb-jar.xml, in special cases you might have to reference them manually.
    Below is a copy of the ejb-jar. Both beans are referenced in the file so i don't really understand the error message!
    Thanks for your help.
    <?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>
         <description>EJB JAR description</description>
         <display-name>EJB JAR</display-name>
         <enterprise-beans>
              <session>
                   <ejb-name>EmployeeServicesBean</ejb-name>
                   <home>com.sap.demo.EmployeeServicesHome</home>
                   <remote>com.sap.demo.EmployeeServices</remote>
                   <local-home>com.sap.demo.EmployeeServicesLocalHome</local-home>
                   <local>com.sap.demo.EmployeeServicesLocal</local>
                   <ejb-class>com.sap.demo.EmployeeServicesBean</ejb-class>
                   <session-type>Stateless</session-type>
                   <transaction-type>Container</transaction-type>
                   <ejb-local-ref>
                        <ejb-ref-name>ejb/Employee</ejb-ref-name>
                        <ejb-ref-type>Entity</ejb-ref-type>
                        <local-home>com.sap.demo.EmployeeLocalHome</local-home>
                        <local>com.sap.demo.EmployeeLocal</local>
                        <ejb-link>EmployeeEjb.jar#EmployeeBean</ejb-link>
                   </ejb-local-ref>
              </session>
              <entity>
                   <ejb-name>EmployeeBean</ejb-name>
                   <home>com.sap.demo.EmployeeHome</home>
                   <remote>com.sap.demo.Employee</remote>
                   <local-home>com.sap.demo.EmployeeLocalHome</local-home>
                   <local>com.sap.demo.EmployeeLocal</local>
                   <ejb-class>com.sap.demo.EmployeeBean</ejb-class>
                   <persistence-type>Container</persistence-type>
                   <prim-key-class>java.lang.Long</prim-key-class>
                   <reentrant>False</reentrant>
                   <cmp-version>2.x</cmp-version>
                   <abstract-schema-name>EmployeeBean</abstract-schema-name>
                   <cmp-field>
                        <field-name>lastname</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>firstname</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>id</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>department</field-name>
                   </cmp-field>
                   <primkey-field>id</primkey-field>
                   <query>
                        <description>Query for getting all employee objects.</description>
                        <query-method>
                             <method-name>findAllEmployees</method-name>
                             <method-params/>
                        </query-method>
                        <ejb-ql>Select object (p) from EmployeeBean p</ejb-ql>
                   </query>
              </entity>
         </enterprise-beans>
         <assembly-descriptor/>
    </ejb-jar>

    I was able to add the transaction attributes manually to the ejb-jar.xml file. below is what the file looks like now for those interested.
    <?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>
         <description>EJB JAR description</description>
         <display-name>EJB JAR</display-name>
         <enterprise-beans>
              <session>
                   <ejb-name>EmployeeServicesBean</ejb-name>
                   <home>com.sap.demo.EmployeeServicesHome</home>
                   <remote>com.sap.demo.EmployeeServices</remote>
                   <local-home>com.sap.demo.EmployeeServicesLocalHome</local-home>
                   <local>com.sap.demo.EmployeeServicesLocal</local>
                   <ejb-class>com.sap.demo.EmployeeServicesBean</ejb-class>
                   <session-type>Stateless</session-type>
                   <transaction-type>Container</transaction-type>
                   <ejb-local-ref>
                        <ejb-ref-name>ejb/Employee</ejb-ref-name>
                        <ejb-ref-type>Entity</ejb-ref-type>
                        <local-home>com.sap.demo.EmployeeLocalHome</local-home>
                        <local>com.sap.demo.EmployeeLocal</local>
                        <ejb-link>EmployeeEjb.jar#EmployeeBean</ejb-link>
                   </ejb-local-ref>
              </session>
              <entity>
                   <ejb-name>EmployeeBean</ejb-name>
                   <home>com.sap.demo.EmployeeHome</home>
                   <remote>com.sap.demo.Employee</remote>
                   <local-home>com.sap.demo.EmployeeLocalHome</local-home>
                   <local>com.sap.demo.EmployeeLocal</local>
                   <ejb-class>com.sap.demo.EmployeeBean</ejb-class>
                   <persistence-type>Container</persistence-type>
                   <prim-key-class>java.lang.Long</prim-key-class>
                   <reentrant>False</reentrant>
                   <cmp-version>2.x</cmp-version>
                   <abstract-schema-name>EmployeeBean</abstract-schema-name>
                   <cmp-field>
                        <description>
                        </description>
                        <field-name>lastname</field-name>
                   </cmp-field>
                   <cmp-field>
                        <description>
                        </description>
                        <field-name>firstname</field-name>
                   </cmp-field>
                   <cmp-field>
                        <description>
                        </description>
                        <field-name>id</field-name>
                   </cmp-field>
                   <cmp-field>
                        <description>
                        </description>
                        <field-name>department</field-name>
                   </cmp-field>
                   <primkey-field>id</primkey-field>
                   <query>
                        <description>Query to get all employee objects.</description>
                        <query-method>
                             <method-name>findAllEmployees</method-name>
                             <method-params/>
                        </query-method>
                        <ejb-ql>Select object (p) from EmployeeBean p</ejb-ql>
                   </query>
              </entity>
         </enterprise-beans>
         <assembly-descriptor>
              <container-transaction>
                   <description>container-transaction</description>
                   <method>
                        <ejb-name>EmployeeBean</ejb-name>
                        <method-name>*</method-name>
                   </method>
                   <method>
                        <ejb-name>EmployeeServicesBean</ejb-name>
                        <method-name>*</method-name>
                   </method>
                   <trans-attribute>Required</trans-attribute>
              </container-transaction>
         </assembly-descriptor>
    </ejb-jar>
    Thanks

  • Transaction problems

    If anyone can help point me in the right direction of what I should be looking for in my configuration files for the following transaction problem. It looks like the delete is being committed one entity at a time instead of at the ened of the transaction.
    I'm using OC4J, eclipselink and Spring.
    I have two entities that I am trying to delete. They have a OneToOne relationship which in the underlying database (Oracle) has a deferred foreign key integrity constraint. I believe that this means that if the intities are delted in the same transaction everything should work, but if they are deleted in seperate transactions then the constraint should kick in and disallow the delete. I am using code similar to below to attempt to delete in one transaction. I am using Spring to inject an EntityManager and to control the transaction handling.
    @Transactional(readOnly=true)
    public class ProductServiceImpl implements ProductService{ 
      @PersistenceContext(type = PersistenceContextType.TRANSACTION)
      private EntityManager emp;
      @Transactional(readOnly=false, propagation=Propagation.REQUIRES_NEW)
      public void deleteProduct(Product prod){
          Object managedEntity = em.find(product.getClass(), prod.getId);
          em.remove(managedEntity);
    }Spring configuration xml file
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:jee="http://www.springframework.org/schema/jee"
           xmlns:tx="http://www.springframework.org/schema/tx"
           xsi:schemaLocation="
            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
            http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
      <jee:jndi-lookup id="myEmf" jndi-name="persistence/JPA"/>
      <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
      <bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="myEmf"/>
      </bean>
      <tx:annotation-driven transaction-manager="txManager"/>
      <bean id="ProductService" class="ProductServiceImpl"/>
    </beans>On calling the delete I get the following error message
    org.springframework.transaction.TransactionSystemException -
        Could not commit JPA transaction; nested exception is
        javax.persistence.RollbackException: Exception [EclipseLink-4002]
            (Eclipse Persistence Services - 1.0 (Build SNAPSHOT - 20080508)):
        org.eclipse.persistence.exceptions.DatabaseException Internal Exception:
        java.sql.SQLException: ORA-02091: transaction rolled back ORA-02292:
        integrity constraint (RVEL_FK) violated - child record found Error Code: 2091 Call:
        DELETE FROM RVEL_REVENUE_ELEMENT WHERE (ID = ?) bind => [6594]
        Query: DeleteObjectQuery(RevenueElement@1eafdce)I have also tried doing all this programatically, using a jndi lookup as follows
    EntityManager em = null;
    try{
      Context ctxt = new InitialContext();
      emf = (EntityManagerFactory)ctxt.lookup("jpaTest/ServerJPA");
      em = emf.createEntityManager();
      EntityTransaction et = em.getTransaction();
      try{
        et.begin();
        em.remove(managedEntity);
        et.commit();
      } finally{
        if(et != null && et.isActive()){
          et.rollback();
    } catch(NamingException nme) {
    } finally{
      if(em != null && em.isOpen()){
        em.close();
    } When debugging the error is thrown on the line
    em.remove(managedEntity);before the transaction commit is called.

    Thanks for the reply.
    The managed entity being deleted in the call to the delete method has one to many relationship with one of the entities in the one to one relationship which then has a reference to the second entity. These references are annotated with cascade ALL.
    A --> B --> C. The error is referring to entity C and its relationship back to B. The error is being thrown before the transaction is being committed.
    After doing a bit more research I believe that it is caused by the lack of the following property in my persistence.xml.
    <property name="eclipselink.target-server" value="OC4J_10_1_3"/>But if I put this property in then I get the errorException creating EntityManagerFactory using PersistenceProvider class org.eclipse.persistence.jpa.PersistenceProvider for persistence unit ServerJPA.

  • Transaction problems in Stateless EJB

    I have problems as follows. my client is a servlet which call method B in stateless ejb, In side of method B, there is a loop from which antoher method C in this same ejb is called repeatedly. I want each call of method C being a separate transaction. I can not make this work. the final result will always be one transaction from for loop. I set the transaction attribute as Requires for method B, and Requires New for method C. Please offer some help.
    Thanks.
    void ejbMethodB(){
    where(mycondition)
    ejbMethodC()
    I like to make each call of ejbMethodC be a standalone transaction instaed of the running results from the whole loop being a transaction

    First of all, thank you so much for your time.
    I also doubt the problem is Resin. But "Required" attribut works fine. The following is the coding:
    EJB implementation:
    //mehtodB
    public RequestResult getDailyCreateUpdateInfo(Request request)
    throws RemoteException, ProcessException
    boolean testFlag = false;
    List resultList = null;
    ClaimsDAO dao = null;
    Map mapRequestData = getRequestData(request);
    int num = 0;
    InterfacePushProcess push_process = (InterfacePushProcessRemote)(mySessionCtx.getEJBLocalObject());
    try {
    //Call DAO and get Student, ExchangeVisitor and their dependent information
    dao = (ClaimsDAO) getEntityObject(ClaimsDAO.class.getName());
    dataPushBO = new ClaimsDataImpl(mapRequestData);
    //get the list of categories for DOS or US-VISIT
    interdataList = dataPushBO.createCategoryList();
    Iterator iterator = interdataList.iterator();
    System.out.println("before invokeTransacprocess. ");
    //testing
    this.invokeTransacProcess();
    //process all the categories for DOS or US-VISIT
    while(iterator.hasNext())
    interconfigData = (InterfaceDataConfig) iterator.next();
    processOneCategory(mapRequestData, interconfigData, dao);
    } catch (Exception e) {
    mySessionCtx.setRollbackOnly();
    log.logp(Level.SEVERE, classname, "getDailyCreateUpdateInfo", e.getMessage());
    Object[] args = createExceptionArgs();
    args[0] = request.getName();
    throw new ProcessException(IMessage.ENTITY_POPULATION_FAILED, args, e);
    return new RequestResult(request, resultList);
    //mehtodC
    public void processOneCategory(Map reqmap, InterfaceDataConfig interconfigData, ClaimsDAO dao)
    throws ProcessException
    List pageList = null;
    String fileType = interconfigData.getGroupName(); //student, dep etc
    String countKey = interconfigData.getCountKey();
    String logKey = interconfigData.getIDKey();
    UserTransaction trans = null;
    int count = 0;
    boolean process = false;
    String groupname = interconfigData.getGroupName();
    log.logp(Level.INFO, classname, "processOneCategory() ", "group name = " + groupname);
    try
    Context ct = new InitialContext();
    trans = (UserTransaction) ct.lookup("java:comp/UserTransaction");
    trans.begin();
    String startTime = convert.getTimestamp();
    log.logp( Level.INFO, classname, "processOneCategory() ", "processing start time: "+startTime);
    pageList = processOnePage(interconfigData, dao);
    if (pageList.isEmpty())
    log.info("There are no records which need be processed.");
    else
    do
    try
    this.displayResult(pageList);
    process = pageOutputProcessor(reqmap, interconfigData, pageList);
    pageList.clear();
    pageList = this.processOnePage(interconfigData, dao);
    } catch (Exception ex) {
    mySessionCtx.setRollbackOnly();
    String msg = "Error while processing one page : " + ex.getMessage();
    log.logp(Level.SEVERE, classname, "processOneCategory() ", msg);
    throw new ProcessException(msg);
    } while (!pageList.isEmpty());
    //testing separate transaction
    if(groupname.equalsIgnoreCase("STUDENT"))
    trans.commit();
    else
    trans.rollback();
    } catch (Exception t) {
    mySessionCtx.setRollbackOnly();
    String m = "Error when processing results from ClaimsDAO's : " + t.getMessage();
    log.logp(Level.SEVERE, classname, "processOneCategory() ", m);
    throw new ProcessException(m);
    } finally {
    I put both methods: getDailyCreateUpdateInfo and processOneCategory in remote interface so I can use your suggested method to reference the EJB instance.
    Servlet Client call "getDailyCreateUpdateInfo" method (the transaction attribute is Required) in which call processOneCategory(,,) method (transaction attribute is RequiresNew).
    I put some testing code to see if I can achieve the separate transaction in each call of mehtod processOneCategory(,,) , it does not work. If I use Bean Managed Transaction, it works right away. My app. server is Resin 2.1.4.
    Again, Thank you.
    Mark

  • Transaction problem with stateless EJB and DAO

    Hi,
    I'm using a stateless session bean with container managed transaction and I have a method, which updates a row via CMP entity bean and then calls stored procedure, using a DAO object, which has to use the updated data. Both calls must be done in one transaction. The problem is that the stored procedure doesn't see the changes made from the update via CMP EJB, but after the method exits the changes are in the database. I'm using WebSphere 4.0.3 and DB2 7.2. Method code example in the stateless bean:
    public doIt(ValueObject vo) throws ... {
    OrderPosRemote opr = getOrderPosRemote();
    opr.update(vo);
    getDAO().recalc(vo);
    } catch (DAOException daoex) {
    getSessionContext().setRollbackOnly();
    And in the DAO:
    public boolean recalc(...) throws DAOException {
    Connection conn = getConnFromDataSource();
    CallableStatement cstmt = conn.prepareCall("call ...(?,?)");
    cstmt.execute();
    ... // close cstmt and release connection to the pool
    Any help will be highly appreciated !

    Hi meadandale,
    this was my first guess too and I set this attribute in the session bean method, then into the update method of the CMP bean and "manually" to the connection object in the DAO like this:
    conn.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
    The isolation level is set correctly (IMHO), because when I comment the line above in the DAO, an exception is thrown stating that the isolation level can't be changed within a transaction.
    Unfortenully this didn't help too. Should I set some special attribute to the database or connection pool additionally ?
    I don't understand what is the problem actually - it is definitely one transaction and why this doesn't work is not very clear to me ...

  • Problem with EJB and JMS - Failed to obtain/create connection

    hello ejb and jms programmers,
    My problem is my topic MDB keep on retrieving the same message when there is a database connection failure. Maybe somebody could help me how to prevent to retrieve the same data?
    Given:
    - I purposedly turn off the pointbase database because im testing my error handling.
    - Im using SJSAS 8 as my application server.
    - My message Driven Bean of topic type.
    - Im using CMP for my entity bean
    Here is the scenario of whats happening - step by step:
    1. A separate application publishes a message to JMS queue server
    2. My MDB retrieves this message and do some processing then inserts a record (transaction history) in my database
    3. But my db is turned off or down
    4. My MDB sends a successful processing reply to the JMS queue server
    5. Then i noticed that my server.log keeps on growing so when i opened it, the record was not inserted and printed the stacktrace below "RAR5117 : Failed to obtain/create connection. Reason : javax.transaction.SystemException" (complete stacktrace below)
    6. I understand the cause of the stacktrace is because the DB is turned off. But what i dont understand is that my MDB keeps on reading the same message. Since my MDB is of topic type, isnt a topic MDB supposedly reads a message only once???
    So my questions are:
    1. how do i handle insert database error?
    2. how can i stop my MDB from processing the same message?
    3. any better suggestions?
    Thank you in advance :)
    leigh
    *** more complete stack trace ***
    [#|2005-01-09T15:35:57.097+0800|WARNING|sun-appserver-pe8.0.0_01|javax.enterprise.system.core.transaction|_ThreadID=17;|JTS5041: The resource manager is doing work outside a global transaction
    javax.transaction.xa.XAException
         at com.pointbase.xa.xaException.getXAException(Unknown Source)
         at com.pointbase.xa.xaConnectionResource.start(Unknown Source)
         at com.sun.gjc.spi.XAResourceImpl.start(XAResourceImpl.java:162)
    [#|2005-01-09T15:35:57.167+0800|SEVERE|sun-appserver-pe8.0.0_01|javax.enterprise.resource.resourceadapter|_ThreadID=17;|RAR5027:Unexpected exception in resource pooling
    javax.transaction.SystemException
         at com.sun.jts.jta.TransactionImpl.enlistResource(TransactionImpl.java:185)
         at com.sun.enterprise.distributedtx.J2EETransaction.enlistResource(J2EETransaction.java:360)
         at com.sun.enterprise.distributedtx.J2EETransactionManagerImpl.enlistResource(J2EETransactionManagerImpl.java:303)
         at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.enlistResource(J2EETransactionManagerOpt.java:115)
    [#|2005-01-09T15:35:57.177+0800|WARNING|sun-appserver-pe8.0.0_01|javax.enterprise.resource.resourceadapter|_ThreadID=17;|RAR5117 : Failed to obtain/create connection. Reason : javax.transaction.SystemException|#]
    [#|2005-01-09T15:35:57.227+0800|WARNING|sun-appserver-pe8.0.0_01|javax.enterprise.resource.resourceadapter|_ThreadID=17;|RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: javax.transaction.SystemException]|#]
    [#|2005-01-09T15:35:57.237+0800|SEVERE|sun-appserver-pe8.0.0_01|javax.enterprise.system.container.ejb|_ThreadID=17;|EJB5071: Some remote or transactional roll back exception occurred
    com.sun.jdo.api.persistence.support.JDODataStoreException: JDO77006: SQL exception: state = null, error code = 0.
    NestedException: java.sql.SQLException: Error in allocating a connection. Cause: javax.transaction.SystemException
    FailedObjectArray: [[email protected]5ac]
         at com.sun.jdo.spi.persistence.support.sqlstore.impl.TransactionImpl.getConnectionInternal(TransactionImpl.java:1444)
         at com.sun.jdo.spi.persistence.support.sqlstore.impl.TransactionImpl.getConnection(TransactionImpl.java:1339)

    Hi annie,
    Wherever you are handling database transactions,
    you'd not be able to create a Connection if database
    is closed (I think you mentioned turning off the
    database) then at this condition, you should
    certainly throw a System level exception and stop all
    processing with some meaningful flow to indicate a
    failure (like display message on UI). Even
    network problems are handled by exceptions... so I
    don't see a reason why you didn't wrap it in the
    first place.
    Anyway, try handling specific exceptions rather than
    the general Exception... this will give you a better
    idea of what to do in case of an exception.Yes i know this. I am practicing this in my non-j2ee server applications. But the j2ee app im making, i just pass the db url in the descriptor and the app server automatically creates the connection for my app. So where would i put exception handling?
    2. how can i stop my MDB from processing the same
    message?Guaranteed delivery is not supposed to stop
    processing. It will continue to process the message
    after certain intervals till the message is
    delivered. You shouldn't deliver it at all, if you
    are able to detect that the database is off
    The problem here is that my MDB automatically retrieves the message from the JMS queue server. Im not the one retrieving the messages manually.
    My assumed behavior of topic MDB is once the a certain MDB retrieves a message it will not retrieve the same message anymore.
    thank you in advance.
    leigh

  • Problem with ejb 3.0 entity beans with manyToMany relationship

    Hello everyone!
    I am using struts 1.2.9 and java ee 5 sdk update 2 for my enterprise application. Besides others i have these entity beans Targetgroup.java and City.java, (i would upload file but i do not know how:)
    with manytomany relationship with join table.
    when user updates Targetgroup, by clicking on web page with checkboxes and textfields, struts dispatch action calls following method stateless bean:
    public void update(String firmId, String targetgroupId, String newGender, String newMinYearsOld, String newMaxYearsOld, String[] newCities) {
    TargetgroupPK pkForUpdate = new TargetgroupPK(targetgroupId, firmId);
    Targetgroup targetgroupForUpdate = find(pkForUpdate);
    targetgroupForUpdate.setGender(newGender);
    targetgroupForUpdate.setMinyearold(Integer.parseIn t(newMinYearsOld));
    targetgroupForUpdate.setMaxyearold(Integer.parseIn t(newMaxYearsOld));
    //pronalazenje gradva za koje je vezana ciljna grupa
    Collection<City> newCitiesCollection = new ArrayList<City>();
    for(int i = 0; i < newCities.length; i++){
    String tmp_city_name = newCities;
    City city_obj = cityFacade.find(tmp_city_name);
    newCitiesCollection.add(city_obj);
    targetgroupForUpdate.setCityidCollection(newCities Collection);
    parameter newCities represents names of cities which user checked on his update page. When the page is showen to him some cities are allready check because they were connected with Targetgruoup when it was created (targetgroup).
    this code throws following exception:
    [#|2007-07-26T12:13:36.993+0200|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.container.web|_Threa dID=16;_ThreadName=httpWorkerThread-8080-0;_RequestID=f79d9c50-86b0-4b6c-96ab-97956dfb39c1;|StandardWrapperValve[action]: Servlet.service() for servlet action threw exception
    javax.ejb.EJBException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.
    javax.transaction.RollbackException: Transaction marked for rollback.
    at
    .com.sun.enterprise.web.connector.grizzly.WorkerTh read.run(WorkerThread.java:75)
    javax.ejb.EJBException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.
    at com.sun.ejb.containers.BaseContainer.completeNewTx (BaseContainer.java:3659)
    at com.sun.ejb.containers.BaseContainer.postInvokeTx( BaseContainer.java:3431)
    at com.sun.ejb.containers.BaseContainer.postInvoke(Ba seContainer.java:1247)
    at com.sun.ejb.containers.EJBLocalObjectInvocationHan dler.invoke(EJBLocalObjectInvocationHandler.java:1 92)
    at com.sun.ejb.containers.EJBLocalObjectInvocationHan dlerDelegate.invoke(EJBLocalObjectInvocationHandle rDelegate.java:71)
    at $Proxy149.update(Unknown Source)
    at audiotel.sms.actions.backoffice.TargetgroupDispatc hAction.updateOrDelete(TargetgroupDispatchAction.j ava:132)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.struts.actions.DispatchAction.dispatchM ethod(DispatchAction.java:270)
    at org.apache.struts.actions.DispatchAction.execute(D ispatchAction.java:187)
    at org.apache.struts.action.RequestProcessor.processA ctionPerform(RequestProcessor.java:431)
    at org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:236)
    at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1196)
    at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:432)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:727)
    com.sun.enterprise.web.connector.grizzly.WorkerThr ead.run(WorkerThread.java:75)
    |#]
    exceprion is throwen ONLY when in parameter newCities are city names allready connected to Targetgroup. when NewCities contains names of
    City objects which are not connected to Targetgroup it works fine, but it's of no use for me, because user must be able to add or remove certian cities from relaionship with Targetgroup. I think it's because there are rows in join table that contain primary keys of city and targetgroup which are connected so perisistence manager cann't write them again.
    i thought it was going to figure it out by itself, and only update those rows.
    Does anyone know what is the problem and solution?
    Thanks! (forgive my spelling errors :)

    solved the problem!
    I moved code from sesion bean to struts action as follows:
    CityFacadeLocal cityFacade = lookupCityFacade();
    //prikupljanje novih podataka o ciljnoj grupi
    String newGender = ctf.getGender();
    String newMaxYears = ctf.getMaxyears();
    String newMinYears = ctf.getMinyears();
    String[] newSelectedCities = ctf.getSelectedCities();
    //niz imena gradova se prevodi u kolekcju objekata City
    Collection<City> newCitiesObjCollection = new Vector<City>();
    for(int i = 0; i < newSelectedCities.length; i++){
    String tmpCityName = newSelectedCities;
    City tmpCityObj = cityFacade.find(tmpCityName);
    newCitiesObjCollection.add(tmpCityObj);
    //setovanje novih podataka
    targetgroupForUD.setGender(newGender);
    targetgroupForUD.setMinyearold(Integer.parseInt(newMinYears));
    targetgroupForUD.setMaxyearold(Integer.parseInt(newMaxYears));
    targetgroupForUD.setCityidCollection(newCitiesObjCollection);
    //pozivanje update metdoe u session beany
    targetgroupFacade.edit(targetgroupForUD);
    //korisnik se vraca na stranu sa svim postojecim ciljnim grupama
    forward = mapping.findForward("backend.targetgroups");
    and now it works fine. I guess probelm was same transaction scope for Targetgroup and City entities. Now when they are separated it works.
    Thanks!

  • Stored procedure in a transaction problem

    hello to everybody
    I have an application under weblogic8.1 sp3.
    I have to call an Oracle stored procedure that populate a table and I have to see the new record anly at the end of the ejb service transaction ( a Container transaction ).When the procedure terminate I see the db data before the transaction end.So I have created a XA DataSource and changed the oracle 9.2 thin drivers in oracle 9.2 thin drivers XA.But Now I receive this Oracle Error:
    ORA-02089: COMMIT is not allowed in a subordinate session
    Why?How Can I resolve my problem?Can Anyone Help Me?Thanks...

    giorgio giustiniani wrote:
    hello to everybody
    I have an application under weblogic8.1 sp3.
    I have to call an Oracle stored procedure that populate a table and I have to see the new record anly at the end of the ejb service transaction ( a Container transaction ).When the procedure terminate I see the db data before the transaction end.So I have created a XA DataSource and changed the oracle 9.2 thin drivers in oracle 9.2 thin drivers XA.But Now I receive this Oracle Error:
    ORA-02089: COMMIT is not allowed in a subordinate session
    Why?How Can I resolve my problem?Can Anyone Help Me?Thanks...It sounds like you have transactional syntax embedded in your
    procedure. You can't do that and still include it in an XA
    transaction.
    Joe

  • Transaction problem with jconn5.2

    jconn5.2 and iASsp2
    I am using Bean Managed Transaction in my application, start the first
    transaction is fine, but once the application going to start another
    transaction, errors occoured:
    "the transaction onwer is not in current thread".

    Hi,
    I've had the very same problem with RAD.
    Try to set the Transaction attribute to SUPPORTS. With SUPPORTS the EJB method will use the same transaction as the caller.
    package hu.bme.ett.raktar.facade;
    import hu.bme.ett.raktar.ejbs.Raktar;
    import hu.bme.ett.raktar.ejbs.controller.RaktarManager;
    import javax.ejb.Stateless;
    import javax.ejb.TransactionAttribute;
    import javax.ejb.TransactionAttributeType;
    @Stateless
    @TransactionAttribute(TransactionAttributeType.SUPPORTS)
    public class RaktarListazas implements RaktarListazasLocal {
         RaktarManager rm = new RaktarManager();
         * Default constructor.
        public RaktarListazas() {
            // TODO Auto-generated constructor stub
        public Raktar getRaktar(long raktId) {
             return rm.findRaktarByRaktId(raktId);
        public void createRaktar(long raktId) {
             Raktar r = new Raktar();
             r.setRaktId(raktId);
             r.setRaktAzonosito("Y1RAK-01" + raktId);
             r.setMegnevezes("Elso raktaram");
             try {
                   rm.createRaktar(r);
              } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    }Cheers,
    Viktor

  • JMS Queue problems causing EJB to rollback....

              We recently purchased WLS 6.1 and we have been using the product for the last few
              months. I am having a problem which I have detailed below. I have provided as much
              information as possible. If you need additional information, please let me know.
              Server A Config:
              Pentium III, 1000Mhz
              Windows 2000, SP2
              WLS WebLogic Server 6.1 SP2 12/18/2001 11:13:46 #154529
              Server B Config:
              SunBlade 100
              Solaris 5.8
              WebLogic Server 6.1 SP2 12/18/2001 11:13:46 #154529
              Server A contains a session EJB called GoalManager. This EJB has a method named cancel().
              The transactional attribute for all methods supported by this bean is REQUIRED. GoalManager
              uses a transactional data source deployed on Server A named "goal". There is nothing
              special about this data source aside from the fact that I have enabled two phase
              commit for it because a previous error was indicating that this was a required setting
              for the pool. A JMS server exists on Server B. A queue named "emailQueue" is set
              up as a destination on this JMS server. I also have a MDB on Server B that listens
              for messages on this queue. When a message is received, the MDB's onMessage() method
              extracts some properties from the message and sends an email to the specified recipient
              in the message. I have confirmed that this queue and MDB are working properly because
              I ran a small test program from the command prompt which creates a message and sends
              it to the queue on Server B. The MDB gets the message and sends the email to the
              correct recipient, so I am sure there are no misconfigurations on the server.
              The problem is as follows: The cancel() method in the GoalManager EJB on Server A
              performs some database work. If no exceptions are raised, the last task in the method
              attempts to access the queue on Server B and send a message to the queue. Here is
              the code that I am using to access the queue:
              QueueConnectionFactory queueFactory = (QueueConnectionFactory)context.lookup( "javax.jms.QueueConnectionFactory");
              QueueConnection queueConnection = queueFactory.createQueueConnection();
              Queue queue = (Queue)context.lookup( "emailQueue");
              QueueSession queueSession = queueConnection.createQueueSession( false, Session.AUTO_ACKNOWLEDGE);
              QueueSender queueSender = queueSession.createSender( queue);
              The cancel() method executes without error, but when the EJB container on Server
              A attempts to commit the transaction at the end of the cancel() method, I am receiving
              the following error on Server A's log:
              <Error> <EJB> <Exception during commit of transaction Name=[EJB com.frx.emp.go.ejb.session.goal.GoalManagerBean.cancelGoal(com.frx.emp.entity.Employee,com.frx.emp.go.entity.Goal)],
              Xid=0:7c2dda32cf39a36e(6911242),
              Status=Rolled back. [Reason=javax.transaction.xa.XAException],
              numRepliesOwedMe=0,
              numRepliesOwedOthers=0,
              seconds since begin=2,
              seconds left=10,
              ServerResourceInfo[weblogic.jdbc.jts.Connection]=(state=rolledback,assigned=server1),
              ServerResourceInfo[JMS_EMailServer_NotDurable]=(state=rolledback,assigned=server1),
              SCInfo[FRX+server1]=(state=rolledback),
              SCInfo[frxnet+wlsvr1]=(state=rolledback),
              properties=({weblogic.transaction.name=[EJB com.frx.emp.go.ejb.session.goal.GoalManagerBean.cancelGoal(com.frx.emp.entity.Employee,com.frx.emp.go.entity.Goal)],
              weblogic.jdbc=t3://172.16.200.9:9005}),
              OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=server1+172.16.200.9:9005+FRX+,
              Resources={})],
              CoordinatorURL=server1+172.16.200.9:9005+FRX+): javax.transaction.xa.XAException
              at weblogic.jms.backend.BEXAResource.prepare(BEXAResource.java:853)
              at weblogic.transaction.internal.ServerResourceInfo.prepare(ServerResourceInfo.java:1124)
              at weblogic.transaction.internal.ServerResourceInfo.prepare(ServerResourceInfo.java:370)
              at weblogic.transaction.internal.ServerSCInfo.startPrepare(ServerSCInfo.java:186)
              at weblogic.transaction.internal.ServerTransactionImpl.localPrepare(ServerTransactionImpl.java:1822)
              at weblogic.transaction.internal.ServerTransactionImpl.globalPrepare(ServerTransactionImpl.java:1607)
              at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:218)
              at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:190)
              at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:231)
              at com.frx.emp.go.ejb.session.goal.GoalManagerBean_e3dvd2_EOImpl.cancelGoal(GoalManagerBean_e3dvd2_EOImpl.java:459)
              at com.frx.emp.go.web.handler.UpdateGoalHandler.handleRequest(UpdateGoalHandler.java:55)
              at com.frx.emp.web.mvc.HandlerMappedController.service(HandlerMappedController.java:115)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
              at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2495)
              at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2204)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              --------------- nested within: ------------------
              weblogic.transaction.RollbackException: Could not prepare resource 'JMS_EMailServer_NotDurable
              - with nested exception:
              [javax.transaction.xa.XAException]
              at weblogic.transaction.internal.TransactionImpl.throwRollbackException(TransactionImpl.java:1475)
              at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:263)
              at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:190)
              at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:231)
              at com.frx.emp.go.ejb.session.goal.GoalManagerBean_e3dvd2_EOImpl.cancelGoal(GoalManagerBean_e3dvd2_EOImpl.java:459)
              at com.frx.emp.go.web.handler.UpdateGoalHandler.handleRequest(UpdateGoalHandler.java:55)
              at com.frx.emp.web.mvc.HandlerMappedController.service(HandlerMappedController.java:115)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
              at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2495)
              at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2204)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              Just a quick note, I tried to change the following line to specify a "transacted"
              JMS session by passing "true" to the statement below. When I tested this, the cancel()
              method raised no exceptions, but the MDB on Server B is never invoked and the email
              is never sent. Strange.
              QueueSession queueSession = queueConnection.createQueueSession( true, Session.AUTO_ACKNOWLEDGE);
              If you need more info, let me know. I thank you for your help.
              

    Correct. According to the trace you have it set at 10 seconds, while the default is 30 seconds.
              Tom
              SAF wrote:
              > Thanks for the reply.
              >
              > Increase the trx time? You mean JTA, right?
              >
              > I already opened a case with BEA, so I'm waiting to get a response from them.
              >
              > Thanks again,
              >
              > Raffi
              >
              > Tom Barnes <[email protected]> wrote:
              > >Hi,
              > >
              > >I looked at the BEXAResource.java source code which the stack trace points
              > >at. It seems that from the
              > >JMS server's resource manager's point of view, it never heard of the transaction
              > >before, indicating
              > >that the transaction may have already rolled back. I think this could
              > >happen if the transaction
              > >times out before commit() is called, but I'm not sure what is wrong in your
              > >case -- as according
              > >to the trace you provided, your tx is 2 seconds old and your tx-timout is
              > >10 seconds.
              > >
              > >In any case, it looks like the culprit may be in the transaction code and
              > >not the JMS code...
              > >
              > >I suggest:
              > > A) increasing your tx timeout (what the heck give it a try)
              > > B) could it somehow be a clock synchronization problem? are multiple
              > >servers involved?
              > > C) posting to the transaction newsgroup
              > > D) contacting customer support
              > >
              > >Tom
              > >
              > >SAF wrote:
              > >
              > >> We recently purchased WLS 6.1 and we have been using the product for the
              > >last few
              > >> months. I am having a problem which I have detailed below. I have provided
              > >as much
              > >> information as possible. If you need additional information, please let
              > >me know.
              > >>
              > >> Server A Config:
              > >> Pentium III, 1000Mhz
              > >> Windows 2000, SP2
              > >> WLS WebLogic Server 6.1 SP2 12/18/2001 11:13:46 #154529
              > >>
              > >> Server B Config:
              > >> SunBlade 100
              > >> Solaris 5.8
              > >> WebLogic Server 6.1 SP2 12/18/2001 11:13:46 #154529
              > >>
              > >> Server A contains a session EJB called GoalManager. This EJB has a method
              > >named cancel().
              > >> The transactional attribute for all methods supported by this bean is
              > >REQUIRED. GoalManager
              > >> uses a transactional data source deployed on Server A named "goal". There
              > >is nothing
              > >> special about this data source aside from the fact that I have enabled
              > >two phase
              > >> commit for it because a previous error was indicating that this was a
              > >required setting
              > >> for the pool. A JMS server exists on Server B. A queue named "emailQueue"
              > >is set
              > >> up as a destination on this JMS server. I also have a MDB on Server B
              > >that listens
              > >> for messages on this queue. When a message is received, the MDB's onMessage()
              > >method
              > >> extracts some properties from the message and sends an email to the specified
              > >recipient
              > >> in the message. I have confirmed that this queue and MDB are working properly
              > >because
              > >> I ran a small test program from the command prompt which creates a message
              > >and sends
              > >> it to the queue on Server B. The MDB gets the message and sends the email
              > >to the
              > >> correct recipient, so I am sure there are no misconfigurations on the
              > >server.
              > >>
              > >> The problem is as follows: The cancel() method in the GoalManager EJB
              > >on Server A
              > >> performs some database work. If no exceptions are raised, the last task
              > >in the method
              > >> attempts to access the queue on Server B and send a message to the queue.
              > >Here is
              > >> the code that I am using to access the queue:
              > >>
              > >> QueueConnectionFactory queueFactory = (QueueConnectionFactory)context.lookup(
              > >"javax.jms.QueueConnectionFactory");
              > >> QueueConnection queueConnection = queueFactory.createQueueConnection();
              > >> Queue queue = (Queue)context.lookup( "emailQueue");
              > >> QueueSession queueSession = queueConnection.createQueueSession( false,
              > >Session.AUTO_ACKNOWLEDGE);
              > >> QueueSender queueSender = queueSession.createSender( queue);
              > >>
              > >> The cancel() method executes without error, but when the EJB container
              > >on Server
              > >> A attempts to commit the transaction at the end of the cancel() method,
              > >I am receiving
              > >> the following error on Server A's log:
              > >>
              > >> <Error> <EJB> <Exception during commit of transaction Name=[EJB com.frx.emp.go.ejb.session.goal.GoalManagerBean.cancelGoal(com.frx.emp.entity.Employee,com.frx.emp.go.entity.Goal)],
              > >> Xid=0:7c2dda32cf39a36e(6911242),
              > >> Status=Rolled back. [Reason=javax.transaction.xa.XAException],
              > >> numRepliesOwedMe=0,
              > >> numRepliesOwedOthers=0,
              > >> seconds since begin=2,
              > >> seconds left=10,
              > >> ServerResourceInfo[weblogic.jdbc.jts.Connection]=(state=rolledback,assigned=server1),
              > >> ServerResourceInfo[JMS_EMailServer_NotDurable]=(state=rolledback,assigned=server1),
              > >> SCInfo[FRX+server1]=(state=rolledback),
              > >> SCInfo[frxnet+wlsvr1]=(state=rolledback),
              > >> properties=({weblogic.transaction.name=[EJB com.frx.emp.go.ejb.session.goal.GoalManagerBean.cancelGoal(com.frx.emp.entity.Employee,com.frx.emp.go.entity.Goal)],
              > >>
              > >> weblogic.jdbc=t3://172.16.200.9:9005}),
              > >> OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=server1+172.16.200.9:9005+FRX+,
              > >> Resources={})],
              > >> CoordinatorURL=server1+172.16.200.9:9005+FRX+): javax.transaction.xa.XAException
              > >> at weblogic.jms.backend.BEXAResource.prepare(BEXAResource.java:853)
              > >> at weblogic.transaction.internal.ServerResourceInfo.prepare(ServerResourceInfo.java:1124)
              > >> at weblogic.transaction.internal.ServerResourceInfo.prepare(ServerResourceInfo.java:370)
              > >> at weblogic.transaction.internal.ServerSCInfo.startPrepare(ServerSCInfo.java:186)
              > >> at weblogic.transaction.internal.ServerTransactionImpl.localPrepare(ServerTransactionImpl.java:1822)
              > >> at weblogic.transaction.internal.ServerTransactionImpl.globalPrepare(ServerTransactionImpl.java:1607)
              > >> at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:218)
              > >> at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:190)
              > >> at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:231)
              > >> at com.frx.emp.go.ejb.session.goal.GoalManagerBean_e3dvd2_EOImpl.cancelGoal(GoalManagerBean_e3dvd2_EOImpl.java:459)
              > >> at com.frx.emp.go.web.handler.UpdateGoalHandler.handleRequest(UpdateGoalHandler.java:55)
              > >> at com.frx.emp.web.mvc.HandlerMappedController.service(HandlerMappedController.java:115)
              > >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              > >> at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
              > >> at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
              > >> at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2495)
              > >> at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2204)
              > >> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              > >> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              > >> --------------- nested within: ------------------
              > >> weblogic.transaction.RollbackException: Could not prepare resource 'JMS_EMailServer_NotDurable
              > >> - with nested exception:
              > >> [javax.transaction.xa.XAException]
              > >> at weblogic.transaction.internal.TransactionImpl.throwRollbackException(TransactionImpl.java:1475)
              > >> at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:263)
              > >> at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:190)
              > >> at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:231)
              > >> at com.frx.emp.go.ejb.session.goal.GoalManagerBean_e3dvd2_EOImpl.cancelGoal(GoalManagerBean_e3dvd2_EOImpl.java:459)
              > >> at com.frx.emp.go.web.handler.UpdateGoalHandler.handleRequest(UpdateGoalHandler.java:55)
              > >> at com.frx.emp.web.mvc.HandlerMappedController.service(HandlerMappedController.java:115)
              > >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              > >> at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
              > >> at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
              > >> at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2495)
              > >> at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2204)
              > >> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              > >> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              > >>
              > >> Just a quick note, I tried to change the following line to specify a "transacted"
              > >> JMS session by passing "true" to the statement below. When I tested this,
              > >the cancel()
              > >> method raised no exceptions, but the MDB on Server B is never invoked
              > >and the email
              > >> is never sent. Strange.
              > >>
              > >> QueueSession queueSession = queueConnection.createQueueSession( true,
              > >Session.AUTO_ACKNOWLEDGE);
              > >>
              > >> If you need more info, let me know. I thank you for your help.
              > >
              

  • Global transaction problem with JDriver/Oracle and Oracle XA

    We are haveing serious problems with Container Managed Transactions on Bea 6.1
    and Oracle with EJB having set "Required" for all methods. We have tried in vain
    to make it work with JDriver as well as OracleXAClient. Both fail at sometime
    during the execution throwing "Not called in cotext of global transaction" (with
    JDriver) OR "XAER_PROTO : Routine was invoked in an
    inproper context start() failed on resource 'OracleXAPool'" (this one with oracle
    XA).
    1.) Weblogic JDriver-XA:
    DatabaseMetaData metaData = dataSource.getJDBCConnection.getMetaData();
    ResultSet resultSet = metaData.getTables(null, null, tableName.toUpperCase(),
    new String[]{"TABLE"});
    This fails immmediately saying that it was not called from global transaction.
    Interesting thing is that with OracleXA, it doesnt say this exception at this
    check point.
    2) Oracle XA
    Okie, we couldnot read through the CLOB using it so for reading CLOB, we used
    direct jdbc connection and then did away with it. Now all next sql queries were
    executed against oracle pool using XA data source with OracleXAClient. But at
    some point we again ran into the problem "XAER_PROTO : Routine was invoked in
    an
    inproper context start() failed on resource 'OracleXAPool'"
    3 Oracle Thin Driver
    everything always works with it.

    AFAIR this issue was resoved by moving tx opreations out from non-tx
    methods.
    Regards,
    Slava
    "Apurb Kumar" <[email protected]> wrote in message
    news:[email protected]...
    Jawad,
    It would be nice if you can post the full stack trace error message. Didyou try moving to
    the latest service pack (sp2) for WLS6.1.
    Thanks,
    Jawad Mahmood wrote:
    Yes we had correctly set TXDataSource and let it to point to the right
    connection
    pool each time and it worked well with oracle thin driver but not whenwe switched
    the pool to JDriver or OracleXAClient. Note that we could aways confirmthat pool
    was successfully created alongwith we could retrieve connection from itvia TXDatSource,
    things gave problem after we attempted to do what i had mentioned in mylast posting.
    >>
    Also with JBoss 2.4.4 things work pretty well. So couldnt be our codeproblem.
    "Slava Imeshev" <[email protected]> wrote:
    Jawad,
    Did you set up TxDataSource?
    Regards,
    Slava Imeshev
    "Jawad Mahmood" <[email protected]> wrote in message
    news:[email protected]...
    We are haveing serious problems with Container Managed Transactionson
    Bea 6.1
    and Oracle with EJB having set "Required" for all methods. We havetried
    in vain
    to make it work with JDriver as well as OracleXAClient. Both fail atsometime
    during the execution throwing "Not called in cotext of global
    transaction"
    (with
    JDriver) OR "XAER_PROTO : Routine was invoked in an
    inproper context start() failed on resource 'OracleXAPool'" (this onewith
    oracle
    XA).
    1.) Weblogic JDriver-XA:
    DatabaseMetaData _metaData =
    _dataSource.getJDBCConnection.getMetaData();
    ResultSet resultSet = metaData.getTables(null, null,tableName.toUpperCase(),
    new String[]{"TABLE"});
    This fails immmediately saying that it was not called from globaltransaction.
    Interesting thing is that with OracleXA, it doesnt say this exceptionat
    this
    check point.
    2) Oracle XA
    Okie, we couldnot read through the CLOB using it so for reading CLOB,we
    used
    direct jdbc connection and then did away with it. Now all next sqlqueries
    were
    executed against oracle pool using XA data source with
    OracleXAClient.
    But
    at
    some point we again ran into the problem "XAER_PROTO : Routine wasinvoked
    in
    an
    inproper context start() failed on resource 'OracleXAPool'"
    3 Oracle Thin Driver
    everything always works with it.
    Apurb Kumar

  • Transaction handling between EJBs

    hi,
    I am having a delegate kind of Stateless Session Bean(SSB which calls three other SSBs and perform database operations. My delegate bean does not have any database activities associated with it.
    I am using container managed transaction and setting transaction attribute for the business function calling the 3 SSBs as RequiresNew. I have set the transaction attribute for the other 3 beans as Required. But when there is a update error, the transaction is not rolling back. Have someone come across similar problem?
    Thanks in advance.
    Regards,
    Karthik

    An user exception (in the EJB spec. called application exception) must not be extend RunTimeException.
    Hi crackers, here are some sentences from the EJB specification:
    Code that you develop should not throw EJBException - that's "reserved" for the container vendor to signal a container failure.EJB Spec. 2.0 (page373):
    If the bean method performs an operation that results in a checked exception[32] that the bean
    method cannot recover, the bean method should throw the javax.ejb.EJBException
    that wraps the original exception.
    Not entirely accurate. If a user-defined Exception extends the Exception class, yes, you must explicitly rollback the transaction. However, if the user-defined Exception extends RuntimeException, the container will roll back the exception for you.EJB Spec. 2.0 (page372):
    An application exception class must be a subclass (direct or indirect) of java.lang.Exception.
    An application exception class must not be defined as a subclass of the java.lang.RuntimeException
    or of the java.rmi.RemoteException.

  • Transaction Problem - Timeout

    Folks
    I am experiencing a Transaction timeout error on a supposed non-transacted method.
    Here's the scoop. The Stateless Session bean MemberManager has the Transaction
    Attribute set either as "SUPPORTS" or "REQUIRED". Gets and Finds are set to "SUPPORTS"
    The Entity beans MemberBean and PolicyHolderBean have all method transaction
    attributes set to SUPPORTS. As you can tell transaction mgt is handled at the
    SBlevel.
    <container-transaction>
    <method>
    <ejb-name>MemberManager</ejb-name>
    <method-name>getMemberModel</method-name>
    </method>
    <trans-attribute>Supports</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>MemberBean</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Supports</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>PolicyHolderBean</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Supports</trans-attribute>
    </container-transaction>
    The call to MemberManager.getMemberModel is thus non-transacted. Yet I recieve
    (from time to time) a Transaction timeout on the PolicyHolderBean.findByPrimaryKey.
    (FYI there is a 1:1 CMR relationship between Member and PolicyHolder). The stack
    trace follows. Any help is appreciated. Why is this being transacted?
    ####<Sep 23, 2002 2:12:43 PM EDT> <Error> <com.hmcng.service.job.AbstractJob>
    <HMCAPPSVR3> <NextGen3> <Thread-111> <> <21104:3b4203690f8f04a5> <000000> <abstractjob.generate.exception.exception:
    letterservice.updatejobstatuserror.remoteexception: Message was not sent because
    transaction is not active. Name=[EJB com.hmcng.member.entity.MemberBean.findByPrimaryKey(java.lang.Integer)],Xid=21104:3b4203690f8f04a5(3304037),Status=Rolled
    back. [Reason=weblogic.transaction.internal.TimedOutException: Transaction timed
    out after 33 seconds
    Name=[EJB com.hmcng.member.entity.MemberBean.findByPrimaryKey(java.lang.Integer)],Xid=21104:3b4203690f8f04a5(3304037),Status=Active,numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds
    since begin=33,seconds left=30,activeThread=Thread[Thread-111,2,main],ServerResourceInfo[weblogic.jdbc.jts.Connection]=(state=started,assigned=none),SCInfo[hmc_letters+NextGen3]=(state=active),properties=({ISOLATION
    LEVEL=2, weblogic.transaction.name=[EJB com.hmcng.member.entity.MemberBean.findByPrimaryKey(java.lang.Integer)],
    weblogic.jdbc=t3://172.25.64.69:7901, LOCAL_ENTITY_TX=true}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=NextGen3+172.25.64.69:7901+hmc_letters+,
    Resources={})],CoordinatorURL=NextGen3+172.25.64.69:7901+hmc_letters+)],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds
    since begin=66,seconds left=10,activeThread=Thread[Thread-111,2,main],ServerResourceInfo[weblogic.jdbc.jts.Connection]=(state=rolledback,assigned=NextGen3),SCInfo[hmc_letters+NextGen3]=(state=rolledback),properties=({ISOLATION
    LEVEL=2, weblogic.transaction.name=[EJB com.hmcng.member.entity.MemberBean.findByPrimaryKey(java.lang.Integer)],
    weblogic.jdbc=t3://172.25.64.69:7901, LOCAL_ENTITY_TX=true}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=NextGen3+172.25.64.69:7901+hmc_letters+,
    Resources={})],CoordinatorURL=NextGen3+172.25.64.69:7901+hmc_letters+)>
    ####<Sep 23, 2002 2:12:43 PM EDT> <Error> <com.hmcng.service.job.AbstractJob>
    <HMCAPPSVR3> <NextGen3> <Thread-111> <> <21104:3b4203690f8f04a5> <000000> <abstractjob.generate.exception:
    memberservice.getmembermodel.remoteexception: member.unable.to.find.member: Problem
    in findByPrimaryKey while preparing or executing statement: 'weblogic.jdbc.rmi.SerialPreparedStatement@14b404':
    java.sql.SQLException: The transaction is no longer active (status = Rolling Back.
    [Reason=weblogic.transaction.internal.TimedOutException: Transaction timed out
    after 33 seconds
    Name=[EJB com.hmcng.member.entity.MemberBean.findByPrimaryKey(java.lang.Integer)],Xid=21104:3b4203690f8f04a5(3304037),Status=Active,numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds
    since begin=33,seconds left=30,activeThread=Thread[Thread-111,2,main],ServerResourceInfo[weblogic.jdbc.jts.Connection]=(state=started,assigned=none),SCInfo[hmc_letters+NextGen3]=(state=active),properties=({ISOLATION
    LEVEL=2, weblogic.transaction.name=[EJB com.hmcng.member.entity.MemberBean.findByPrimaryKey(java.lang.Integer)],
    weblogic.jdbc=t3://172.25.64.69:7901, LOCAL_ENTITY_TX=true}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=NextGen3+172.25.64.69:7901+hmc_letters+,
    Resources={})],CoordinatorURL=NextGen3+172.25.64.69:7901+hmc_letters+)]). No further
    JDBC access is allowed within this transaction.
    java.sql.SQLException: The transaction is no longer active (status = Rolling Back.
    [Reason=weblogic.transaction.internal.TimedOutException: Transaction timed out
    after 33 seconds
    Name=[EJB com.hmcng.member.entity.MemberBean.findByPrimaryKey(java.lang.Integer)],Xid=21104:3b4203690f8f04a5(3304037),Status=Active,numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds
    since begin=33,seconds left=30,activeThread=Thread[Thread-111,2,main],ServerResourceInfo[weblogic.jdbc.jts.Connection]=(state=started,assigned=none),SCInfo[hmc_letters+NextGen3]=(state=active),properties=({ISOLATION
    LEVEL=2, weblogic.transaction.name=[EJB com.hmcng.member.entity.MemberBean.findByPrimaryKey(java.lang.Integer)],
    weblogic.jdbc=t3://172.25.64.69:7901, LOCAL_ENTITY_TX=true}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=NextGen3+172.25.64.69:7901+hmc_letters+,
    Resources={})],CoordinatorURL=NextGen3+172.25.64.69:7901+hmc_letters+)]). No further
    JDBC access is allowed within this transaction.
    at weblogic.jdbc.jts.Connection.checkIfRolledBack(Connection.java:508)

              "Jeremy Meyer" <[email protected]> wrote:
              >I am running WL 6.0 on Win NT 4.0 SP 6
              >
              >I am having a problem with a transaction timing out while doing some stuff
              >with EJBs. They do some calculations that can take a few minutes and thus
              >the transactions must last that long but they are timing out after 30
              >seconds. I went to the console and changed the timeout time to a higher
              >setting. This seemed to work but then when I did the same thing a little
              >while later it timed out after 30 seconds again. I look at the console and
              >it says the timeout time is 180 seconds. Any thoughts on what I am doing
              >wrong/why it is acting this way? Thanks.
              Ugh. This is a known problem. As it turns out, EJB's deployment descriptor defaults
              to 30 seconds if a timeout value is not specified. It then overrides the JTA subsystem's
              default timeout settings.
              The workaround is to always specify a valid transaction timeout in the EJB's DD,
              and not to let it default.
              -Sriram
              

Maybe you are looking for

  • Replace the connection string in Excel MDS file

    I had MDS solution from one SQL Server 2012 to another - SQL Server 2014. I have configured Excel file with connection to MDS. How can I safely to replace the connection string in my Excel MDS file and the tables is not broken? from Moscow with money

  • Getting references of a methods

    Hi experts, I am trying to create a cross-refernce tool using Java for our project. I need to get the list of all the references of the method,class throughout the application. Is it possible to do so? If so how can i achieve it? Waiting for a reply,

  • Materials for sap configuraion

    hi, i want to configure bw system with other systems where can i get materials for that.

  • FileVault -- computer speed crawls

    I used FileVault today to encrypt files - reduced computer speed drastically. What is the solution?

  • 2lis_02_HDR transfer rule is Not Avalibale in BI content

    Dear all I am trying to activate 2lis_02_HDR and other Purchase related Transfer rule in Production system of BI for Production System of ECC , I am able to see all those datasourese to other module but not able to find 2lis_02_HDR,2LIS_02_ITM in BI