Java 使用EhCache配置OpenJPA 1.3.1:未找到插件/别名

Java 使用EhCache配置OpenJPA 1.3.1:未找到插件/别名,java,ehcache,openjpa,Java,Ehcache,Openjpa,我正在尝试用openjpa配置ehcache。我得到以下错误: org.apache.openjpa.lib.util.ParseException: Instantiation of plugin "DataCacheManager" with value "ehcache" caused an error "java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: ehcache". The alias

我正在尝试用openjpa配置ehcache。我得到以下错误:

org.apache.openjpa.lib.util.ParseException: 
Instantiation of plugin "DataCacheManager" with value "ehcache" caused an error 
"java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: ehcache". 
The alias or class name may have been misspelled, or the class may not have be available in the class path. 
Valid aliases for this plugin are: [default]
以下是我对persistence.xml的摘录:

        <property name="openjpa.QueryCache" value="ehcache"  />
        <property name="openjpa.DataCacheManager" value="ehcache" />

以下是我的ehcache.xml:

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true" monitoring="autodetect" dynamicConfig="true">

  <!--  -->
  <cache name="openjpa" maxElementsInMemory="10000"
    maxElementsOnDisk="1000" eternal="false" overflowToDisk="true"
    diskSpoolBufferSizeMB="20" timeToIdleSeconds="300"
    timeToLiveSeconds="600" memoryStoreEvictionPolicy="LFU"
    transactionalMode="on" />
</ehcache>

下面是我的pom.xml插件依赖项: net.sf.ehcache ehcache-openjpa 0.2.0


是否有其他方法来配置openjpa+ehcache?

是的,它应该可以工作。确保ehcache openjpa jar位于类路径上。我知道,如果您在容器环境(即:WAS)中运行,这会稍微复杂一些

[更新]

我知道我曾经有过这样的经历,为了让它发挥作用,我不得不用共享库做一些有趣的事情,但是我找不到我的笔记。我记得这个问题与OpenJPA在启动时没有检测到Ehcache有关,反过来我们没有注册“Ehcache”别名

尝试使用以下属性配置OpenJPA:



[/update]

是的,它应该可以工作。确保ehcache openjpa jar位于类路径上。我知道,如果您在容器环境(即:WAS)中运行,这会稍微复杂一些

[更新]

我知道我曾经有过这样的经历,为了让它发挥作用,我不得不用共享库做一些有趣的事情,但是我找不到我的笔记。我记得这个问题与OpenJPA在启动时没有检测到Ehcache有关,反过来我们没有注册“Ehcache”别名

尝试使用以下属性配置OpenJPA:



[/update]

您能否提供有关容器环境的其他详细信息?我正在运行WAS。您能提供有关容器环境的其他详细信息吗?我正在跑步。