Unknown Source in Stacktrace Java Eclipse

▼魔方 西西 提交于 2019-12-10 13:58:04

问题


I have the very annoying problem, that when exporting a jar-file out of my source code in eclipse I will get no information in the stacktrace about the source and line number in which the error occurs. I have checked the compiler settings in ecplise for the project and all options in the section classfile generation are set. I'm developing plugins for Minecraft which are executed by the server software bukkit. My source is in the package de.celestialcraft.agentestate. On occurance of an exception I get such a stacktrace:

23:43:57 [INFO] com.sk89q.worldedit.CuboidClipboard@fb44f99
23:43:57 [SEVERE] Could not pass event BlockDamageEvent to AgentEstate v2.1alpha

org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
va:363)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
a:62)
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
ava:477)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
ava:462)
    at de.celestialcraft.AgentEstate.AgentEstateBlockListener.onBlockBreak(U
nknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
va:361)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
a:62)
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
ava:477)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
ava:462)
    at ir.b(ItemInWorldManager.java:393)
    at ir.a(ItemInWorldManager.java:200)
    at iv.a(NetServerHandler.java:782)
    at ei.a(Packet14BlockDig.java:67)
    at cg.b(TcpConnection.java:467)
    at iv.d(NetServerHandler.java:220)
    at iw.b(NetworkListenThread.java:57)
    at ht.b(DedicatedServerListenThread.java:34)
    at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:981)
    at ho.r(DedicatedServer.java:309)
    at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:857)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:744)
    at fy.run(ThreadMinecraftServer.java:16)
Caused by: java.lang.NullPointerException
    at com.sk89q.worldedit.schematic.MCEditSchematicFormat.save(Unknown Sour
ce)
    at de.celestialcraft.AgentEstate.Estate.saveState(Unknown Source)
    at de.celestialcraft.AgentEstate.Estate.create(Unknown Source)
    at de.celestialcraft.AgentEstate.Estate.create(Unknown Source)
    at de.celestialcraft.AgentEstate.AgentEstateBlockListener.onBlockDamage(
Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
va:361)
    ... 25 more

I have set the jdk path in the build path settings as the lib for the project. I hope you can help me with this issue. Thank you.


回答1:


Your project should be marked to enable project specific settings and on Java Compiler -> Classfile generation, the option Add line number... should be unmarked.




回答2:


Since Bukkit is an API, when you code a bukkit plugin you are creating blocks of code in such a way that only Bukkit knows what to do with said code. In order to find out what is causing the error you have posted here, you need to look at the top line if the "at" lines in the StackTrace and find it in the Bukkit source files on Github. For example, in this stacktrace you have this at the top:

org.bukkit.event.EventException
  at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:363)

You can see that there is a Bukkit EventException caused by an error in the JavaPluginLoader at line 363. In order to find out exactly what went on there, you should visit https://github.com/Bukkit/Bukkit/releases and download the appropriate source version for the MC version you are coding for. In this zip file you would find the source folder at src/main/java/ and follow the path in line 2 of this stacktrace (org/bukkit/plugin/java/JavaPluginLoader) and in line 363 of that file you will see where the error occurred.

Since I do not know what version of Bukkit you are coding for, I can't help you out past here except to say that whichever method in that file has line 363 as part of it is the one that relates to your problem. If you figure out what that method does, it is what Bukkit tried to do with your plugin code and failed.



来源:https://stackoverflow.com/questions/16003525/unknown-source-in-stacktrace-java-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!