java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlOptions

后端 未结 3 485
無奈伤痛
無奈伤痛 2021-01-28 15:23

I am trying to use POI in a servlet to process an uploaded file as Excel file:

public static String readExcel(InputStream inp) {
    // InputStream inp = null;
          


        
相关标签:
3条回答
  • 2021-01-28 15:59

    As detailed in the Apache POI page on Components and their Dependencies...

    If you want to use Common SS code, such as WorkbookFactory, you need both the poi and poi-ooxml POI jars on your classpath. In addition, you also need their dependencies too. One of the listed dependencies is xmlbeans, which incidentally is where your missing class comes from

    So, you just need to review the Components and Dependencies page, then make sure you include the appropriate jars from the binary package of Apache POI on your classpath. (Or use Maven and let it worry about that for you)

    0 讨论(0)
  • 2021-01-28 16:14

    System couldn't find the XML beans dependency on your classpath so you should add the XML beans dependency to your class path.

    The XML beans library looks like xmlbeans-x.x.x.jar

    https://mvnrepository.com/artifact/org.apache.xmlbeans/xmlbeans

    0 讨论(0)
  • 2021-01-28 16:20

    As found here, you have to add (at least that was it in my case): xmlbeans-2.6.0.jar

    0 讨论(0)
提交回复
热议问题