0
我想讀使用Apache POI .xlsx文件,但錯誤我擊中:錯誤的
閱讀.xlsx文件給出的InvocationTargetException
org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
完整堆棧跟蹤說:
org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
at org.apache.poi.POIXMLFactory.createDocumentPart(POIXMLFactory.java:63)
at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:625)
at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:637)
at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:186)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:290)
at com.gemini.util.WorkbookObject.createExcelObj(WorkbookObject.java:77)
at com.gemini.util.ObjectPool.prepareList(ObjectPool.java:24)
at com.gemini.util.WorkbookObject.getInstance(WorkbookObject.java:36)
at dhfl_idecimal.decimal_dhfl.calculator.Calculator.processWealthPlusAce(Calculator.java:33)
at dhfl_idecimal.decimal_dhfl.calculator.Calculator.main(Calculator.java:167)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:56)
at org.apache.poi.POIXMLFactory.createDocumentPart(POIXMLFactory.java:60)
... 9 more
Caused by: org.apache.xmlbeans.XmlException: Attribute "type" was already specified for element "v:shape".
at org.apache.poi.xssf.usermodel.XSSFVMLDrawing.read(XSSFVMLDrawing.java:138)
at org.apache.poi.xssf.usermodel.XSSFVMLDrawing.<init>(XSSFVMLDrawing.java:121)
... 15 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 549; Attribute "type" was already specified for element "v:shape".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:327)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121)
at org.apache.poi.util.DocumentHelper.readDocument(DocumentHelper.java:137)
at org.apache.poi.xssf.usermodel.XSSFVMLDrawing.read(XSSFVMLDrawing.java:136)
... 16 more
java.lang.NullPointerException
at dhfl_idecimal.decimal_dhfl.calculator.util.UpdateInput.updateInputParamForWealthPlusAce(UpdateInput.java:23)
at dhfl_idecimal.decimal_dhfl.calculator.Calculator.processWealthPlusAce(Calculator.java:38)
at dhfl_idecimal.decimal_dhfl.calculator.Calculator.main(Calculator.java:167)
我也試過添加org.apache.xmlbeans
罐子,但沒有運氣。
您可以添加您的代碼片段,它讀取.xlsx文件? –