mezzodrinker
mezzodrinker

Reputation: 988

NoSuchMethodError even though self-coded method exists

I've been searching for a solution for my problem but haven't got any sufficient answers.

I am working on a Bukkit plugin's update system. Thus, I had to code the classes myself. But all the time I'd like to call a method (to be specific: debug(String)) as a wrapped method from another class, I get the following NoSuchMethodError:

[RegionManager] Enabling RegionManager v1.0.0
[RegionManager] [DEBUG] loading configuration options...
[RegionManager] [DEBUG] done.
[RegionManager] [DEBUG] initializing attributes...
[RegionManager] [DEBUG] done.
[RegionManager] [DEBUG] registering commands and events...
[RegionManager] [DEBUG] done.
[RegionManager] [DEBUG] fetching WorldGuard...
[RegionManager] [DEBUG] done.
[RegionManager] [DEBUG] checking for updates...
[SEVERE] Exception in thread "update/version check" 
[SEVERE] java.lang.NoSuchMethodError: com.lirtistasya.bukkit.util.BukkitPlugin.debug(Ljava/lang/String;)V
[SEVERE]    at com.lirtistasya.bukkit.util.net.Updater.debug(Updater.java:278)
[SEVERE]    at com.lirtistasya.bukkit.util.net.Updater.access$0(Updater.java:277)
[SEVERE]    at com.lirtistasya.bukkit.util.net.Updater$UpdateRunnable.run(Updater.java:284)
[SEVERE]    at java.lang.Thread.run(Unknown Source)

It would be great if anyone could help me with this...

Upvotes: 0

Views: 4032

Answers (1)

Guido Simone
Guido Simone

Reputation: 7952

A NoSuchMethodError is usually an indication that the library you are compiling against is more recent than the library that you are running against. This compile library has the method, but the runtime library does not.

In this case, according to GitHub, that "debug" method was checked in within the last hour so it's really, really really new. If you are using any existing jars that were built some time ago, they will not have that method and you will be getting the NoSuchMethodError whenever you try to invoke the method.

You need to check your classpath, delete any old jar files and replace them with new jars that you generated yourself using this latest, greatest code.

Upvotes: 2

Related Questions