K.E. K.E. - 1 year ago 154
Java Question

Java Web Application with Kundera JPA on Tomcat 7

I have developed a JAVA Rest Service (JDK 1.8) which uses Kundera (V3.2) for a Cassandra Database connection. If I run my application inside eclipse with a Tomcat-Server everything works well. If I want to deploy .war file on another Tomcat 7 the server does not start because of following error:

com.impetus.kundera.loader.MetamodelLoaderException: Error while retreiving and storing entity metadata, Caused by : .

After searching for some solution I found out that the problem can be that I have my entities in an separated jar (which is a dependency in the war file) and and not in the application itself. If this is the problem I have to add the
tag to my

My persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="cassandra_pu" transaction-type="RESOURCE_LOCAL">
<property name="kundera.nodes" value="" />
<property name="kundera.port" value="9160" />
<property name="kundera.keyspace" value="booking" />
<property name="kundera.dialect" value="cassandra"/>
<property name="sessionless" value="false" />
<property name="kundera.client.lookup.class" value="com.impetus.client.cassandra.thrift.ThriftClientFactory" />
<property name="kundera.annotations.scan.package" value="com.asdf.booking.kundera.beans" />
<property name="kundera.ddl.auto.prepare" value="update" />

Is the separate jar-file possibly the problem or should I search for other solutions?

Answer Source

The problem was the separate jar-file for entities. When adding the jar-file tag, pointing to the jar for entities, to the persistence.xml everything is ok.