问题描述
使用 POI 5 和 xmlbeans 4 导出 excel 时出现以下错误.
I am getting the below error when exporting excel using POI 5 with xmlbeans 4.
ServletException 的根本原因.
Root cause of ServletException.
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl.build(SchemaTypeLoaderImpl.java:161)
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(SchemaTypeSystemImpl.java:168)
at org.apache.xmlbeans.metadata.system.sXMLSCHEMA.TypeSystemHolder.<init>(TypeSystemHolder.java:41)
Truncated. see log file for complete stacktrace
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:164)
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(SchemaTypeSystemImpl.java:168)
at org.apache.xmlbeans.metadata.system.sXMLTOOLS.TypeSystemHolder.<init>(TypeSystemHolder.java:41)
at org.apache.xmlbeans.metadata.system.sXMLTOOLS.TypeSystemHolder.<clinit>(TypeSystemHolder.java:44)
at java.lang.Class.forName0(Native Method)
Truncated. see log file for complete stacktrace
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:162)
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(SchemaTypeSystemImpl.java:168)
at org.apache.xmlbeans.metadata.system.sXMLTOOLS.TypeSystemHolder.<init>(TypeSystemHolder.java:41)
at org.apache.xmlbeans.metadata.system.sXMLTOOLS.TypeSystemHolder.<clinit>(TypeSystemHolder.java:44)
at java.lang.Class.forName0(Native Method)
Truncated. see log file for complete stacktrace
我已经检查过我的 xmlbeans
来自 xmlbeans-4.0.0.jar
并且 ooxml-schema
已被删除并替换为poi-ooxml-full-5.0.0.jar
I have checked that my xmlbeans
come from xmlbeans-4.0.0.jar
and the ooxml-schema
has been removed and replaced with poi-ooxml-full-5.0.0.jar
可能出了什么问题?
推荐答案
加载的 xmlbeans 类可能版本错误.如果您可以检查 xmlbeans 版本的类加载器.像 weblogic 这样的服务器有旧版本的 xmlbeans 这可能会导致冲突
The classes of xmlbeans getting loaded can be of wrong version. If you can check the classloader for the version of xmlbeans. Servers like weblogic have older version of xmlbeans which can cause conflict
这篇关于运行时异常 - POI 5 和 xmlbeans的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!