本文主要是介绍Maven缺少依赖:java.lang.ClassNotFoundException: org.apache.poi.openxml4j.exceptions.InvalidFormatExcepti,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.报错描述
运行IpHelper类的时候,报错:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/openxml4j/exceptions/InvalidFormatExceptionat com.ggstar.util.ip.IpHelper.getRegionRelationMap(IpHelper.java:88)at com.ggstar.util.ip.IpHelper.getIpRelation(IpHelper.java:58)at com.ggstar.util.ip.IpHelper.buildTrain(IpHelper.java:33)at com.ggstar.util.ip.IpHelper.<clinit>(IpHelper.java:27)at _1005SparkSQLproject.Log.IpUtils$.getCity(IpUtils.scala:12)at _1005SparkSQLproject.Log.IpUtils$.main(IpUtils.scala:16)at _1005SparkSQLproject.Log.IpUtils.main(IpUtils.scala)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:498)at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.ClassNotFoundException: org.apache.poi.openxml4j.exceptions.InvalidFormatExceptionat java.net.URLClassLoader.findClass(URLClassLoader.java:381)at java.lang.ClassLoader.loadClass(ClassLoader.java:424)at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)at java.lang.ClassLoader.loadClass(ClassLoader.java:357)... 12 more
2.原因
缺少pom依赖。
3.添加对应依赖
<dependency><groupId>org.apache.poi</groupId><artifactId>poi-ooxml</artifactId><version>3.14</version></dependency><dependency><groupId>org.apache.poi</groupId><artifactId>poi</artifactId><version>3.14</version></dependency>
这篇关于Maven缺少依赖:java.lang.ClassNotFoundException: org.apache.poi.openxml4j.exceptions.InvalidFormatExcepti的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!