For a weekend project I was trying to run JPA 2 with Hibernate 3.5. Please note that I am not getting any compile errors or runtime exceptions (when I deploy the war on Tomcat). Below is my code -
persistence.xml
<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="postage" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.connection.driver_class" value="org.postgresql.Driver"></property>
<property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/postage"></property>
<property name="hibernate.connection.username" value="postage"></property>
<property name="hibernate.connection.password" value="postage"></property>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"></property>
<property name="hibernate.hbm2ddl.auto" value="create-drop"></property>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.ejb.cfgfile" value="/hibernate.cfg.xml"></property>
</properties>
</persistence-unit>
</persistence>
hibernate.cfg.xml
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="current_session_context_class">thread</property>
<!-- mapping files -->
<mapping class="net.rocky.postage.domain.Post"/>
<mapping class="net.rocky.postage.domain.User"/>
</session-factory>
</hibernate-configuration>
I have 2 simple Entity classes -
#Entity
#Table(name="Post")
public class Post implements Serializable{
#Id
#GeneratedValue
private long id;
private String description;
private String comments;
#OneToOne
private User postedBy;
And
#Entity
#Table(name="PostageUser")
public class User implements Serializable{
#Id
#GeneratedValue
private long id;
private String username;
private String password;
Am I missing something here. I have spent my whole saturday trying all combinations. Please help me.
Follow-up 1: By not working I mean - When I deploy the app on Tomcat, I do not see 2 tables created in Postgres (as I have given create-drop in hbm2ddl).
Follow-up 2: Thanks for your response. I cannot even get Hibernate to log messages. Here is my config:
log4j.appender.S=org.apache.log4j.ConsoleAppender
log4j.appender.S.layout=org.apache.log4j.PatternLayout
log4j.appender.S.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n
log4j.rootCategory=DEBUG, S
Also, in maven I have added -
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
still no log messages from hibernate
I couldn't spot any obvious mistake in the mappings or configuration (although you should typically use a datasource when running in container but your configuration can work). But here are some suggestions or ideas:
Tell us more about the structure and the packaging of your app (where is the persistence.xml?).
Enable DEBUG logging :
for the category org.hibernate.tool.hbm2ddl
and maybe even the whole org.hibernate category until you get it working
Run a JUnit test (out-container), it will make debugging easier.
Follow-up: I don't see any logger for Hibernate defined in your logging configuration. You need to add the following for the category org.hibernate.tool.hbm2ddl:
log4j.logger.org.hibernate.hbm2ddl=debug
I'd also like to know where your persistence.xml is located in your Maven project.
References
3.5. Logging
I finally got this working .. i changed my dependencies to -
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.3.2.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.3.2.GA</version>
</dependency> <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.3.1.GA</version>
</dependency>
earlier it was -
org.hibernate
hibernate-core
3.5.x
Remember 3.5 doc says that it has merged EM and Annotations in core, which is why i wanted to use it.
When I configured the datasource through spring, it gave me class not found org.hibernate.ejb.HibernatePersistence (this was my JPA provider)
On further investigation i found that the JBoss maven repo (https://repository.jboss.org/nexus/content/groups/public) had the hibernate 3.5 jars but the jar is wrong (say size X MB) but when you download hibernate binaries from the site they are of size Y MB. Also, the pom of this jar does not define the correct dependencies (which you will get if you download the bundled distribution directly from Hibernate site).
For me this was kinda deal-breaker and I had to switch back to 3.3 to get this working flawlessly.
Maybe this will help someone and possibly Hibernate 3.5 on Maven will be fixed. This issue was also raised in Hibernate forums.
Related
I am trying to create local derby database using jpa. As JPA implementation i am using openjpa and as sql implementation derby.
This is persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.2"
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_2.xsd">
<persistence-unit name="DataLayer"
transaction-type="RESOURCE_LOCAL">
<non-jta-data-source>DataSource</non-jta-data-source>
<properties>
<property
name="javax.persistence.schema-generation.database.action"
value="create" />
<property name="javax.persistence.jdbc.driver"
value="org.apache.derby.jdbc.EmbeddedDriver" />
<property name="javax.persistence.jdbc.url"
value="jdbc:derby:testdb" />
</properties>
</persistence-unit>
</persistence>
This is my main:
public static void main(String[] args)
{
Persistence.generateSchema("DataLayer", null);
EntityManagerFactory factory = Persistence.createEntityManagerFactory("DataLayer");
EntityManager manager = factory.createEntityManager(); // <- Exception here
}
This is starting part of exception i get:
Exception in thread "main" <openjpa-3.1.2-r66d2a72 nonfatal general error> org.a
pache.openjpa.persistence.PersistenceException: There were errors initializing y
our configuration: <openjpa-3.1.2-r66d2a72 fatal user error> org.apache.openjpa.
util.UserException: A connection could not be obtained for driver class "org.apa
che.derby.jdbc.EmbeddedDriver" and URL "jdbc:derby:testdb". You may have spe
cified an invalid URL.
...
saying that i may have specified an invalid URL.
Complete stack trace: https://justpaste.it/3kmgo
Root exception: java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver
I have specified EmbeddedDriver in persistence.xml, also included Maven dependency.
Also i think my connection url and driver is correct according to docs about derby:
https://db.apache.org/derby/docs/10.15/devguide/rdevdvlp22102.html#rdevdvlp22102
https://db.apache.org/derby/docs/10.15/devguide/cdevdvlp40653.html
Dependencies included (using Maven):
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.15.2.0</version>
</dependency>
I tried to change property javax.persistence.jdbc.url to jdbc:derby:testdb;create=true, but same exception. Also tried to set javax.persistence.schema-generation.database.action property to none.
Found out that org.apache.derby.jdbc.EmbeddedDriver class is not in derby artifactid dependency (it has derby and derbyshared jar's). It is in derbytools, so including derbytools to dependencies solve issue abbout missing EmbeddedDriver class:
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbytools</artifactId>
<version>10.15.2.0</version>
</dependency>
Using Debry 10.15.2.0 the Embedded driver is located in Derbytools.jar. Thus must be in your libraries and classpath. Created a new driver(I'd deleted any drivers that say anything Embedded). In the Services tab right click Drivers and Create New. Add Derbytools.jar Highlight it and click the Find Button. Give it a meaningful name and it works as expected. Just to be sure I also added Derby.jar and DerbyShared.jar to avoid problems.
I have a JPA-Project, which I'm trying to update to JPA 2.2.0 and EclipseLink 5.7.1 since I ran into bug 429992 of EclipseLink. With the new versions in place, I'm not able to execute my application anymore – EclipseLink throws an exception similar to the following (Short variant from my example below):
[EL Warning]: metamodel: 2018-06-20 22:38:14.1--Thread(Thread[main,5,main])--The collection of metamodel types is empty. Model classes may not have been found during entity search for Java SE and some Java EE container managed persistence units. Please verify that your entity classes are referenced in persistence.xml using either <class> elements or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element
[...]
Exception in thread "main" java.lang.IllegalArgumentException: Object: Artifact#17d919b6 is not a known Entity type.
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:4324)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.persist(EntityManagerImpl.java:593)
at Main.main(Main.java:12)
Before the update, everything worked fine (besides the aforementioned bug), and also if I checkout an earlier commit, there are no problems.
I have reproduced this behaviour with the minimal setup attached below.
The project is compiled using Java SE 10, as IDE I'm using Eclipse, but in my project properties, I only have the option to select "Generic 2.1" as JPA-Platform. May this be an problem?
Are you able to reproduce this error?
As far as I can see, the Entity-class is listed in the persistence.xml and also annotated with #Entity, but not loaded by EclipseLink. Cleaning the project or even creating a new one does not solve the problem.
Do you have an idea, what my mistake might be? Am I missing any fundamental point about the usage of JPA 2.2/EclipseLink 2.7.1?
Thank you for any hints or comments!
main method in the main class:
EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("Example");
EntityManager entityManager = entityManagerFactory.createEntityManager();
entityManager.getTransaction().begin();
Artifact artifact = new Artifact();
entityManager.persist(artifact);
entityManager.getTransaction().commit();
entityManager.close();
entityManagerFactory.close();
Entity Artifact:
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
#Entity
#NamedQuery(name = "Artifact.findAll", query = "SELECT a FROM Artifact a")
public class Artifact {
private int id;
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
public int getId() {
return this.id;
}
public void setId(int id) {
this.id = id;
}
}
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="Example">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>Artifact</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:h2:./inventory;create=true"/>
<property name="javax.persistence.jdbc.user" value="APP"/>
<property name="javax.persistence.jdbc.password" value="APP"/>
<property name="eclipselink.logging.level" value="FINEST"/>
<property name="eclipselink.ddl-generation" value="create-or-extend-tables"/>
<property name="eclipselink.ddl-generation.output-mode" value="database"/>
</properties>
</persistence-unit>
</persistence>
pom.xml for Maven dependencies:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>JPATest</groupId>
<artifactId>JPATest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<release>10</release>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.eclipse.persistence/javax.persistence -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.2.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.persistence/eclipselink -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.7.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.197</version>
</dependency>
</dependencies>
</project>
I had the same problem too. finally, it was solved with an update in pom.xml.
Eclipselink 2.7.1 version has some bugs that fixed at newer versions.
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.7.1</version>
</dependency>
to
<version>2.7.5</version>
before the update, entities are not loaded and em.getMetamodel() was empty.
after the update, all of my entities are loaded successfully
issues and the fixed bugs can be accessed from this link.
I have pretty much the same environment and experience the same problem. I hardly dare to say but in eclipse a "project/maven/update project ..." helped (so far).
I'm new to this, did a lot of research now and still I'm not able to develop a working Wildfly / Hibernate / MongoDB Environment.
Here is basically did so far:
Read this Guide
Download Wildfly 10
Download Hibernate OGM 5.1.0.Final and ORM 5.1.4 Modules Archive
Extract Modules into wildfly/modules
Download/Install MongoDB (i tried 2 Versions)
via Brew on Mac
via Ubuntu in an VM
Create new Maven Web Project in Netbeans
Next Step is to edit pom.xml, jboss-deployment-structure.xml, persistence.xml. And that's the Point where the trouble begins. I tried different entries and get different errors. Right now my configuration looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.hibernate.ogm" slot="5.1" services="export" />
<module name="org.hibernate.ogm.mongodb" slot="5.1" services="export" />
</dependencies>
</deployment>
</jboss-deployment-structure>
I saw different Versions of this file, sometimes with slot="main", sometimes with services="import".
Persitence.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="comic-PU" transaction-type="JTA">
<provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="jboss.as.jpa.providerModule" value="org.hibernate:5.1"/>
<property name="hibernate.ogm.datastore.provider" value="mongodb"/>
<property name="hibernate.ogm.datastore.database" value="comicDB"/>
<property name="hibernate.ogm.datastore.host" value="localhost"/>
<property name="hibernate.ogm.datastore.port" value="27017"/>
<property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
</properties>
I'am pretty sure here is something wrong. When deploying the Project, Wildfly tries to read persistence.xml, then stuck for a moment and:
20:58:33,255 INFO [org.jboss.as.jpa] (MSC service thread 1-6) WFLYJPA0002: Read persistence.xml for comic-PU
21:03:32,767 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0348: Timeout after [300] seconds waiting for service container stability. Operation will roll back. Step that first updated the service container was 'deploy' at address '[("deployment" => "MYAPP.war")]'
21:03:32,772 ERROR [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0022: Deploy of deployment "ComicFeeder-1.0.war" was rolled back with no failure message
Pom.xml is mostly auto-generated, i added
<dependency>
<groupId>org.hibernate.ogm</groupId>
<artifactId>hibernate-ogm-mongodb</artifactId>
<version>5.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.ogm</groupId>
<artifactId>hibernate-ogm-core</artifactId>
<version>5.1.0.Final</version>
</dependency>
<archive>
<manifestEntries>
<mode>development</mode>
<url>${project.url}</url>
<Dependencies>org.hibernate.ogm:5.1 services, org.hibernate.ogm.mongodb:5.1 services</Dependencies>
</manifestEntries>
</archive>
Is the manifest entry necessary?
An Errors I got:
Wildfly: org.hibernate.search.engine 5.6.1.Final not found
in wildfly/modules/org/hibernate/search/engine the modules name is "5.6.1.Final-orm51" -> renamed it to 5.6.1.Final, edit the Entry in 5.6.1.Final/modules.xml
Wildfly then starts without that error
This looks like a bug to me
Where is my mistake? What's your "workflow" when you start a new project with hibernate, wildfly and mongodb?
Would it be easier to use Glassfish or any other Server?
Some Tutorials I found are outdated or just did not work (for me).
I decided to try out Hibernate today, which looks promising, although the setup could be easier. After having found solutions for the first million or so configuration errors I'm now stuck with this one:
Exception in thread "main" javax.persistence.PersistenceException: [PersistenceUnit: manager1] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915)
(...)
Caused by: org.hibernate.HibernateException: Bean Validation not available in the class path but required in javax.persistence.validation.mode
at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.applyHibernateListeners(BeanValidationIntegrator.java:281)
at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:134)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:303)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1750)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905)
... 5 more
Peristence.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">
<persistence-unit name="manager1" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>net.zomis.hibernate.Game</class>
<class>net.zomis.hibernate.TestFields</class>
<shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
<validation-mode>CALLBACK</validation-mode>
<properties>
<property name="javax.persistence.validation.mode" value="NONE" />
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="validate"/>
</properties>
</persistence-unit>
</persistence>
The (as far as I can tell) relevant portions of hibernate.cfg.xml
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
(...)
<property name="hbm2ddl.auto" >validate</property>
<mapping class="net.zomis.hibernate.Game" />
<mapping class="net.zomis.hibernate.TestFields" />
</session-factory>
</hibernate-configuration>
I have tried adding this to the build path without any change. I have googled for Bean Validation not available in the class path but required in javax.persistence.validation.mode and also just Bean Validation not available in the class path. I found the source code, but that doesn't help me much.
I have also tried removing the properties from the xml configuration files, without any luck.
I do not use Maven. I simply use Eclipse and build and run the project directly from Eclipse.
The obvious question is: How can I solve this problem? Do I need an additional jar in my build path that I have missed? (In that case which one?) and also: Why is it needed? Can I change something so that it is not needed anymore?
You need to have the validation-api (there's a download JAR link you can use as you don't use maven) in your classpath.
Hibernate searches for the javax.validation.Validation class in the classpath.
If it doesn't find it it throws the Bean Validation not available in the class path but required in javax.persistence.validation.mode error.
If you're not using maven you need to build up the classpath yourself and it's easy to miss a jar. It might be worthwhile to just use maven to bootstrap your project, and to make sure you have all the jars in place.
If you're using maven, the validation-api is pulled in as a transitive dependency from hibernate-validator.
You need the Hibernate Validator artifact:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.3.1.Final</version>
</dependency>
This will also include the Bean Validation API, which indeed is in this case a requirement as well.
In case you are not using any Bean Validation constraints (e.g. #NotNull, #Before, #Pattern, etc) you could also just remove
<validation-mode>CALLBACK</validation-mode>
or set it to NONE. Bean Validation is not required for Hibernate usage it is just an add-on defined in the JPA specification. If Bean Validation is on the classpath life cycle based validation (validation of entities on pre-update, pre-persist, etc) is automatically enabled (see also http://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/#d0e3096 and of course the JPA 2 specification).
On the other hand, if you don't have Bean Validation on the classpath, but explicitly ask for it via the configuration option in persistence.xml you get the error you describe.
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 ...
This happens when you have multiple entries of the same class in your classpath.
The ideal place to have your entities is closest to the same class loader which loads kundera core and client(HBase, Cassandra etc.).
For example, if these kundera files are under WEB-INF/lib, you'd rather have your entities under the application where as if kundera files are on the applications lib folder, better bundle your entities in a jar and put them there (and remove the entities in your app).
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