2
votes

I have a problem with the persistence in my cassandra+kundera+eclipse project. The error that's reported is this:

log4j:WARN No appenders could be found for logger (com.impetus.kundera.KunderaPersistence). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. Exception in thread "main" com.impetus.kundera.loader.PersistenceLoaderException: com.impetus.kundera.utils.InvalidConfigurationException: Could not find any META-INF/persistence.xml file in the classpath at com.impetus.kundera.configure.PersistenceUnitConfiguration.configure(PersistenceUnitConfiguration.java:100) at com.impetus.kundera.configure.Configurator.configure(Configurator.java:65) at com.impetus.kundera.KunderaPersistence.initializeKundera(KunderaPersistence.java:109) at 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) Caused by: com.impetus.kundera.utils.InvalidConfigurationException: Could not find any META-INF/persistence.xml file in the classpath at com.impetus.kundera.configure.PersistenceUnitConfiguration.findPersistenceMetadatas(PersistenceUnitConfiguration.java:132) at com.impetus.kundera.configure.PersistenceUnitConfiguration.configure(PersistenceUnitConfiguration.java:83) ... 6 more

And the persistence source is this:

<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>

POM XML WITH DE JAR KUNDERA

1
Be careful to indent all your code snippets by four spaces. Otherwise they will no be displayed properly (or at all). And when you are pasting in error messages and stack traces and such, you want to format them with a > before each line. The StackOverflow built-in editor has buttons for doing those things; you just highlight your code snippet or error message, and press the button, and it does the rest for you.sideshowbarker
@DanielFerreira what is the location of your persistence.xml? It should be in the classpath (preferably src/main/resources) in META-INF folder. Eg: src/main/resources/META-INF/persistence.xmlkarthik manchala
@DanielFerreira Also.. I suggest you to use the latest version of Kundera i.e Kundera 3.1karthik manchala
thanks you, i have the persistence.xml in this location: target/m2e-wtp/web-resources/META-INF/persistence.xmlDaniel Ferreira
@karthikmanchala it's the Maven Webapp projectDaniel Ferreira

1 Answers

1
votes

Please put your persistence.xml in below path. It should resolve this error. src/main/resources/META-INF/persistence.xml