Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unknown Source in Stacktrace Java Eclipse

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.

like image 507
Nerade Avatar asked Apr 14 '13 19:04

Nerade


People also ask

How do I get full StackTrace in eclipse?

To simplify the accepted answer let us consider a simple notation. Hence you have the entire stack. But MAKE SURE CHECK BOX FOR “limit console output” is NOT checked under run/debug drop down --> console in eclipse preferences. You can use the following code to get more clarity.

What is StackTrace exception?

A trace of the method calls is called a stack trace. The stack trace listing provides a way to follow the call stack to the line number in the method where the exception occurs. The StackTrace property returns the frames of the call stack that originate at the location where the exception was thrown.

How do I print StackTrace of exception?

Using printStackTrace() method − It print the name of the exception, description and complete stack trace including the line where exception occurred. Using toString() method − It prints the name and description of the exception. Using getMessage() method − Mostly used. It prints the description of the exception.


1 Answers

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.

like image 176
Nathan Meyer Avatar answered Sep 30 '22 14:09

Nathan Meyer