错误:java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlException

一,错误:java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlException

实现java代码导入导出Excel表格请参考导入excel代码(https://blog.csdn.net/laterstage/article/details/131713449?spm=1001.2014.3001.5501)

  1. 错误原因:xmlbeans的jar

解决方式:引入jar包

  1. 传统java项目,将xmlbeans-3.1.0.jar添加到依赖里面
  2. maven项目引入下面依赖
    <dependency>
      <groupId>org.apache.xmlbeansgroupId>
      <artifactId>xmlbeansartifactId>
      <version>3.1.0version>
    dependency>

如果以上问题没有解决,将下面pom依赖进行版本对照。

 
    <dependency>
      <groupId>org.apache.poigroupId>
      <artifactId>poiartifactId>
      <version>4.1.0version>
    dependency>
    <dependency>
      <groupId>org.apache.poigroupId>
      <artifactId>poi-ooxmlartifactId>
      <version>4.1.0version>
    dependency>

    
    <dependency>
      <groupId>org.apache.commonsgroupId>
      <artifactId>commons-collections4artifactId>
      <version>4.1version>
    dependency>

    <dependency>
      <groupId>org.apache.commonsgroupId>
      <artifactId>commons-compressartifactId>
      <version>1.18version>
    dependency>

    <dependency>
      <groupId>org.apache.commonsgroupId>
      <artifactId>commons-math3artifactId>
      <version>3.6.1version>
    dependency>

    <dependency>
      <groupId>org.apache.commonsgroupId>
      <artifactId>commons-math3artifactId>
      <version>3.6.1version>
    dependency>

    <dependency>
      <groupId>org.apache.poigroupId>
      <artifactId>poi-ooxml-schemasartifactId>
      <version>4.1.2version>
    dependency>

    <dependency>
      <groupId>org.apache.xmlbeansgroupId>
      <artifactId>xmlbeansartifactId>
      <version>3.1.0version>
    dependency>

你可能感兴趣的:(java,java,apache,开发语言)