POI异常java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlOptions

错误日志:在使用POI将Excel转换成HTML过程中,报错日志如下:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlOptions
	at org.apache.poi.POIXMLDocumentPart.(POIXMLDocumentPart.java:53)
	at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:72)
	at com.htkrail.emergency.utils.POIExcelToHtml.readExcelToHtml(POIExcelToHtml.java:41)
	at com.htkrail.emergency.test.MainTest.main(MainTest.java:45)
Caused by: java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlOptions
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	... 4 more

解决方法
添加xmlbean.jar、dom4j.jar包

因为官方包里默认是不包含xmlbean.jar包的,需要自己添加xmlbeans.jar这个包,还要添加dom4j.jar的包。

你可能感兴趣的:(javaEE,报错日志)