0

我是 jBoss (7.1) 和 Kundera (2.7.1) 的新手,我正在做一个项目,我想使用 Cassandra dataSource 使用 Kundera 实现 JPA。我的 persistence.xml 如下:

<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br/>
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence<br/>
    http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"<br/>
    version="1.0"><br/>
    <persistence-unit name="cassandra_pu"><br/>
        <provider>com.impetus.kundera.KunderaPersistence</provider><br/>
        <properties><br/>
            <property name="kundera.nodes" value="localhost" /><br/>
            <property name="kundera.port" value="9160" />
            <property name="kundera.keyspace" value="ech" />
            <property name="kundera.dialect" value="cassandra" />
            <property name="kundera.client.lookup.class" value="com.impetus.client.cassandra.thrift.ThriftClientFactory" />
            <property name="kundera.cache.provider.class" value="com.impetus.kundera.cache.ehcache.EhCacheProvider"/>
            <property name="kundera.cache.config.resource" value="/ehcache-test.xml" />
            <!--  <property name="jboss.as.jpa.managed" value="false"/>-->
        </properties>
    </persistence-unit>
   </persistence>

我的applicationContext.xml如下

    ?<?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

    <bean id="personDAO" class="com.impetus.kundera.examples.spring.PersonDAO">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>     
    <bean id="entityManagerFactory"
        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="persistenceUnitName" value="cassandra_pu" />
    </bean> 
</beans>

当我从 persistence.xml 中删除“jboss.as.jpa.managed = false”属性时,我收到JBAS011466: PersistenceProvider 'com.impetus.kundera.KunderaPersistence' not found错误,如果我放置“jboss.as.jpa.managed =false" 属性,我最终没有找到名称为 'cassandra_pu' 的持久性单元错误

两个错误的完整跟踪:

找不到名称为“cassandra_pu”的持久性单元 --- persistence.xml 包含属性 name="jboss.as.jpa.managed" value="false"

原因:java.lang.IllegalArgumentException:在 org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.obtainPersistenceUnitInfo(DefaultPersistenceUnitManager.java:566) [spring-orm-3.2.4.RELEASE. jar:3.2.4.RELEASE] 在 org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.determinePersistenceUnitInfo(LocalContainerEntityManagerFactoryBean.java:308) [spring-orm-3.2.4.RELEASE.jar:3.2.4.RELEASE] 在 org.springframework .orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:260) [spring-orm-3.2.4.RELEASE.jar:3.2.4.RELEASE] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java :310) [spring-orm-3.2.4.RELEASE.jar:3.2。4.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE] 在 org.springframework.beans .factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE] ... 还有 20 个

JBAS011466:找不到 PersistenceProvider 'com.impetus.kundera.KunderaPersistence' --- 从 persistence.xml 中删除 - 属性名称 =“jboss.as.jpa.managed” 值 =“假”

引起:javax.persistence.PersistenceException:JBAS011466:在 org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.lookupProvider(PersistenceUnitDeploymentProcessor.java:560) 在 org.jboss.as 找不到 PersistenceProvider 'com.impetus.kundera.KunderaPersistence' .jpa.processor.PersistenceUnitDeploymentProcessor.deployPersistenceUnit(PersistenceUnitDeploymentProcessor.java:297) 在 org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.addPuService(PersistenceUnitDeploymentProcessor.java:260) 在 org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.handleEarDeployment (PersistenceUnitDeploymentProcessor.java:218)在 org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.deploy(PersistenceUnitDeploymentProcessor.java:121)在 org.jboss.as.server.deployment.DeploymentUnitPhaseService。开始(DeploymentUnitPhaseService.java:116)[jboss-as-server-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4] ... 5 更多

耳朵里的罐子是

cassandra-connection-pool-0.7.1.jar
commons-lang-2.4.jar
commons-logging-1.1.1.jar
commons-pool-1.2.jar
guava-14.0.1.jar
hibernate-commons-annotations-4.0.2.Final.jar
hibernate-core-4.2.3.Final.jar
javassist-3.15.0-GA.jar
jta-1.1.jar
jts-1.11.jar
kundera-cassandra-2.7.1.jar
kundera-core-2.7.1.jar
lucene-core-3.5.0.jar
persistence-api-1.0.jar
slf4j-api-1.7.2.jar
spring-beans-3.0.0.RELEASE.jar
spring-context-3.0.0.RELEASE.jar
spring-core-3.0.0.RELEASE.jar
spring-jdbc-3.0.0.RELEASE.jar
spring-orm-3.0.0.RELEASE.jar
spring-tx-3.0.0.RELEASE.jar

PS - 我在 \JBOSS_HOME>\modules\org\apache 下没有任何与 jpa 相关的文件夹,并且我的 persistence.xml 存在于 MyEAR.ear>META-INF>persistence.xml 下(连同 application.xml、jboss-deployment-structure .xml 和 MANIFEST.MF)

希望我已经提供了所有必要的信息。我整天都被困在这上面。非常感谢任何帮助。谢谢你。

4

1 回答 1

0

这应该可以帮助你。请看一下https://github.com/impetus-opensource/Kundera/issues/390 https://github.com/impetus-opensource/Kundera/issues/180

于 2013-12-29T15:38:31.677 回答