How do I make Weblogic 10 prefer the jars in myApp.war:/WEB-INF/lib/ without throwing VerifyErrors?

neu242 picture neu242 · Jun 8, 2011 · Viewed 14k times · Source

The Weblogic classloader seems to prefer system libraries over the libraries in my war's WEB-INF/lib/.

I've tried setting the following in WEB-INF/weblogic.xml, without success:

<weblogic-web-app>
    <container-descriptor>
        <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>
</weblogic-web-app>

This just gives me a lot of VerifyErrors:

exception is java.lang.VerifyError: (class: org/apache/xerces/parsers/AbstractSAXParser, method: parse signature: (Lorg/xml/sax/InputSource;)V) Incompatible object argument for function call
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
        Truncated. see log file for complete stacktrace

(I'm trying to avoid packaging the WAR into an EAR.)

Answer

artbristol picture artbristol · Jun 15, 2011

I was never able to fix this satisfactorily, other than by specifying -Djavax.xml.parsers.SAXParserFactory=[xerces sax parser factory class name] (and so on for the other JAXP factories like validation SchemaFactory) when starting Weblogic.

None of the filtering / prefer-web-inf stuff worked, possibly due to Weblogic requiring JAXP libraries on startup before it even reads any of the WAR / EAR config files.