Friday, February 2, 2018

java.lang.NoClassDefFoundError: javax/transaction/TransactionManager

Recently while trying to migrate one of the application from JDK6 to JDK7 & Spring 3.x to Spring 4.x, I have got Spring  BeanCreationException along with nested exception related to javax TransactionManger while deploying the application in Tomcat 7.

Before sharing the logs, providing the tech stack:
- Maven based application
- Spring 4.x [4.3.0.RELEASE from 3.1.0.RELEASE]
- Tomcat 7.0.83
- JDK 7 [1.7.0_05]

Error Logs:

org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'xyz' defined in class path resource [xyz/xyz.xml]: 
Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: 
javax/transaction/TransactionManager 

Solution:

Don't be confused with the BeanCreationException, the issue is happening due to missing jta jar.
Add the below Maven dependency and issue will be resolved:
<dependency>
    <groupId>javax.transaction</groupId>
    <artifactId>jta</artifactId>
    <version>1.1</version>
</dependency>

No comments:

Post a Comment