Reputation: 641
When we started using JPA in WebLogic 10.3.5, we noticed the following exception occasionally. About half of the time we would start the server any JPA call would result in the error, the other half of the time it was fine.
java.lang.ClassCastException: : org.apache.xerces.parsers.StandardParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration" occurred while attempting to determine the version of "myPersistenceXmlFileHere.xml"
Inside our EAR is a xercesImpl jat used by other portions of the project (non-JPA) without issue. I suspect the problem is simply interference from the WebLogic implementation jar.
Update: (Re)deploying in Eclipse seems to reproduce this issue regardless of settings in answer below. Once the exception appears once, it will not resolve and the only solution is to restart the server instance.
Upvotes: 2
Views: 2140
Reputation: 641
In our weblogic-application.xml we added the following, through trial and error. We now do not have any ClassCastExceptions, as the local jar should be taking precedence in this scenario.
<wls:prefer-application-packages>
<wls:package-name>org.eclipse.persistence.*</wls:package-name>
<wls:package-name>org.apache.xerces.xni.parser.*</wls:package-name>
<wls:package-name>org.apache.xerces.parsers.*</wls:package-name>
<wls:package-name>org.apache.xalan.*</wls:package-name>
</wls:prefer-application-packages>
Upvotes: 1