Announcement Announcement Module
Collapse
No announcement yet.
Spring -> EJB Transaction issue Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring -> EJB Transaction issue

    Hi, I am having an application in which I am using the following scenario and in which am getting exception if I use XA data source(keep in mind this is not throwing exception if I use non-XA)

    1. Spring begins the transaction and inserts a record
    2. Spring calls an eJB to do some more db inserts (Getting exception while try to insert the record here and exception is Timed-Out exception)
    3. Spring commits transaction

    I am using org.springframework.transaction.jta.JtaTransaction Manager and even I tried org.springframework.transaction.jta.WebLogicJtaTra nsactionManager as my application server is Weblogic and still am getting the exception if I use XA datasource.

  • #2
    Post exception and configuration. when doing so use [ code][/code ] tags.

    Comment


    • #3
      Him Marten, thanks for your reply, here are the configuration settings
      Code:
      applicationContext-web-online.xml
      
          <bean id="massOrderService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
              <property name="transactionManager"><ref bean="transactionManager"/></property>
              <property name="target"><ref local="massorderServiceTarget"/></property>
              <property name="transactionAttributes">
                  <props>
                      <prop key="*">PROPAGATION_REQUIRED</prop>
                  </props>
              </property>
          </bean>
      
          <bean id="massorderServiceTarget" class="net.massorder.logic.MassOrderServiceImpl">
              <property name="orderService"><ref bean="orderService"/></property>
              <property name="massOrderDAO"><ref bean="massOrderDao"/></property>
              <property name="orderFieldDAO"><ref bean="orderFieldDao"/></property>
          </bean>
      
          <!-- used by mass orders -->
          <bean id="orderFieldDao" class="net.massorder.dao.OrderFieldDAO">
              <property name="dataSource"><ref bean="dataSource"/></property>
          </bean>
      
          <bean id="massOrderDao" class="net.massorder.dao.MassOrderDAO">
              <property name="dataSource"><ref bean="dataSource"/></property>
          </bean>
      
      
      	<!-- Main JNDI DataSource for J2EE environments -->
      	<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
      		<property name="jndiName"><value>java:comp/env/jdbc/DAODataSource</value></property>
      	</bean>
      
      	<!-- Transaction manager that delegates to JTA (for a transactional JNDI DataSource) -->
      	<bean id="transactionManager" class="org.springframework.transaction.jta.WebLogicJtaTransactionManager">
          	<property name="transactionManagerName" value="javax.transaction.TransactionManager" />
      	</bean>
      
      -----------------------------------------------------------------
      Here is the ejb configuration
      
      ejb-jar.xml
      
              <session>
                  <description>Order Service</description>
                  <display-name>EJB OrderService</display-name>
                  <ejb-name>OrderService</ejb-name>
                  <home>net.order.logic.ejb.OrderServiceHome</home>
                  <remote>net.order.logic.ejb.OrderService</remote>
                  <ejb-class>net.order.logic.ejb.OrderServiceBean</ejb-class>
                  <session-type>Stateless</session-type>
                  <transaction-type>Bean</transaction-type>
                  <env-entry>
                      <env-entry-name>ejb/BeanFactoryPath</env-entry-name>
                      <env-entry-type>java.lang.String</env-entry-type>
                      <env-entry-value>applicationContext-backend-online.xml applicationContext-backend.xml</env-entry-value>
                  </env-entry>
                  <resource-ref>
                       <res-ref-name>jdbc/DAODataSource</res-ref-name>
                       <res-type>javax.sql.DataSource</res-type>
                       <res-auth>Container</res-auth>
                  </resource-ref>
              </session>
      
      
      And there is not container-transaction specified for this ejb.
      ----------------------------------------------------------------------
      
      <03-Feb-2011 15:41:58> <Error> <mercury_r06_d17_m201_tip> <BEA-000000> <MercuryAppletAction> <Exception in appletExecute. Returning error response to applet
      org.springframework.transaction.UnexpectedRollbackException: JTA transaction already rolled back (probably due to a timeout)
              at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1026)
              at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:709)
              at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:678)
              at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:359)
              at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
              at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
              at $Proxy122.createMassOrder(Unknown Source)
              at net.scee.pinpoint.apps.mercury.massorder.struts.SaveMassOrderAction.appletExecute(SaveMassOrderAction.java:54)
              at net.scee.pinpoint.apps.mercury.common.applet.struts.MercuryAppletAction.pinpointExecute(MercuryAppletAction.java:33)
              at net.scee.pinpoint.common.framework.struts.PINPointLoggingAction.pinpointPerform(PINPointLoggingAction.java:63)
              at net.scee.pinpoint.common.framework.struts.PINPointAction.execute(PINPointAction.java:90)
              at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:53)
              at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:64)
              at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
              at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
              at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
              at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
              at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
              at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
              at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:459)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
              at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
              at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
              at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
              at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
              at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
              at net.scee.pinpoint.common.container.listener.PPV2UniversalFilter.doCustomFilterProcessing(PPV2UniversalFilter.java:138)
              at net.scee.pinpoint.bootstrap.appcore.web.PPUniversalFilter.doFilter(PPUniversalFilter.java:225)
              at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
              at net.scee.pinpoint.common.framework.servlet.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:127)
              at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
              at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
              at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
              at weblogic.security.service.SecurityManager.runAs(Unknown Source)
              at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
              at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
              at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
              at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
              at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

      Comment

      Working...
      X