java 哪个 JAR 包含 org.springframework.orm.hibernate.HibernateTransactionManager?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2506482/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 21:32:29  来源:igfitidea点击:

Which JAR contains org.springframework.orm.hibernate.HibernateTransactionManager?

javahibernatespringjar

提问by craftsman

I am trying to use Hibernate+Spring in my application but stuck into following error:

我试图在我的应用程序中使用 Hibernate+Spring,但陷入了以下错误:

java.lang.ClassNotFoundException: org.springframework.orm.hibernate.HibernateTransactionManager

Tired of googling, could any stackoverflower tell me which JAR contains the above class?

厌倦了谷歌搜索,任何 stackoverflower 能告诉我哪个 JAR 包含上述类吗?

EDIT

编辑

An important thing that I did not notice was that Spring has different packages for different versions of Hibernate. For Hibernate V3 (which I am using), the appropriate HibernateTransactionManager class would be

我没有注意到的一件重要事情是 Spring 对不同版本的 Hibernate 有不同的包。对于 Hibernate V3(我正在使用),适当的 HibernateTransactionManager 类将是

org.springframework.orm.hibernate3.HibernateTransactionManager

org.springframework.orm.hibernate3.HibernateTransactionManager

instead of

代替

org.springframework.orm.hibernate.HibernateTransactionManager.

org.springframework.orm.hibernate.HibernateTransactionManager.

The JAR containing this (hibernate3) class, as I have discovered is spring-hibernate3.jar. Thank you for your replies :)

我发现包含这个(hibernate3)类的 JAR 是spring-hibernate3.jar. 谢谢您的回复 :)

采纳答案by sfussenegger

回答by ukanth

its in spring-orm.jar. Also make sure that you have this JAR in your classpath

它在spring-orm.jar 中。还要确保你的类路径中有这个 JAR

回答by ant

Umar, I see you use ant, have you tried maven? you just include dependency :

Umar,我看到你使用 ant,你试过maven吗?你只包括依赖:

<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring</artifactId>
            <version>${spring.version}</version>
        </dependency>

And maven take care downloading and everything for you,

和 maven 照顾下载和一切为你,

回答by Adrian

If you're using Eclipse there's a very useful plugin called JAR Class Finderthat's perfect for these type of problems.

如果您正在使用 Eclipse,那么有一个非常有用的插件JAR Class Finder,它非常适合解决这些类型的问题。