Closed TheGeekPharaoh closed 11 years ago
Looks like, entities are not loaded. One question, please verify if your persistence.xml is with in (say root/META-INF folder and your entity classes should be available within root folder.
If they are packaged within a jar, then please add jar path within
-Vivek
The persistence.xml file is in the appropriate place. The entity classes are in the same JAR as the persistence.xml. Do I still need to add the jar path to the persistence.xml file?
Nope. Can you please share packaging of your jar file?
-Vivek
Alternatively, possible for you to bundle classes and persistence.xml within war(under WEB-INF folder), classes with classes folder and META-INF/persistence.xml with WEB-INF folder?
-Vivek
My EAR structure looks like this:
KunderaTests.ear ->KunderaTestsWeb.war ->KunderaTests-ejb.jar (this is where my persistence.xml and Entity classes are)
The KunderaTests-ejb.jar is pretty simple. One package with a couple of @Entity classes. The META-INF directory has the persistence.xml file.
For the record, I'm using JBoss EAP 6.1 and Kundera-trunk for my testing, with Cassandra as the datastore.
Any update on this?
I follow the same structure in a project of mine that is working with latest trunk. Please take a look at https://github.com/pires/sherlock.
Hi,
Can you give it a try with:
-Vivek
Vivek --
I understand point #1, but I'm afraid I don't understand what you're asking me to try in point #2. Can you restate?
@sdnakhla I think he meant for you to include all your entity classes in <class></class>
tag in persistence.xml.
I have made the recommended changes. When ONLY setting "jboss.as.jpa.managed" to "false", the error persists. When also adding the
Caused by javax.el.ELException with message: "java.lang.ClassCastException: org.jboss.modules.ModuleClassLoader cannot be cast to java.net.URLClassLoader"
For further reference, here is my persistence.xml file:
<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="KunderaTests">
<provider>com.impetus.kundera.KunderaPersistence</provider>
<class>com.test.Company</class>
<class>com.test.User</class>
<properties>
<property name="jboss.as.jpa.managed" value="false" />
<property name="kundera.nodes" value="localhost" />
<property name="kundera.port" value="9160" />
<property name="kundera.keyspace" value="dev" />
<property name="kundera.dialect" value="cassandra" />
<property name="kundera.client.lookup.class"
value="com.impetus.client.cassandra.pelops.PelopsClientFactory" />
<property name="jboss.entity.manager.factory.jndi.name"
value="java:/KunderaTestsEntityManagerFactory" />
</properties>
</persistence-unit>
Did you take an update of latest trunk?
-Vivek
Yes, all tests were conducted with code from the trunk that was downloaded and compiled yesterday evening.
KK, Can you please look into this and share Jboss sample apps persistence.xml and other configurations?
-Vivek
I thought this may be related to the fact that I was using JBoss Seam as my application framework, so I created a new JavaEE6 project using only standard libraries. I re-ran the tests, but received the same error as before. Is there any update to this issue?
CORRECTION...
Looks like this has been resolved in 2.6-FINAL. Thanks!
Hi, can anyone just explain a little like, where do we have to place the jar file consisting of the entity classes and if we don't place the jar file like this, then only adding the class tag in persistence.xml would be sufficient or not ? Kindly help!
It should be in the classpath of your project else , when placed externally you need to add it's path in persistence.xml by using
<jar-file>/home/impetus/perf_n.jar</jar-file> <jar-file>/home/impetus/perf.jar</jar-file>
Chhavi
I'm playing around with Kundera for the first time, using 2.6-SNAPSHOT on Cassandra. My entity class looks like this:
@Entity(name = "User") @Table(name = "users", schema = "dev@KunderaTests") public class User implements Serializable {
...getters & setters....
}
...and my persistence.xml looks like 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">
My project starts up just fine, with no errors or exceptions. However, when I run this code:
I get an Exception saying, "com.impetus.kundera.KunderaException: Entitymatadata should not be null" and I see the following line written to my logs:
"No Entity metadata found for the class class com.test.User. Any CRUD operation on this entity will fail.If your entity is for RDBMS, make sure you put fully qualified entity class name under tag in persistence.xml for RDBMS persistence unit. Returning null value."
I looked at the "Getting Started" guide and everything seems to be in order according to the examples. Any idea why I'm getting this?