java.lang.NoClassDefFoundError

Discussion in 'Plugin Development' started by Komak57, May 3, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Komak57

    I'm afraid the title I've chosen may actually hinder my progress >_>

    Alright, to start this off, I've been solo-coding my work on a collection of new plugins. Why? Because nobody I know has the stamina to follow through with a project >_>. This combination of Server-side plugins will increase the functionality, as well as repeat some of the things others do. myBlockProtect for example, is a rather new 'fluid' method of anti-griefing designed specially for this server. myScriptor is an innovative and new (go figure, a NEW plugin XD) that allows an admin to program different blocks with highly customize-able, and very unlimited scripts. Originally, I had written this manually. It worked, but was extremely limited. I decided to look into other run-time compilers. This is when I came across BeanShell, and my prayers were answered! Sadly, this is also where my errors are coming in.

    Now that you're caught up, let's get down to business! the error? java.lang.NoClassDefFoundError. My test environment compiles and operates flawlessly. Moving the project into my plugin environment, I'm getting errors onEnable():

    Code:
    19:10:31 [SEVERE] Could not load 'plugins\myScriptor.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: bsh/EvalError
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:150)
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305)
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230)
            at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:207)
            at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:183)
            at net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigurationManager.java:53)
            at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:156)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:422)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)
    Caused by: java.lang.NoClassDefFoundError: bsh/EvalError
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Unknown Source)
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:139)
            ... 8 more
    Caused by: java.lang.ClassNotFoundException: bsh.EvalError
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:41)
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:29)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            ... 11 more
    The line of code that is tripping this looks a lot like this:
    Code:
    } catch (EvalError e) {
    From what I'm reading, this has something to do with my CLASSPATH. Altering this in a BATCH file, I have YET to solve the issue, and could use some assistance!

    Note: This is only the first 2 plugins in a chain of plugins that will dramatically alter the way players enjoy Minecraft.

    Still looking for a way to resolve my java.lang.NoClassDefFoundError (and subsequently java.lang.ClassNotFoundException) error. The resolution in this lies somewhere in my include jar (bsh-2.0b4.jar) and how Craftbukkit is executed using Java...

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 25, 2016
  2. Offline

    nickrak

    The EvalError class is probably not in the jar.
     
  3. Offline

    Komak57

    The jar contains EvalError. This SAME code snippet works in an applet while testing, compiles fine in my plugin, but when loaded through Craftbukkit, it cannot obtain class information. I have tried several methods including alttering the jar location before and after export, unloaded and reloaded about 2 different ways, imported bsh.*; rather than just 'import bsh.EvalError;' added bsh to the "Organize Imports" list, moved the function containing the information to my main plugin function, rather than the blocklistener, I just don't know what else to try. Say you wanted to import ANY Jar externally other than craftbukkit. What steps would you have to go through to ensure functionality?
     
  4. Offline

    nickrak

    Can you post your jar?
     
  5. Offline

    Komak57

    The jar i'm trying to include? or the exported jar containing the error?
     
  6. Offline

    nickrak

    The plugin jar that contains your plugin.yml and the associated JavaPlugin extending class.
     
Thread Status:
Not open for further replies.

Share This Page