我正在尝试在Weblogic 10.3.6上运行基于Spring的Web应用程序。此应用程序使用Apache Cassandra 2.0.7版来存储/访问数据。
我们正在使用带有persistence.xml文件的JPA 2.0,如下所示:
<?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="cassandra">
<provider>com.impetus.kundera.KunderaPersistence</provider>
<properties>
<property name="kundera.dialect" value="cassandra"/>
<property name="cql.version" value="3.0.0"/>
<property name="kundera.client.lookup.class" value="com.impetus.client.cassandra.thrift.ThriftClientFactory"/>
<property name="kundera.keyspace" value="abc"/>
<property name="kundera.nodes" value="localhost"/>
<property name="kundera.port" value="9160"/>
<property name="kundera.ddl.auto.prepare" value="validate"/>
</properties>
</persistence-unit>
</persistence>
我还通过修改commEnv.sh文件在Weblogic 10.3.6中应用了JPA 2.0补丁:
# Enable JPA2.0 support
PRE_CLASSPATH="${PRE_CLASSPATH}:${MW_HOME}/modules/com.oracle.jpa2support_1.0.0.0_2-1.jar:${MW_HOME}/modules/javax.persistence_1.1.0.0_2-0-0.jar"
export PRE_CLASSPATH
应用程序已成功部署,但在尝试通过EntityManager访问后端时,我看到如下错误:
Caused by: java.lang.NoSuchMethodError: javax.persistence.EntityManagerFactory.getCache()Ljavax/persistence/Cache;
at com.impetus.kundera.persistence.EntityManagerImpl.<init>(EntityManagerImpl.java:128)
at com.impetus.kundera.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:246)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
pom文件中的相关条目是:
<dependency>
<groupId>com.impetus.kundera.client</groupId>
<artifactId>kundera-cassandra</artifactId>
<version>2.11</version>
</dependency>
<dependency>
<groupId>com.impetus.kundera.core</groupId>
<artifactId>kundera-core</artifactId>
<version>2.11</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
有人可以通过建议这里有什么问题来帮忙吗?
此致
阿南德
答案 0 :(得分:0)
请删除以下依赖
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
之后它应该有用。