Hi Leif,
I have had a whole lot of difficulties getting self-contained iBATIS
persistance working with AAR files, and some of the stuff I've done may
apply to JPA (and Hibernate too).
Basically, moving stuff from your AAR file out into the
axis2/WEB-INF/lib or classes areas is not a good idea because you get
into situations where multiple services that do common stuff such as
log4j logging, start only being able to have one shared logger between
them. I find as soon as one dependency jar gets loaded from the
WEB-INF/lib folder, everything starts loading from that area.
Note that the service architecture I'm using is for Spring running
inside the AAR file, so it has the composite classloader turned on for
my web services (see the Axis2 web page docs on Spring inside AARs for
more info).
1. The AAR file has to be deployed exploded - I'm not sure of the exact
reasons behind this, but this solved most of my issues - basically, stop
the Tomcat, unzip the AAR file to a folder under WEB-INF/services with
the name of the AAR and re-start Tomcat. You can only have the exploded
folder under services OR the AAR file - not both as a normal .war file
setup allows. If both are there, Axis2 tries to load them as both
services with the same name, and ends up not loading them due to a
naming conflict.
2. I also switched off the log4j logging of the axis2 container, and
removed the log4j.jar from the axis2/WEB-INF/lib folder, as it was
causing classloader conflicts with the log4j configs in my services.
3. After all this I had to also put my iBATIS XML mapping files into the
WEB-INF/classes area - this wasn't so bad as they don't conflict with
other services under there.
cheers, hope some of this helped - I spent about a week getting my
services setup properly and loading correctly.....
Ants.
Leif Singer wrote:
Hello,
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
persistence.xml.
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Anthony
-------------------------------------
Anthony Bull
Senior Developer
Black Coffee Software Ltd
PO Box 10-192 The Terrace
Wellington, New Zealand
[EMAIL PROTECTED]
Ph +64 4 472 8818
Fax +64 4 472 8811
-------------------------------------
www.bcsoft.co.nz
---------------------------------------------------------------
This email may contain confidential or privileged information,
and is intended for use only by the addressee, or addressees.
If you are not the intended recipient please advise the sender
immediately and do not copy, use or disclose the contents to
any other person or organisation.
Black Coffee Software Ltd accepts no responsibility for viruses
received with this email, or to any changes made to the original
content. Any views or opinions expressed in this email may be
personal to the sender and are not necessarily those of Black
Coffee Software Ltd.
---------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]