[英]Caused by: java.lang.NoClassDefFoundError: Ljavax/transaction/TransactionManager;
I read many posts about the error javax/transaction/TransactionManager
, but none of those solutions fix my problem.我阅读了很多关于错误
javax/transaction/TransactionManager
帖子,但这些解决方案都没有解决我的问题。
First thing to say is that I get that error when I deploy my web-application (made with Spring MVC and Hibernate) on the server.首先要说的是,当我在服务器上部署我的 Web 应用程序(使用 Spring MVC 和 Hibernate 制作)时出现该错误。 On my computer, with Eclipse and Tomcat 7 everything works.
在我的计算机上,使用 Eclipse 和 Tomcat 7 一切正常。
Second thing to say is that on that server I have another web-application that's running under tomcat /root
folder (this is a simple java application, that DOESN'T use neither Spring mvc nor Hibernate).第二件事是,在那台服务器上,我有另一个在 tomcat
/root
文件夹下运行的 web 应用程序(这是一个简单的 java 应用程序,既不使用 Spring mvc 也不使用 Hibernate)。 The new application that i'm trying to deploy is running under another folder called /prova
.我尝试部署的新应用程序正在另一个名为
/prova
文件夹下运行。
These are all the libraries of my application这些是我的应用程序的所有库
Plus, according to what I read on some posts, I added to my lib folder:另外,根据我在一些帖子中读到的内容,我添加到我的 lib 文件夹中:
1) jta-3.1.2.2.jar 1) jta-3.1.2.2.jar
2) hibernate3.3.1-jta-1.1.jar 2) hibernate3.3.1-jta-1.1.jar
3) javax.transaction.jar 3) javax.transaction.jar
In my xml file I have this bean that defines the transaction manager在我的 xml 文件中,我有一个定义事务管理器的 bean
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
Something strange is that in the server log the exact error is奇怪的是,在服务器日志中,确切的错误是
Caused by: java.lang.NoClassDefFoundError: Ljavax/transaction/TransactionManager;
There's a L before javax/transaction/TransactionManager
javax/transaction/TransactionManager
前有一个L
Any idea?任何的想法?
Thank you谢谢
Don't worry with the " L ", it just defines that the following is an object.不要担心“ L ”,它只是定义了以下是一个对象。 You can find other letters :
你可以找到其他字母:
BaseType
B byte (signed byte)
C char (Unicode character)
D double (double-precision floating-point value)
F float (single-precision floating-point value)
I int (integer)
J long (long integer)
L<classname>; reference (an instance of class <classname>)
S short (signed short)
Z boolean (true or false)
[ reference (one array dimension )
To come back to your problem, did you define your transaction manager whith something close to this :回到您的问题,您是否定义了您的事务管理器,其内容与此接近:
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager" p:sessionFactory-ref="sessionFactory">
</bean>
HibernateTransactionManager is an implementation of javax.transaction.TransactionManager HibernateTransactionManager 是 javax.transaction.TransactionManager 的一个实现
This worked for me这对我有用
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>javax.transaction-api</artifactId>
<version>1.3</version>
</dependency>
where is spring-data jars? spring-data jar 在哪里? It looks like spring-data-commons.
它看起来像 spring-data-commons。 Please, spend some time to learn how to use maven or gradle.
请花一些时间来学习如何使用 maven 或 gradle。 It will save a lot of your time.
它会节省你很多时间。
you must add this dependency It is work您必须添加此依赖项 这是工作
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.2.Final</version>
</dependency>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.