2

我正在尝试加载 .xlsx 文件。我认为 Axis2 和 poi-ooxml-3.8 jar 文件存在一些冲突。我收到以下错误:

org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
2013-08-29 13:07:10,142 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:62)
2013-08-29 13:07:10,142 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:403)
2013-08-29 13:07:10,142 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:408)
2013-08-29 13:07:10,142 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:155)
2013-08-29 13:07:10,142 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:190)
2013-08-29 13:07:10,142 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at com.xorail.cactus.ptc.PtcTableBackingBean.importAssetData(PtcTableBackingBean.java:171)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at com.xorail.cactus.ptc.PtcTableBackingBean.submitImportData(PtcTableBackingBean.java:774)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at java.lang.reflect.Method.invoke(Unknown Source)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.el.parser.AstValue.invoke(AstValue.java:170)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at javax.faces.component.UICommand.broadcast(UICommand.java:315)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:329)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.ajax4jsf.component.AjaxViewRoot.broadcastEventsForPhase(AjaxViewRoot.java:304)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:261)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:474)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:349)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at java.lang.Thread.run(Unknown Source)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2) Caused by: java.lang.reflect.InvocationTargetException
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at java.lang.reflect.Constructor.newInstance(Unknown Source)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:60)
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  ... 53 more
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2) Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.xmlbeans.XmlOptions.setLoadReplaceDocumentElement(Ljavax/xml/namespace/QName;)Lorg/apache/xmlbeans/XmlOptions;" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, org/apache/poi/xssf/usermodel/XSSFDrawing, and the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) for resolved class, org/apache/xmlbeans/XmlOptions, have different Class objects for the type javax/xml/namespace/QName used in the signature
2013-08-29 13:07:10,158 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-2)  at org.apache.poi.xssf.usermodel.XSSFDrawing.<init>(XSSFDrawing.java:81)

我必须使用 web 服务以及在我的应用程序中加载 xlsx 文件。这些是我在我的应用程序中拥有的 jar 文件

poi-3.8.jar
poi-ooxml-3.8.jar
poi-ooxml-schemas-3.8.jar
xalan-2.7.0.jar
xml-resolver-1.2.jar
geronimo-annotation_1.0_spec-1.1.jar
geronimo-jaxws_2.1_spec-1.0.jar
geronimo-jta_1.1_spec-1.1.jar
geronimo-saaj_1.3_spec-1.0.1.jar
geronimo-ws-metadata_2.0_spec-1.1.2.jar
gson-1.6.jar
httpcore-4.0.jar
javassist-3.12.1.GA.jar
jaxb-api-2.1.jar
jaxb-impl-2.1.7.jar
jaxb-xjc-2.1.7.jar
jaxen-1.1.1.jar
jaxrpc-api-1.1.jar
dom4j-1.1.jar"
axiom-api-1.2.8.jar
axiom-dom-1.2.8.jar
axiom-impl-1.2.8.jar
axis2-jaxws-1.5.1.jar
axis2-kernel-1.5.1.jar
axis2-metadata-1.5.1.jar
axis2-saaj-1.5.1.jar
axis2-transport-http-1.5.1.jar
woden-api-1.0M8.jar
woden-impl-dom-1.0M8.jar
wsdl4j-1.6.2.jar
wstx-asl-3.2.4.jar
XmlSchema-1.4.3.jar
stax-api-1.0-2.jar

请帮我找出问题所在。提前致谢。

4

1 回答 1

1

这可能是由于 XMLBeans 从 package 提供了它自己的类版本javax,您最好的选择是从 xmlbeans jar 文件中删除这些类文件。

有关于 POI 邮件列表的讨论,以进行 Apache XMLBeans 的阁楼发布以解决此问题,但这仍在进行中,另请参阅https://bz.apache.org/bugzilla/show_bug.cgi?id=59268

于 2016-04-04T07:17:05.820 回答