Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/341.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java noSuchMethodError setDefaultTransactionManager-休眠缓存_Java_Spring_Hibernate_Maven_Caching - Fatal编程技术网

Java noSuchMethodError setDefaultTransactionManager-休眠缓存

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

我尝试使用hibernate缓存制作一个应用程序几个小时,但出现了以下错误: noSuchMethodError setDefaultTransactionManager

这是我的第一个Hibernate应用程序,我将非常感谢您的帮助

缓存的my maven依赖项:

<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>