When using the latest POI3.11, run the
Workbook Workbook = new Xssfworkbook (); An error occurred during this code:
Java.lang.NoSuchMethodError:javax.xml.stream.XMLEventFactory.newFactory () ljavax/xml/stream/xmleventfactory; At Org.apache.poi.openxml4j.opc.internal.marshallers.packagepropertiesmarshaller.<clinit> ( packagepropertiesmarshaller.java:45) at Org.apache.poi.openxml4j.opc.OPCPackage.init (opcpackage.java:161) at Org.apache.poi.openxml4j.opc.opcpackage.<init> (opcpackage.java:141) at Org.apache.poi.openxml4j.opc.package.<init> (package.java:37) at Org.apache.poi.openxml4j.opc.ZipPackage. <init> (zippackage.java:65) at Org.apache.poi.openxml4j.opc.OPCPackage.create (opcpackage.java:337) at Org.apache.poi.xssf.usermodel.XSSFWorkbook.newPackage (xssfworkbook.java:410) at Org.apache.poi.xssf.usermodel.xssfworkbook.<init> (xssfworkbook.java:217) at Org.apache.poi.xssf.streaming.sxssfworkbook.<init> (sxssfworkbook.java:216) at Org.apache.poi.xssf.streaming.sxssfworkbook.<init> (sxssfworkbook.java:185) at Org.apache.poi.xssf.streaming. Sxssfworkbook.<init> (sxssfworkbook.java:160) at org.apache.poi.xssf.streaming.sxssfworkbook.<init> ( sxssfworkbook.java:135) at org.apache.poi.xssf.streaming.sxssfworkbook.<init> (SXSSFWorkbook.java:96) at Testexport.test (testexport.java:11) at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at SUN.REFLECT.N Ativemethodaccessorimpl.invoke (nativemethodaccessorimpl.java:39) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (DELEGATINGMETHODACCESSORIMPL.JAVA:25) at Java.lang.reflect.Method.invoke (method.java:597) at Org.junit.runners.model.frameworkmethod$1.runreflectivecall ( frameworkmethod.java:44) at Org.junit.internal.runners.model.ReflectiveCallable.run (reflectivecallable.java:15) At org.junit.runners.model.FrameworkMethod.invokeExplosively (frameworkmethod.java:41) at Org.junit.internal.runners.statements.InvokeMethod.evaluate (INVOKEMETHOD.JAVA:20) at Org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored (BLOCKJUNIT4CLASSRunner.java:79) at Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:71) at Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:49) at Org.junit.runners.parentrunner$3.run (parentrunner.java:193) at Org.junit.runners.parentrunner$1.schedule ( parentrunner.java:52) at Org.junit.runners.ParentRunner.runChildren (parentrunner.java:191) at org.junit.runners.parentrunner.access$000 (parentrunner.java:42) at Org.junit.runners.parentrunner$2.evaluate ( parentrunner.java:184) at Org.junit.runners.ParentRunner.run (parentrunner.java:236) at Org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (JUNIT4TESTREFERENCE.JAVA:50) at Org.eclipse.jdt.internal.junit.runner.TestExecution.run (testexecution.java:38) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:467) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:683) at ORG.ECLIPSE.JDt.internal.junit.runner.RemoteTestRunner.run (remotetestrunner.java:390) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (remotetestrunner.java:197)
WillXssfworkbook Changeto H Ssfworkbook, that is, the above code is modified to;
Workbook Workbook = new Hssfworkbook ();
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
New Xssfworkbook () Error java.lang.NoSuchMethodError solution when using POI to manipulate Excel