axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leif Singer <>
Subject Classloaders and JPA
Date Mon, 29 Oct 2007 00:23:51 GMT

I'm trying to implement a simple Axis2 service using JPA. Its only  
operation is supposed to take a model object (e.g., a "Person") as its  
sole argument and persist it.

I understand that each AAR uses a seperate classloader. Also, I  
believe I've read that the libraries I use (JPA, specifically) are  
being loaded by a different classloader than my AAR.

The issue I'm having is this:
1. My service implementation can see my model classes and the  
2. JPA cannot see the persistence.xml in my AAR, no matter where I  
place it.
3. JPA cannot see my model classes in my AAR.

I solved this by putting the persistence.xml into Tomcat's axis2/WEB- 
INF/classes/META-INF directory and putting my model classes into the  
axis2/WEB-INF/classes directory, i.e., outside the AAR.

The trouble I have with this is that I want to have my AAR as self- 
contained as possible. I could live with a seperate persistence.xml --  
after all, it's configuration -- but would really like to have the  
model classes packaged into the AAR and *still* have JPA see them.

Without a JEE container, is there a way to achieve this? What's  
considered a good practice to solve this?

I use JiBX for un-/marhalling. I use Hibernate's JPA implementation. I  
tried this running in the SimpleAxisServer and Apache Tomcat 5.0.28.

Thanks in advance
   Leif Singer

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message