No JTA UserTransaction available - specify either 'userTransaction' or 'userTransactionName'
Asked Answered
B

1

20

I have encountered a strange problem with spring transaction. My application uses Spring with EJBs. The EJBs also invoke Spring service classes annotated with @Transaction. I have used Spring JtaTransactionManager for transaction management. The application is packaged as an EAR file and is deployed on jboss5.0 and it works fine. But when I instruct jboss to use separate classloader for each EAR application, spring initialization gives error.

org.springframework.beans.factory.BeanCreationException: Error creating bean
   with name 'transactionManager' defined in ServletContext resource 
   [/WEB-INF/applicationContext.xml]: Invocation of init method failed; 
nested exception is java.lang.IllegalStateException: No JTA UserTransaction 
   available - specify either 'userTransaction' or 'userTransactionName' or 
   'transactionManager' or 'transactionManagerName'

Why initialization of Spring is not successful?

Thanks

Breve answered 28/9, 2010 at 9:10 Comment(2)
What setting did you change in JBoss?Headwater
I modified ear-deployer-jboss-beans.xml file under "deployers" directory to set property "isolated" to true.Breve
G
1

try adding

@EnableTransactionManagement

on a configuration class where you hold your config bean

that worked for me when i had that issue , maybe you will need other platform specific implementation of the transaction manager , but this is a good place to start.

@Bean
public PlatformTransactionManager transactionManager() {
    JpaTransactionManager txManager = new JpaTransactionManager();
    txManager.setEntityManagerFactory(entityManagerFactory());
    return txManager;
}
Gerhan answered 28/1, 2017 at 1:20 Comment(2)
I'm having similar issue when deploying sboot app in IBM WAS, will check fi this works.Heartthrob
Migrated couple of healthcare system projects away from IBMWAS to simple sboot. RIP to ibmwas -- ibm even sold it to HCL! Huh.Heartthrob

© 2022 - 2024 — McMap. All rights reserved.