weblogic resolve the conflict jar package

Foreword

POI use in the project development excel, word of the import and export functions, and POI when parsing xlsx and docx to two high version of the document need to rely on xmlbeans package, but weblogic container provides a low version of xmlbeans, resulting in an error:

Caused by: java.lang.NoSuchMethodError: org.apache.xmlbeans.XmlOptions.setLoadEntityBytesLimit(I)Lorg/apache/xmlbeans/XmlOptions;
at org.apache.poi.POIXMLTypeLoader.<clinit>(POIXMLTypeLoader.java:50)
at org.apache.poi.xssf.model.ThemesTable.<init>(ThemesTable.java:85)

Because under weblogic also deployed other applications, if you upgrade jar package may cause abnormalities of other applications, so we put the corresponding jar package under the current application and load the appropriate version under this application by adjusting the class load priority the program jar package;

Adjustment method

Then META-INFO / weblogic-application.xm configuration

<prefer-application-packages>
        <package-name>org.apache.xmlbeans.*</package-name>
</prefer-application-packages>

Guess you like

Origin www.cnblogs.com/ljch/p/12045160.html