zoukankan      html  css  js  c++  java
  • java.lang.NoClassDefFoundError: org/apache/poi/poifs/filesystem/FileMagic

    maven项目,使用POI读写2007版本Excel出错,一直不知道原因,后来发现导入的poi,和poi-ooxml版本不一致

    Exception in thread "Thread-4" java.lang.NoClassDefFoundError: org/apache/poi/poifs/filesystem/FileMagic
    	at org.apache.poi.openxml4j.opc.internal.ZipHelper.openZipStream(ZipHelper.java:208)
    	at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:98)
    	at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:324)
    	at org.apache.poi.util.PackageHelper.open(PackageHelper.java:37)
    	at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:295)
    	at main.App.readExcel(App.java:274)
    	at main.App.lambda$actionPerformed$0(App.java:177)
    	at java.lang.Thread.run(Thread.java:748)
    Caused by: java.lang.ClassNotFoundException: org.apache.poi.poifs.filesystem.FileMagic
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    	... 8 more

    pom文件poi配置

     <dependency>
          <groupId>org.apache.poi</groupId>
          <artifactId>poi</artifactId>
          <version>3.16</version>
    </dependency>
    <dependency>
           <groupId>org.apache.poi</groupId>
           <artifactId>poi-ooxml</artifactId>
           <version>3.17</version>
    </dependency>

    改为一样的版本就好了,如都用3.16

  • 相关阅读:
    MVC过滤器
    MVC自带的校验
    FPGA简单概述
    CAN总线扩展数据帧介绍
    简述人工智能发展的先决条件
    CAN总线标准帧
    CAN总线应用
    CAN总线优点
    CAN总线概述
    高速PCB设计注意事项
  • 原文地址:https://www.cnblogs.com/BeautyInWholeLife/p/8486825.html
Copyright © 2011-2022 走看看