简体   繁体   English

Maven的noClassDefFound错误

[英]noClassDefFound error with maven

I'm trying to create a spigot/bukkit plugin that monitors information about player connections, I've been trying to add MaxMind's GeoIP2 java api and the last time I asked how to add it's dependencies . 我正在尝试创建一个spigot / bukkit插件来监视有关玩家连接的信息,我一直在尝试添加MaxMind的GeoIP2 java api ,并且上次我问如何添加它的依赖项 I've installed M2e and added the dependency for geoip2 but when I run my bukkit test server I get this error: 我已经安装了M2e并添加了geoip2的依赖关系,但是当我运行bukkit测试服务器时,出现此错误:

[20:35:14] [Server thread/ERROR]: Error occurred while enabling ConnectionInfo v0.0.1.15 (Is it up to date?) java.lang.NoClassDefFoundError: com/maxmind/geoip2/exception/GeoIp2Exception at net.comdude2.plugins.connectioninfo.main.ConnectionInfo.onEnable(ConnectionInfo.java:107) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[spigot_server.jar:git-Spigot-c3c767f-33d5de3] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:335) [spigot_server.jar:git-Spigot-c3c767f-33d5de3] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot_server.jar:git-Spigot-c3c767f-33d5de3] at org.bukkit.craftbukkit.v1_8_R1.CraftServer.loadPlugin(CraftServer.java:356) [spigot_server.jar:git-Spigot-c3c767f-33d5de3] at org.bukkit.craftbukkit.v1_8_R1.CraftServer.enablePlugins(CraftServer.java:316) [spigot_server.jar:git-Spigot-c3c767f-33d5de3] at net.minecraft.server.v1_8_R1.MinecraftServer.q(MinecraftServer.java:402) [spig [20:35:14] [服务器线程/错误]:启用ConnectionInfo v0.0.1.15时发生错误(是否最新?)java.lang.NoClassDefFoundError:com / maxmind / geoip2 / exception / GeoIp2Exception出现在网络上。 comdude2.plugins.connectioninfo.main.ConnectionInfo.onEnable(ConnectionInfo.java:107)〜[?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321)〜[spigot_server.jar:git org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:335)的-Spigot-c3c767f-33d5de3](org.bukkit.plugin.SimplePlugin处的[spigot_server.jar:git-Spigot-c3c767f-33d5de3] SimplePluginManager.java:405)[org.bukkit.craftbukkit.v1_8_R1.CraftServer.loadPlugin(CraftServer.java:356)上的[spigot_server.jar:git-Spigot-c3c767f-33d5de3] [spigot_server.jar:git-Spigot-d3d33767 ],网址为org.bukkit.craftbukkit.v1_8_R1.CraftServer.enablePlugins(CraftServer.java:316)[spigot_server.jar:git-Spigot-c3c767f-33d5de3],网址为net.minecraft.server.v1_8_R1.MinecraftServer.java: 402)[spig ot_server.jar:git-Spigot-c3c767f-33d5de3] at net.minecraft.server.v1_8_R1.MinecraftServer.k(MinecraftServer.java:370) [spigot_server.jar:git-Spigot-c3c767f-33d5de3] at net.minecraft.server.v1_8_R1.MinecraftServer.a(MinecraftServer.java:325) [spigot_server.jar:git-Spigot-c3c767f-33d5de3] at net.minecraft.server.v1_8_R1.DedicatedServer.init(DedicatedServer.java:211) [spigot_server.jar:git-Spigot-c3c767f-33d5de3] at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:505) [spigot_server.jar:git-Spigot-c3c767f-33d5de3] at java.lang.Thread.run(Unknown Source) [?:1.8.0_65] Caused by: java.lang.ClassNotFoundException: com.maxmind.geoip2.exception.GeoIp2Exception at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_65] at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[spigot_server.jar:git-Spigot-c3c767f-33d5de3] at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[spigot_server.jar:git-Spigot-c3c767f-3 ot_server.jar:git-Spigot-c3c767f-33d5de3]位于net.minecraft.server.v1_8_R1.MinecraftServer.k(MinecraftServer.java:370)[spigot_server.jar:git-Spigot-c3c767f-33d5de3]位于net.minecraft.server .v1_8_R1.MinecraftServer.a(MinecraftServer.java:325)[spigot_server.jar:git-Spigot-c3c767f-33d5de3]位于net.minecraft.server.v1_8_R1.DedicatedServer.init(DedicatedServer.java:211)[spigot_server.jar: net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:505)上的git-Spigot-c3c767f-33d5de3](java.lang.Thread.run(未知)上的[spigot_server.jar:git-Spigot-c3c767f-33d5de3]源)[?:1.8.0_65]原因:java.lang.ClassNotFoundException:java.net.URLClassLoader.findClass处的com.maxmind.geoip2.exception.GeoIp2Exception(未知源)〜机构处的[[?:1.8.0_65]]。 bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101)〜[spigot_server.jar:git-Spigot-c3c767f-33d5de3] at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86)〜 [spigot_server.jar:git-Spigot-c3c767f-3 3d5de3] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_65] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_65] ... 12 more [20:35:14] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it java.lang.ClassLoader.loadClass(未知源)处的[3d5de3]〜[?:1.8.0_65] java.lang.ClassLoader.loadClass(未知源)处的[[?:1.8.0_65]〜[?:1.8.0_65] ...还有12个[20: 35:14] [服务器线程/信息]:服务器权限文件Permissions.yml为空,忽略它

My code and pom.xml can be found here . 我的代码和pom.xml可以在这里找到

I just need to know how to add the dependency if I'm doing it wrong, I'm not new to java but I am new to Maven and Dependencies so please be patient with me, any help is appreciated. 如果我做错了,我只需要知道如何添加依赖项,我不是java的新手,但是我是Maven和Dependencies的新手,所以请耐心等待,感谢您的帮助。

PS I'm not trying to locate IP "0.0.0.0", I have pushed it as that to protect my own IP address. PS我不是要查找IP“ 0.0.0.0”,我已将其推送为保护我自己的IP地址。

I managed to fix my own problem, It was because I needed to run my project as a Maven build. 我设法解决了自己的问题,这是因为我需要将项目作为Maven构建来运行。

If you're having the same problem this question helped me. 如果您遇到相同的问题,则此问题对我有所帮助。

I used the package goal as that's what I needed. 我使用了打包目标,因为这就是我所需要的。

I also needed to change my pom to enable it to export dependencies into the built jar. 我还需要更改pom以使其能够将依赖项导出到内置jar中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM