aused by: org.apache.xmlbeans.SchemaTypeLoaderException: XML-BEANS compiled schema: Incompatible min

时间:2022-04-16 04:53:46

版权声明:转载请注明出处 https://blog.csdn.net/seashouwang/article/details/24025871

6.导入Word2007-docx,Excel-2007-xlsx出现错误
[2014-04-18 09:39:14.195]-[ERROR] org.apache.struts2.dispatcher.Dispatcher Exception occurred during processing request: null
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ExceptionInInitializerError
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
at java.lang.reflect.Field.acquireFieldAccessor(Field.java:918)
at java.lang.reflect.Field.getFieldAccessor(Field.java:899)
at java.lang.reflect.Field.get(Field.java:358)
at org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XmlBeans.java:770)
at org.openxmlformats.schemas.wordprocessingml.x2006.main.DocumentDocument.<clinit>(Unknown Source)
at org.openxmlformats.schemas.wordprocessingml.x2006.main.DocumentDocument$Factory.parse(Unknown Source)
at org.apache.poi.xwpf.usermodel.XWPFDocument.onDocumentRead(XWPFDocument.java:134)
at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:159)
at org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:116)
at org.apache.poi.xwpf.extractor.XWPFWordExtractor.<init>(XWPFWordExtractor.java:53)
at com.eshore.govwb.web.util.FileUtil.readWord2007(FileUtil.java:602)
at com.eshore.govwb.web.demo.LucenesAction.upload(LucenesAction.java:295)
... 71 more
Caused by: java.lang.RuntimeException: Could not instantiate SchemaTypeSystemImpl (java.lang.reflect.InvocationTargetException): is the version of xbean.jar correct?
at schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707.TypeSystemHolder.loadTypeSystem(Unknown Source)
at schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707.TypeSystemHolder.<clinit>(Unknown Source)
... 86 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
... 88 more
Caused by: org.apache.xmlbeans.SchemaTypeLoaderException: XML-BEANS compiled schema: Incompatible minor version - expecting up to 23, got 24 (schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707.index) - code 3
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl$XsbReader.<init>(SchemaTypeSystemImpl.java:1522)
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.initFromHeader(SchemaTypeSystemImpl.java:260)
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(SchemaTypeSystemImpl.java:183)
... 92 more

问题描写叙述:在excel,word文件上传时,Word2007-docx,Excel-2007-xlsx出现错误,主要原因是由于在使用xmlBeans.jar冲突的问题或者是版本号太低。
改动方法:将项目中使用的xbeans-2.0.jar,xmlbeans2.3.jar低版本号删除,使用了一个xmlbeans-2.4.jar问题就攻克了。

參考:http://markmail.org/message/ccydmwwpr6vyy7cp
http://*.com/questions/1180776/runtimeexception-from-xmlbeans-cant-find-compiled-schema
http://mail-archives.apache.org/mod_mbox/xmlbeans-user/200910.mbox/<c9de60ec-4bb3-45c1-9fbf-a7d89c95c602@default>
excel2007读取方法參考:http://www.iteye.com/problems/55196
word读取方法參考:http://blog.csdn.net/xingyunpi/article/details/6896638

http://blog.sina.com.cn/s/blog_6c7f7b690100lh8y.html

资源有本人上传的源代码,希望对在实现该功能的朋友给予小小帮助。