Java noSuchMethodError setDefaultTransactionManager-休眠缓存
我尝试使用hibernate缓存制作一个应用程序几个小时,但出现了以下错误: noSuchMethodError setDefaultTransactionManager 这是我的第一个Hibernate应用程序,我将非常感谢您的帮助 缓存的my maven依赖项:Java noSuchMethodError setDefaultTransactionManager-休眠缓存,java,spring,hibernate,maven,caching,Java,Spring,Hibernate,Maven,Caching,我尝试使用hibernate缓存制作一个应用程序几个小时,但出现了以下错误: noSuchMethodError setDefaultTransactionManager 这是我的第一个Hibernate应用程序,我将非常感谢您的帮助 缓存的my maven依赖项: <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache-core</artifact
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>3.3.2.GA</version>
</dependency>
ehcache.xml
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"
maxBytesLocalHeap ="900">
<defaultCache
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="1200"
overflowToDisk="false">
</defaultCache>
</ehcache>
类路径中有几个ehcache LIB,请看 第一个依赖项“ehcache core”不是必需的,请将其删除。 在第二个依赖项“HibernateEhcache”中,已经存在“ehcache”的正确版本,请参见
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Table(name = "people")
public class Person implements Serializable{
}
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"
maxBytesLocalHeap ="900">
<defaultCache
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="1200"
overflowToDisk="false">
</defaultCache>
</ehcache>