我的cassandra + kundera + eclipse项目中存在持久性问题。报告的错误是:
log4j:WARN找不到记录器的appender (com.impetus.kundera.KunderaPersistence)。 log4j:WARN请初始化 log4j系统正常。 log4j:警告请参阅 http://logging.apache.org/log4j/1.2/faq.html#noconfig了解更多信息。 线程“main”中的异常 com.impetus.kundera.loader.PersistenceLoaderException: com.impetus.kundera.utils.InvalidConfigurationException:不能 在类路径中找到任何META-INF / persistence.xml文件 com.impetus.kundera.configure.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) 在javax.persistence.Persistence.createEntityManagerFactory(未知 来源)at javax.persistence.Persistence.createEntityManagerFactory(未知 来源)controlador.Conetor.main(Conetor.java:17)引起: com.impetus.kundera.utils.InvalidConfigurationException:不能 在类路径中找到任何META-INF / persistence.xml文件 com.impetus.kundera.configure.PersistenceUnitConfiguration.findPersistenceMetadatas(PersistenceUnitConfiguration.java:132) 在 com.impetus.kundera.configure.PersistenceUnitConfiguration.configure(PersistenceUnitConfiguration.java:83) ......还有6个
持久性源是这样的:
<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>
答案 0 :(得分:0)
请将persistence.xml放在下面的路径中。它应该解决此错误。 src/main/resources/META-INF/persistence.xml