Solved NoSuchMethodError

Discussion in 'Spigot Plugin Development' started by AKZOMBIE74, May 25, 2017.

  1. Hello, this is my error:

    Code (Text):
    Caused by: java.lang.NoSuchMethodError: me.AKZOMBIE74.Data.getDefaultMap()Lorg/bukkit/map/MapRenderer;
            at me.AKZOMBIE74.myRender.applyToMap(myRender.java:68) ~[?:?]
            at me.AKZOMBIE74.preProcess.aVoid(preProcess.java:23) ~[?:?]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[spigot.jar:git-Spigot-96235ab-2aa5ac6]

    The server is running on on 1.11.2. I am not getting an error when I compile my code nor in my IDE, only when the event is triggered.

    Anybody know why?

    My JDK and JRE are Java 8 Update 131.
     
  2. ScarabCoder

    ScarabCoder Retired Resource Staff
    Retired

    Are you sure the server Spigot version is the same as the one you're using in your build path?
     
  3. How can I check?
     
  4. /ver on server.
     
  5. This is what I got.
    upload_2017-5-25_16-49-25.png
     
  6. Check if your build path is 1.11.2-R0.1 Snapshot
     
  7. Yes it is.
     
  8. cant help you
     
  9. ScarabCoder

    ScarabCoder Retired Resource Staff
    Retired

    Your best bet is to build a Spigot jar from BuildTools. Every now and then, I get weird errors from jars I downloaded from getspigot/getbukkit.
     
  10. electronicboy

    IRC Staff

    Specifically depends on what build system you're using, or what exactly your setup is, but you likely need to clean the build folder (How you do this is specifically dependent on your setup)... If you have other plugins with the same class in them, e.g. you're using an API, that can also cause those kind of issues.
     
  11. That Spigot Jar is built from BuildTools.
    The only thing that's similar in my plugins that I'm using on my testing server is the packages, but the main classes are all different.
     
  12. electronicboy

    IRC Staff

    if any classes share the same name + package in the JVM, they'll conflict with one another; me.AKZOMBIE74.Data is a class that I bet that you have in another plugin of yours on the server, and that class is overriding the class that you're expecting to be there for your plugin.
    You should use packages properly, 1. lowercase 2. it should include your artifact ID;
    ex, pw.valaria.valariacore; <domain>.<artifact>
     
    • Winner Winner x 1