Results 1 to 9 of 9

Thread: Websphere 6 JTA question

  1. #1
    Join Date
    Aug 2005
    Posts
    11

    Default Websphere 6 JTA question

    I want to have a transaction on a method which
    a. saves data using hibernate AND
    b. Calls a session bean method in Websphere which sends a message to MQ

    So, this is like a XA transaction in Websphere.

    So, would a Spring tansaction manager alone do this? Or should I use Websphere's JTA?

    But, when I went thro' Spring API for Websphere JTA support, it said that there is only support for Websphere version 5 and 4 etc. It does not support Websphere 6.

    Did anybody have this issue? How did you get over?

    Any help is appreciated.

    Thanks

  2. #2
    Join Date
    Aug 2004
    Posts
    107

    Default

    I've only implemented JPetstore on websphere 6 using the JTA. You can use the default JTATransactionManger if you don't need to suspend the transaction

    From:
    http://www.springframework.org/docs/...onManager.html
    For typical JTA transactions (REQUIRED, SUPPORTS, MANDATORY, NEVER), a plain JtaTransactionManager definition is all you need, completely portable across all J2EE servers.
    Sorry, I don't have more information on this...

    Dino

  3. #3
    Join Date
    Aug 2005
    Posts
    11

    Default

    Thanks a lot for your help. I will try it and let you know.

    Thanks

  4. #4
    Join Date
    Aug 2005
    Posts
    11

    Default

    Hi hucmuc,
    Can you please tell me the name of the transactionManager for Websphere that you set.

    Thanks

  5. #5
    Join Date
    Aug 2004
    Location
    Linz, Austria
    Posts
    391

    Default

    Actually, Spring's WebSphereTransactionManagerFactoryBean will properly work on WebSphere 6 as well, even if the javadoc doesn't explicitly say so. It has been tested on WebSphere 6, which still uses WebSphere 5.1's corresponding API: Hence, WebSphereTransactionManagerFactoryBean will detect WebSphere 6 as "WebSphere 5.1". I've updated the log messages and our docs accordingly, indicating that it's actually WebSphere 5.1+.

    Note that Spring's JtaTransactionManager will continue to use the JTA UserTransaction for standard transaction demarcation, as defined by standard J2EE. It will only use the provided WebSphere TransactionManager in case of actual transaction suspension needs (PROPAGATION_REQUIRES_NEW, PROPAGATION_NOT_SUPPORTED).

    Juergen

  6. #6
    Join Date
    Aug 2005
    Posts
    11

    Default

    My applicationContext.xml has

    <bean id="userTransaction" class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiName">
    <value>comp/UserTransaction</value>
    </property>
    <property name="jndiEnvironment">
    <props>
    <prop
    key="java.naming.factory.initial">com.ibm.webspher e.naming.WsnInitialContextFactory</prop>
    <prop
    key="java.naming.provider.url">iiop://localhost:2809</prop>
    </props>
    </property>
    </bean>

    <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTran sactionManager">
    <constructor-arg ><ref bean="userTransaction"/></constructor-arg>
    </bean>

    I have also tried in the jndiName the following
    1 <property name="jndiName">
    <value>java:comp/UserTransaction</value>
    </property>

    2 <property name="jndiName">
    <value>UserTransaction</value>
    </property>

    It is not able to find the UserTransaction object in JNDI tree.
    I keep getting the exception

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'userTransaction' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is javax.naming.NameNotFoundException: Context: pkorwarNode03Cell/nodes/pkorwarNode03/servers/server1, name: comp/UserTransaction: First component in name comp/UserTransaction not found.
    javax.naming.NameNotFoundException: Context: pkorwarNode03Cell/nodes/pkorwarNode03/servers/server1, name: comp/UserTransaction: First component in name comp/UserTransaction not found. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
    at org.omg.CosNaming.NamingContextPackage.NotFoundHel per.read(NotFoundHelper.java:85)
    at com.ibm.WsnOptimizedNaming._NamingContextStub.reso lve_complete_info(Unknown Source)
    at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve (CNContextImpl.java:4043)
    at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(C NContextImpl.java:1746)
    at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(C NContextImpl.java:1707)
    at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt( CNContextImpl.java:1412)
    at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNC ontextImpl.java:1290)
    at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCt x.java:144)
    at javax.naming.InitialContext.lookup(InitialContext. java:361)
    at org.springframework.jndi.JndiTemplate$1.doInContex t(JndiTemplate.java:123)
    at org.springframework.jndi.JndiTemplate.execute(Jndi Template.java:85)
    at org.springframework.jndi.JndiTemplate.lookup(JndiT emplate.java:121)
    at org.springframework.jndi.JndiLocatorSupport.lookup (JndiLocatorSupport.java:71)
    at org.springframework.jndi.JndiObjectLocator.lookup( JndiObjectLocator.java:106)
    at org.springframework.jndi.JndiObjectFactoryBean.aft erPropertiesSet(JndiObjectFactoryBean.java:125)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:966)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:358)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:226)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:147)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:270)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:312)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:80)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:65)
    at com.tdemand.common.TestHibernate.main(TestHibernat e.java:31)

  7. #7
    Join Date
    Aug 2005
    Posts
    11

    Default

    I tried

    <property name="jndiName">
    <value>jta/usertransaction</value>
    </property>

    and it worked. So, hopefully it is right..... :-)

  8. #8
    Join Date
    Apr 2007
    Location
    Brazil
    Posts
    2

    Default

    Quote Originally Posted by Juergen Hoeller View Post
    Actually, Spring's WebSphereTransactionManagerFactoryBean will properly work on WebSphere 6 as well, even if the javadoc doesn't explicitly say so. It has been tested on WebSphere 6, which still uses WebSphere 5.1's corresponding API: Hence, WebSphereTransactionManagerFactoryBean will detect WebSphere 6 as "WebSphere 5.1". I've updated the log messages and our docs accordingly, indicating that it's actually WebSphere 5.1+.

    Note that Spring's JtaTransactionManager will continue to use the JTA UserTransaction for standard transaction demarcation, as defined by standard J2EE. It will only use the provided WebSphere TransactionManager in case of actual transaction suspension needs (PROPAGATION_REQUIRES_NEW, PROPAGATION_NOT_SUPPORTED).

    Juergen
    What about the explicit recommendation to not use Websphere's TransactionManager described in http://www.ibm.com/developerworks/we...09_alcott.html?

    We need to use the Requires New propagation policy with Webphere 6.x but we are not sure it won't affect the environment.

  9. #9
    Join Date
    Jul 2005
    Posts
    105

    Default

    We are also dealing with the same issue as well. It appears that an application at my company is using REQUIRES_NEW in Websphere 5.1. It apparently worked in 5.1, but now that they are trying to upgrade to v6, it no longer works.

    Supposedly WAS 6.0.2.19 and the latest milestone of Spring 2.1 has an IBM supported way to do this.

    That IBM article that the previous person mentioned was updated a few weeks ago to include this information. Interestingly enough, IBM has backed off from its position that it does not support message-driven POJOs, which was the major problem I had with the article to begin with.

Similar Threads

  1. Replies: 8
    Last Post: Mar 19th, 2008, 11:13 AM
  2. Forgot password (e.g. secret question) using Acegi
    By lowerymb77 in forum Security
    Replies: 1
    Last Post: Oct 16th, 2005, 10:46 PM
  3. Using Hessian inside WebSphere
    By mynzai in forum Web
    Replies: 0
    Last Post: Sep 21st, 2005, 08:55 AM
  4. Setting up JOTM within Websphere
    By javamac in forum Data
    Replies: 2
    Last Post: Apr 23rd, 2005, 07:48 AM
  5. Replies: 6
    Last Post: Oct 8th, 2004, 02:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •