Reputation: 838
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 <jar-file>
tag to my persistence.xml
(https://github.com/impetus-opensource/Kundera/issues/90).
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">
<provider>com.impetus.kundera.KunderaPersistence</provider>
<class>com.asdf.booking.beans.kundera.Account</class>
<class>com.asdf.booking.beans.kundera.AccountCard</class>
<class>com.asdf.booking.beans.kundera.AccountType</class>
<class>com.asdf.booking.beans.kundera.Booking</class>
<class>com.asdf.booking.beans.kundera.Circle</class>
<class>com.asdf.booking.beans.kundera.AccountSequence</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="kundera.nodes" value="1.1.1.1" />
<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" />
</properties>
</persistence-unit>
</persistence>
Is the separate jar-file possibly the problem or should I search for other solutions?
Upvotes: 1
Views: 199
Reputation: 838
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.
Upvotes: 1