Link to home
Start Free TrialLog in
Avatar of abladapt
abladaptFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Get OpenJPA jars loaded by tomcat

Hi
I have a spring mvc app which uses openjpa 2.1.1 as its persistence framework. It is developed as a Maven project in STS, and runs locally on vFaric TC Server (Tomcat 7).

When we first deployed the war to Websphere 8.5, we encountered classloader conflicts with the following 3 openjpa jars which were in our war file:

geronimo-jpa_2.0_spec-1.1.jar
geronimo-jta_1.1_spec-1.1.1.jar
validation-api-1.0.0.GA.jar

Removing these from the war and deferring to Websphere's bundled openjpa worked fine, so I changed the openjpa POM dependency scope from 'compile' to 'provided' (so that these jars would not be packaged into the war file).

Since Tomcat 7 is not JEE compliant, I placed the 3 jars in Tomcat\lib (also tried the vfabric-tc-server lib - which wraps tomcat), but the JPA classes were not visible by the app at startup (noclassdeffound exceptions in console).

I also tried adding the jars to the server classpath from 'launch configuration' within STS - no luck there either.

Is there a class loader order that needs to be set somewhere in Tomcat such that JPA loads before the app?

What I need is a build that will work when deployed to either Tomcat or Websphere.

Any help will be much appreciated.

Thanks
Jim
SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of abladapt

ASKER

Solved myself following guidance from girionis