I have a web application that uses JAXB 2 . When deployed on an Oracle 10g Application Server , I get errors as soon as I try to marshal an XML file. It turns out that Oracle includes JAXB 1 in a jar sneakily renamed "xml.jar".
How I can force my webapp to use the version of the jaxb jars that I deployed in WEB-INF/lib
over that which Oracle has forced into the classpath, ideally through configuration rather than having to mess about with classloaders in my code?
I assume you use the former BEA Weblogic Server?
You can add a weblogic.xml file to your WEB-INF, looking like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd">
<weblogic-web-app>
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>
(in reply to the comment, I don't have enough reputation yet :-))
Indeed, DLL hell because it is "all or nothing". There seems to be another, more conditional way, described here . Haven't tried that one myself though...
If you are still using Oracle's OC4J then include their orion-application.xml in your EAR's META-INF. It should look something like...
<?xml version="1.0" encoding="UTF-8"?>
<orion-application>
<imported-shared-libraries>
<remove-inherited name="skip.this.package"/>
</imported-shared-libraries>
</orion-application>
...with the package you want skipped.
使用与Oracle实例不同的JVM,并确保它们的库不在您的类路径中。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.