Maven缺少依赖:java.lang.ClassNotFoundException: org.apache.poi.openxml4j.exceptions.InvalidFormatExcepti

1.报错描述

运行IpHelper类的时候,报错:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/openxml4j/exceptions/InvalidFormatException
	at 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.(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.InvalidFormatException
	at 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.添加对应依赖

        
            org.apache.poi
            poi-ooxml
            3.14
        
		
		
            org.apache.poi
            poi
            3.14
        

 

你可能感兴趣的:(Maven,GitHub)