2

我的 cassandra+kundera+eclipse 项目的持久性存在问题。报告的错误是这样的:

log4j:WARN 找不到记录器 (com.impetus.kundera.KunderaPersistence) 的附加程序。log4j:WARN 请正确初始化 log4j 系统。log4j:WARN 见 http://logging.apache.org/log4j/1.2/faq.html#noconfig了解更多信息。线程“主”com.impetus.kundera.loader.PersistenceLoaderException 中的异常:com.impetus.kundera.utils.InvalidConfigurationException:在 com.impetus.kundera.configure 的类路径中找不到任何 META-INF/persistence.xml 文件。 PersistenceUnitConfiguration.configure(PersistenceUnitConfiguration.java:100) 在 com.impetus.kundera.configure.Configurator.configure(Configurator.java:65) 在 com.impetus.kundera.KunderaPersistence.initializeKundera(KunderaPersistence.java:109) 在 com.impetus .kundera.KunderaPersistence.createEntityManagerFactory(KunderaPersistence.java:81) at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source) at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source) at controlador.Conetor.main(Conetor.java:17)造成的:

持久性来源是这样的:

<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_pu">
        <provider>com.impetus.kundera.KunderaPersistence</provider>     
        <properties>            
            <property name="kundera.nodes" value="localhost"/>
            <property name="kundera.port" value="9160"/>
            <property name="kundera.keyspace" value="KunderaExamples"/>
            <property name="kundera.dialect" value="cassandra"/>
            <property name="kundera.client.lookup.class"
                value="com.impetus.client.cassandra.thrift.ThriftClientFactory" />

        </properties>       
    </persistence-unit>
</persistence>

使用 DE JAR KUNDERA 的 POM XML

4

1 回答 1

1

请将您的 persistence.xml 放在下面的路径中。它应该可以解决此错误。 src/main/resources/META-INF/persistence.xml

于 2016-11-15T02:14:40.807 回答