persistence@glassfish.java.net

SAXParser conflict with JPA in Sun Application Server 9

From: sonavor <jw_at_worleytown.com>
Date: Fri, 12 Sep 2008 22:07:56 -0700 (PDT)

I have been able to successfully create and run web applications (Struts) on
the Sun Application Server v9 where I use a JPA library to perform database
operations. I recently ran into a class loader problem where I am trying to
add and use my JPA library with an existing web application that was already
using some verson of the xerces.jar, xalan.jar and xml-apis.jar libraries.
The existing application must have those jars and updating them to new
versions causes a lot of problems so I want to avoid that.

The problem I am experiencing is when some new code I have added to the
existing web application tries to get an EntityManager from my JPA library.
There is a SAXParser conflict and the persistence.xml file cannot be read.
Here is a summary of the error in the application server log file:

Exception occurred while attempting to findGroupsByUser: No Persistence
provider for EntityManager named JpaLibPU: Provider named
oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider threw
unexpected exception at create EntityManagerFactory:
oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Local Exception Stack:
Exception [TOPLINK-30005] (Oracle TopLink Essentials - 2.0.1 (Build b05-p01
(04/28/2008))):
oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for
persistence archives with ClassLoader: WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
EJBClassLoader :
urlSet = []
doneCalled = false
 Parent -> java.net.URLClassLoader_at_73f0d8
Internal Exception: Exception [TOPLINK-34002] (Oracle TopLink Essentials -
2.0.1 (Build b05-p01 (04/28/2008))):
oracle.toplink.essentials.exceptions.XMLParseException
Exception Description: An exception occurred while processing
persistence.xml from URL:
file:/C:/Sun/JavaCAPS6/appserver/domains/domain1/applications/j2ee-modules/aeroport/WEB-INF/lib/AfaJpaLib.jar.
A SAXParser instance could not be created.
Internal Exception: org.xml.sax.SAXNotRecognizedException:
http://java.sun.com/xml/jaxp/properties/schemaLanguage


Caused by: Exception [TOPLINK-34002] (Oracle TopLink Essentials - 2.0.1
(Build b05-p01 (04/28/2008))):
oracle.toplink.essentials.exceptions.XMLParseException
Exception Description: An exception occurred while processing
persistence.xml from URL:
file:/C:/Sun/JavaCAPS6/appserver/domains/domain1/applications/j2ee-modules/aeroport/WEB-INF/lib/AfaJpaLib.jar.
A SAXParser instance could not be created.
Internal Exception: org.xml.sax.SAXNotRecognizedException:
http://java.sun.com/xml/jaxp/properties/schemaLanguage
        at
oracle.toplink.essentials.exceptions.XMLParseException.getXMLParseException(XMLParseException.java:116)


Caused by: org.xml.sax.SAXNotRecognizedException:
http://java.sun.com/xml/jaxp/properties/schemaLanguage
        at
org.apache.xerces.framework.XMLParser.setProperty(XMLParser.java:1682)
        at
org.apache.xerces.parsers.SAXParser.setProperty(SAXParser.java:770)
        at
org.apache.xerces.jaxp.SAXParserImpl.setProperty(SAXParserImpl.java:183)
        at
oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:121)

The error message seems to indicate that the xerces SAXParser is being found
by the Toplink libraries instead of whatever Toplink usually finds during
the persistence.xml processing. I have experimented unsuccessfully with
adding some jar files here and there in the application deployment directory
on the Sun Application Server domain (where the application is running). So
far I haven't figured out how to get the environment happy with the legacy
application and the JPA library.

Thanks for any help anyone has a suggestion to fix this problem within my
constraints.
-- 
View this message in context: http://www.nabble.com/SAXParser-conflict-with-JPA-in-Sun-Application-Server-9-tp19467529p19467529.html
Sent from the java.net - glassfish persistence mailing list archive at Nabble.com.