admin管理员组

文章数量:1125467

I'm deploying a Spring boot (2.7) war file to Weblogic 12c [java 8] and upload excel file to my app, however whenever i'm uploading and parsing the excel file with xlsx extension I'm getting below error , as stated below.

I tries adding preferred packages to weblogic.xml but still the same issue persists. The code works for xls extension , however fails for xlsx extension.

Gradle build details

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

// Apache POI Core
implementation 'org.apache.poi:poi:5.4.0'

implementation 'org.apache.poi:poi-ooxml:5.4.0'

// Custom jars for Weblogic Authentication and Oracle DB connectivity
implementation fileTree(dir: 'lib', include: ['*.jar'])

// .apachemons/commons-csv
implementation group: 'org.apachemons', name: 'commons-csv', version: '1.12.0'

}

Weblogic.xml

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="; xmlns:xsi="; xsi:schemaLocation="         .4/weblogic-web-app.xsd">
<wls:context-root>test-api</wls:context-root>
<wls:container-descriptor>
    <wls:prefer-application-packages>
        <wls:package-name>org.slf4j.*</wls:package-name>
        <wls:package-name>org.springframework.*</wls:package-name>
        <wls:package-name>org.apache.xmlbeans.*</wls:package-name>
        <wls:package-name>org.codehaus.jackson</wls:package-name>
        <wls:package-name>org.apache.poi.*</wls:package-name>
        <wls:package-name>org.openxmlformats.schemas.*</wls:package-name>
        <wls:package-name>com.microsoft.schemas.*</wls:package-name>
        <wls:package-name>org.apachemons.io.*</wls:package-name>
    </wls:prefer-application-packages>
</wls:container-descriptor>
</wls:weblogic-web-app>

Error Details

Caused by: org.apache.xmlbeans.XmlRuntimeException: java.lang.ClassCastException: org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl cannot be cast to org.apache.xmlbeans.SchemaTypeLoader
at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl.build(SchemaTypeLoaderImpl.java:163) ~[xmlbeans-5.3.0.jar:na]
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(SchemaTypeSystemImpl.java:201) ~[xmlbeans-5.3.0.jar:na]
at org.apache.xmlbeans.metadata.system.sXMLTOOLS.TypeSystemHolder.<init>(TypeSystemHolder.java:9) ~[xmlbeans-5.3.0.jar:na]
at org.apache.xmlbeans.metadata.system.sXMLTOOLS.TypeSystemHolder.<clinit>(TypeSystemHolder.java:6) ~[xmlbeans-5.3.0.jar:na]
... 103 common frames omitted
Caused by: java.lang.ClassCastException: org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl cannot be cast to org.apache.xmlbeans.SchemaTypeLoader
at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl.build(SchemaTypeLoaderImpl.java:158) ~[xmlbeans-5.3.0.jar:na]
... 106 common frames omitted

XMLBeans jar seems to be coming with 5.3 version , which is in turn coming from poi package . Still the issue persists.

Need some suggestion on solving this issue.

Note : Custom jars are ojdbc7-12.1.0.jar , wls-api-1.0.0.jar , wls-auth_1-1.0.0.jar , wls-identity-1.0.0.jar . These are used for Oracle DB connectivity and LDAP connectivity

本文标签: spring bootApache POI 5ClassCastException for SchemaTypeSystemImplStack Overflow