10 Replies Latest reply on Jul 4, 2012 5:45 AM by apanag

    TransactionManager and UserTransaction

      All,

      I have a simple spring application working on other app servers but cannot get it going on JBoss (V4). If I use the hibernate transaction manager then everything is fine, but if I try to use the spring JtaTransactionManager then I run into problems....

      <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
      <bean>


      This gives me the following error:

      JTA UserTransaction is not available at JNDI location [java:comp/UserTransaction]; nested exception is javax.naming.NamingException: Object [org.jboss.tm.usertx.client.ServerVMClientUserTransaction@91cc3a] available at JNDI location [java:comp/UserTransaction] does not implement [javax.transaction.UserTransaction]

      and this ....

      <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
       <property name="userTransactionName"><null/></property>
       <property name="transactionManagerName">
       <value>java:/TransactionManager</value>
       </property>
      </bean>


      This gives me the following error:

      JTA TransactionManager is not available at JNDI location [java:/TransactionManager]; nested exception is javax.naming.NamingException: Object [org.jboss.tm.TxManager@ffce21] available at JNDI location [java:/TransactionManager] does not implement [javax.transaction.TransactionManager]

      I have tried numerous other alternatives but with no joy. I am running on the default JBoss server and assume that I am missing something in the setup. Both transactionmanager and usertransaction can be seen in the JBoss jndi admin console. Any hints would be greatly appreciated.

        • 1. Re: TransactionManager and UserTransaction
          bill.burke

          It looks like you are having classloader issues. Does spring come bundled with classes javax.transaction.*? I ask this because both ServerVMClientUserTransaction and TxManager implement the interfaces spring is telling you the don't.

          Let me know if this fixes it.

          • 2. Re: TransactionManager and UserTransaction

            Bill,

            Thanks for your quick reply - yes I noticed that both the JBoss classes implement the relevent interfaces so I was looking for where I had messed up... Following your post, I noticed I had jta.jar in my war file, so I got rid of it and everything is now working fine.

            Thanks for your help,
            John

            • 3. Re: TransactionManager and UserTransaction
              redijedi

              I'm getting the same error, except I do not have any jta.jar in my jboss-4.0.3SP1 (all) install. Is this something that must be added in afterwards? I chose the all selection in the installer, and confirmed in the detailed option that it was installing JTA.

              What was the final spring configuration for the transactionManager?

              Thanks,
              T

              • 4. Re: TransactionManager and UserTransaction
                redijedi

                Nevermind. I got it. You do have to specify a name, apparently. It also must be "UserTransaction" as in:

                 <bean id="transactionManager"
                 class="org.springframework.transaction.jta.JtaTransactionManager">
                 <property name="userTransactionName">
                 <value>UserTransaction</value>
                 </property>
                 </bean>
                


                Then it seems to work...mysterious.

                • 5. Re: TransactionManager and UserTransaction
                  javatwo

                  I am trying to use JTA UserTransaction. I have JBoss 4.0.3 SP1. Where is the JTA jar file? I could not find it. Do you I need to download from sun?
                  which jar is The class javax.transaction.UserTransaction in?

                  Thanks for help

                  • 6. Re: TransactionManager and UserTransaction
                    alesj

                    It's in jboss-j2ee.jar.

                    • 7. Re: TransactionManager and UserTransaction

                      Hi guys

                      Im having the same problem. Im trying to connect to the TransactionManager and get the same error. I've gone through the jar files i deploy in the WAR file and there is no jta.jar or any other jar file containnig javax.transaction.TransactionManager. Still it get the

                      [java:/TransactionManager] is not assignable to [javax.transaction.TransactionManager].


                      I get that it must be that i have the wrong TransactionManager class in the classpath somewhere but I cant find it. Is there any one who solved it who can give me some tips?

                      P:s I also had the jta.jar file in my war file before but I removed it but still the same outcome. D:s

                      THX, Cheers
                      Magnus

                      • 8. Re: TransactionManager and UserTransaction
                        bmcgovern

                        I'm having the exact same problem, and have not found jta.jar anywhere. I noticed in the web-console that under J2EE Resources, there is an entity called TransactionManager, but i can view no properties on it. Should i be able to?

                        In general, does anyone have a good idea how to solve the problem here:

                        JTA TransactionManager is not available at JNDI location [java:/TransactionManager]; nested exception is javax.naming.NamingException: Object [org.jboss.tm.TxManager@ffce21] available at JNDI location [java:/TransactionManager] does not implement [javax.transaction.TransactionManager]


                        • 9. Re: TransactionManager and UserTransaction

                          Quick check ..
                          see how many jars you have with JTA in it in all your lib folders :P

                          then in your
                          <.ear>/.war/WEB-INF/lib

                          move the jta.jar (if here) to a different folder outside the classpath

                          • 10. Re: TransactionManager and UserTransaction
                            apanag

                            It's exactly like this, I  had the same problem with Spring and JBoss 4.2. Exception

                             

                            Caused by: org.springframework.transaction.TransactionSystemException:

                            JTA TransactionManager is not available at JNDI location [java:/TransactionManager];

                            nested exception is

                            org.springframework.jndi.TypeMismatchNamingException:

                            Object of type [class org.jboss.tm.TxManager]

                            available at JNDI location [java:/TransactionManager] is not assignable

                            to [javax.transaction.TransactionManager]

                             

                            My application had added in the EAR its own JTA library, thus this one was used instead of the jta that comes from JBoss.

                             

                            I use maven, so excluding the JTA artifacts in my pom solved the problem.

                             

                            <dependency>
                                <groupId>org.hibernate</groupId>
                                <artifactId>hibernate-validator</artifactId>
                                <exclusions>
                                 ...
                                     <exclusion>
                                         <groupId>javax.transaction</groupId>
                                         <artifactId>jta</artifactId>
                                      </exclusion>
                                </exclusions>
                            </dependency>
                            <dependency>
                                <groupId>org.quartz-scheduler</groupId>
                                <artifactId>quartz</artifactId>
                                <version>1.8.4</version>
                                <exclusions>
                                     <exclusion>
                                         <artifactId>slf4j-api</artifactId>
                                         <groupId>org.slf4j</groupId>
                                     </exclusion>
                                     <exclusion>
                                          <groupId>javax.transaction</groupId>
                                          <artifactId>jta</artifactId>
                                            </exclusion>
                                     </exclusions>
                            </dependency>