Closed pluttrell closed 9 years ago
Does anyone have any ideas on what might be causing this...or how to resolve it? At the moment it's blocking our PoC using Kundera.
@pluttrell
Sorry for late response. The team was busy with a release and hence could not respond.
Can you please make sure all dependent jars are added in your class-path.
content
in /content/MyTest.ear
refers to the directory where your EAR is deployed.
Also, can you please share a sample project with us to help us quickly look into the issue?
HTH, Devender
@pluttrell
Please set the following property in your persistence.xml
<property name="jboss.as.jpa.managed" value="false" />
Karthik.
@karthikprasad13
Adding <property name="jboss.as.jpa.managed" value="false" />
did work initially, however then I received NPE's because the @PersistenceUnit
annotation wasn't populating the entityManagerFactory
member... this was due to the fact that the class is actually created by our internal services framework which uses Google Guice for DI...and of course isn't going to properly process the @PersistenceUnit
annotation. As such I removed this annotation and am instead trying to load the PersistenceUnit manually as you would outside of Wildfly, which causes the same FileNotFoundException as above.
My entity class remains the same. Here's my new wip test code:
private EntityManager entityManager;
public MyTestEntity retrieveByUid(String uid) {
return getEntityManager().find(MyTestEntity.class, uid);
}
public void store(MyTestEntity myTestEntity) {
getEntityManager().persist(myTestEntity);
}
private EntityManager getEntityManager(){
if (entityManager == null){
EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("MyTestPersistenceUnit");
entityManager = entityManagerFactory.createEntityManager();
}
return entityManager;
}
Here's the error again (using Kundera v2.16):
java.io.FileNotFoundException: /content/MyTest.ear/lib/MyCore.jar (No such file or directory)
at com.impetus.kundera.classreading.Reader.getResourceIterator(Reader.java:180)
at com.impetus.kundera.configure.MetamodelConfiguration.loadEntityMetadata(MetamodelConfiguration.java:226)
at com.impetus.kundera.configure.MetamodelConfiguration.configure(MetamodelConfiguration.java:112)
at com.impetus.kundera.persistence.EntityManagerFactoryImpl.configure(EntityManagerFactoryImpl.java:158)
at com.impetus.kundera.persistence.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:135)
at com.impetus.kundera.KunderaPersistence.createEntityManagerFactory(KunderaPersistence.java:85)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
at ....
@devender-yadav
Wildfly 8.2 does not appear to be storing the EAR file in such a location as there is no directory on my test machine /content/MyTest.ear
.
@pluttrell
Please mail a sample test project at kundera@impetus.co.in to help us look into the issue further.
Chhavi
@pluttrell
Please try including your entity classes within <class>
tag and setting <exclude-unlisted-classes>
to true
in persistence.xml
Example:
<persistence-unit name="cassandra-test">
<provider>com.impetus.kundera.KunderaPersistence</provider>
<class>com.impetus.cassandra.entity.Book</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties> ....
Karthik.
@pluttrell
Is the issue resolved for you?
Chhavi
That depends... The last suggestion is an effective work around, which is why I closed this ticket.
But it's only a work around... Without looking at the code, I was quite surprised to see that Kundera was trying to read the file system in a place that doesn't exist..and further failing when it couldn't find what it was looking for. And after briefly looking at the code it appears to me that the classloading and metadata code might not work in all deployment environments, such as the one that we're deploying too...
There's another ticket 547 with a very similar issue, but the fix as proposed there (and above) did not resolve the problem for me.
I'm trying to get Kundera deployed in Wildfly 8.2 and am receiving the following exception which are causing my deployment to fail and have me blocked:
I have searched my entire file system and I do not have a directory
/content/MyTest.ear
.MyTest.ear was deploying fine prior to adding the
persistence.xml
.How do I reslove this, or go about further troubleshooting it?
For reference here is my
persistence.xml
:And here's my wip test code: