Search code examples
javatomcatpersistenceentitykundera

No Entity metadata found for the class


I'm back with the same problem ...

I'm trying to uses queries in my Cassandra DB with Kundera (Cassandra ORM), this queries work in an others project but when I try to do it in webapp (using tomcat 6.0), I got this error :

com.impetus.kundera.metadata.KunderaMetadataManager  - No Entity metadata found for the class

=> JavaNullPointerException.

But when I leave the persistence.xml from my project I got an other error. (NoPersistence.xml found or something ... )

So, my project found Persistence.xml, but not my Entity class : fileCassandra.

You can see my persistence.xml :

   <?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">
    <!--  192.168.3.107 -->
    <persistence-unit name="cassandra_pu">
        <provider>com.impetus.kundera.KunderaPersistence</provider>     
        <class>net.***.common.db.***.FileCassandra</class>

        <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.pelops.PelopsClientFactory" />
            <property name="kundera.cache.provider.class" value="com.impetus.kundera.cache.ehcache.EhCacheProvider"/>
            <!-- <property name="kundera.cache.config.resource" value="/ehcache-test.xml"/>    -->           
        </properties>
       </persistence-unit>
</persistence>  

net..common.db..FileCassandra I must replace by * because it's name from my companie ;)

The same methods (include EntityManager) works in junit on other project, when I build my project in Tomcat, this error appears ...


Solution

  • Only issue which i can see is classes and persistence.xml location.

    try to place persistence.xml within /WEB-INF/classes/META-INF/, Provided that your entity definitions are within classes folder!

    -Vivek