DataNucleus - 插件,L2缓存错误

时间:2013-01-29 15:17:29

标签: caching jpa datanucleus

我的项目基于GWT(2.4),我的目标是实现ReqyestFactory(JPA,Datanucleus,Postgresql)。我遇到的最后一个问题是使用二级缓存。 我想使用EHcache但是当我创建我的EMF时出现了这个错误:

Level 2 Cache "ehcache" is registered to use class "org.datanucleus.cache.ehcache.EhcacheLevel2Cache" yet this is not found. Please check your CLASSPATH and plugin specification.

在我的/ war / WEB-INF / lib中我有:

datanucleus-api-jpa-3.2.0-m2.jar
datanucleus-cache-3.1.1.jar
datanucleus-core-3.2.0-m2.jar
datanucleus-rdbms-3.2.0-m2.jar
ehcache-core-2.2.0.jar
geronimo-jpa_2.0_spec-1.1.jar
geronimo-jta_1.1_spec-1.1.jar
gwt-servlet-deps.jar
gwt-servlet.jar
hibernate-validator-4.3.1.Final.jar
jboss-logging-3.1.0.GA.jar
jdo-api-3.0.1.jar
log4j-1.2.17.jar
postgresql-9.2-1002.jdbc4.jar
requestfactory-apt.jar
requestfactory-client+src.jar
requestfactory-server+src.jar
validation-api-1.0.0.GA.jar
validation-api-1.0.0.GA-sources.jar

的persistence.xml

<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
    http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0">

<persistence-unit name="DBStorage">
    <provider>org.datanucleus.api.jpa.PersistenceProviderImpl</provider>
    <class>com.test.domain.Myobj</class>
    <exclude-unlisted-classes/>
    <properties>
        <property name="datanucleus.ConnectionDriverName" value="org.postgresql.Driver" />
        <property name="datanucleus.ConnectionURL" value="jdbc:postgresql://localhost:5432/test" />
        <property name="datanucleus.ConnectionUserName" value="test" />
        <property name="datanucleus.ConnectionPassword" value="123" />
        <property name="datanucleus.autoCreateTables" value="true" />
        <property name="datanucleus.identifier.case" value="LowerCase" />
        <property name="datanucleus.jmxType" value="default" />

        <property name="datanucleus.cache.level2.type" value="ehcache" />
        <property name="datanucleus.cache.level2.cacheName" value="TestEHcache" />
        <!--  property name="datanucleus.cache.level2.configurationFile" value="ehcache.xml" / -->

    </properties>
</persistence-unit>

我错过了什么?我的问题在哪里?

1 个答案:

答案 0 :(得分:0)

我通过添加:

解决了这个问题
slf4j-api-1.5.6.jar
slf4j-log4j12-1.5.6.jar

现在效果很好。