Solved Plugin working on CraftBukkit and not Cauldron?

Discussion in 'Plugin Development' started by rockers3000, Jul 26, 2016.

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

    rockers3000

    I recently wanted to create a Tekkit server as we are paying a direct-debit for an external Minecraft server and I didn't want it to go to waste. So, I installed Tekkit and everything ran along nicely. However, I needed a few simple plugins just to stop the main-hub from getting griefed so I had to figure out a way to install plugins along side Tekkit.

    Tekkit 1.2.9g uses Minecraft-Forge version 1.6.4 so I needed to swap the .jar files as that version of Forge didn't support CraftBukkit plugins due to a "falling out". (And, AFAIK, it still doesn't support CraftBukkit plugins.) I installed Cauldron and I added two plugins: WorldEdit and WorldGuard. Of course, they installed without any hitches, but then I discovered that I needed a random-teleport plugin aswell.
    I couldn't find any plugins that suited my needs for 1.6.4 so I decided to make my own. It took around 4 days to code but I managed to finish it without any big problems. You just can't use it in the Nether yet. (Or any world with no sky, for that matter.) It's a little rushed, but it works, and that's okay for me. It runs fine on CraftBukkit 1.6.4_R2.


    However, I uploaded it to my server and ran it with Cauldron 1.6.4_965 and it failed to load it, which I thought was odd. It ran fine on my PC and although it is very IO heavy (for the type of plugin it is), I made sure that all code would be cross-platform and I'm 100% sure the issue doesn't lie there. The problem is when Cauldron tries to map the main class. It fires this out at the console:

    Code:
    2016-07-27 02:24:14 [SEVERE] Could not load 'plugins/BetterWilderness-1.6.4_Rev.1.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.ClassNotFoundException: Failed to remap class com.lyesoussaiden.bw.BetterWilderness
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:194)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:307)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:231)
    at org.bukkit.craftbukkit.v1_6_R3.CraftServer.loadPlugins(CraftServer.java:232)
    at cpw.mods.fml.common.event.FMLServerAboutToStartEvent.<init>(FMLServerAboutToStartEvent.java:29)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at cpw.mods.fml.common.LoaderState.getEvent(LoaderState.java:84)
    at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:111)
    at cpw.mods.fml.common.Loader.serverAboutToStart(Loader.java:805)
    at cpw.mods.fml.common.FMLCommonHandler.handleServerAboutToStart(FMLCommonHandler.java:324)
    at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:223)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:637)
    at net.minecraft.server.ThreadMinecraftServer.run(SourceFile:583)
    Caused by: java.lang.ClassNotFoundException: Failed to remap class com.lyesoussaiden.bw.BetterWilderness
    at org.bukkit.plugin.java.PluginClassLoader.remappedFindClass(PluginClassLoader.java:550)
    at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader.java:467)
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:237)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:183)
    ... 15 more
    Caused by: java.lang.IllegalArgumentException
    at org.objectweb.asm.ClassReader.<init>(Unknown Source)
    at org.objectweb.asm.ClassReader.<init>(Unknown Source)
    at org.objectweb.asm.ClassReader.<init>(Unknown Source)
    at net.md_5.specialsource.RemapperProcessor.process(RemapperProcessor.java:83)
    at org.bukkit.plugin.java.PluginClassLoader.remappedFindClass(PluginClassLoader.java:506)
    ... 22 more
    The server is running Java8 and my plugin was exported using Java8. I've exported it using the standard Eclipse "Export->Jar" and using Maven based off of the official Bukkit beginners' tutorial. I thought that Maven seemed to be a bit extreme for a Bukkit Plugin, as I think Maven was created so that large projects could be managed easier. Either way, both builds spat the same thing out. I found it strange that it ran on my PC and not on the linux-based server. WorldEdit and WorldGuard for CraftBukkit 1.6.4 ran on the build of Cauldron on my server just fine, so I'm suspecting that it's got something to do with the way that 'plugin.yml's are handled or maybe it's because I'm building for Revision-2 of CraftBukkit 1.6.4?
    Keep in mind that I don't have direct access to the server. (I.e. no remote command-line, etc.) The only ways I can communicate to this server is through a rather buggy website and my FTP client. Anyways, here's some code from my plugin in-case it's needed.


    My (shortened) main java file.
    Code:
    package com.lyesoussaiden.bw;
    
    import...;
    
    public class BetterWilderness extends JavaPlugin implements Listener
    {
    
    ...
    
    }
    My (shortened) plugin.yml.
    -
    Code:
    name: BetterWilderness
    
    main: com.lyesoussaiden.bw.BetterWilderness
    version: 1.6.4_Rev.1
    I shortened the files as there would be 1000+ loc to scroll through. I believe that the "code" I posted is relevant enough. Feel free to state otherwise if you think that more's needed.
    Any help would be -greatly- appreciated!

    -Lyes Oussaiden
     
    Last edited: Jul 26, 2016
  2. Offline

    Tecno_Wizard

    @rockers3000, we don't directly support cauldron here, but I'll give you a hand anyway. Double check that the path to the main class (extends JavaPlugin). Then, if it does, does it work when you run a Bukkit server? I know that isn't what your doing, but it rules out a problem with the jar itself.
     
  3. Offline

    rockers3000

    @Tecno_Wizard Just installed CraftBukkit 1.6.4_R2 on to my server along with my plugin and it ran without any problems. It's like I'm running it on my computer. It has to be Cauldron. It must only support CraftBukkit 1.6.4 R1 instead of R2.

    I'll have to find the latest supported version of Bukkit for Cauldron. They didn't bother updating Cauldron for the later Bukkit builds of 1.6.4, but instead, there's literally tens (if not hundreds) of unofficial and official builds of Cauldron for 1.7+.

    I might switch over to MCPC+, as they released a server-jar which appears to support Revision 2. I'll have to test it out tomorrow.


    Update: Found out that MCPC is an early version of Cauldron, and it didn't work correctly. I'm really running out of options... I've exported the plugin on a 1.6.2 build of CB and I've also exported the plugin directly for the cauldron jar file and it still didn't work. I copied the contents of my server online to my "server" on my desktop. Still nothing. I have taken a look at the bukkit source and and the error occurs at this line, based off of the command-output from the logs:

    Code:
        Class<?> getClassByName(final String name) {
            Class<?> cachedClass = classes.get(name);
    
            if (cachedClass != null) {
                return cachedClass;
            } else {
                for (String current : loaders.keySet()) {
                    PluginClassLoader loader = loaders.get(current);
    
                    try {
                        cachedClass = loader.findClass(name, false); //ERROR CAUSED HERE
                    } catch (ClassNotFoundException cnfe) {}
                    if (cachedClass != null) {
                        return cachedClass; //EXCEPTION RETURNS HERE
                    }
                }
            }
            return null;
        }
    It makes perfect sense up until that point. What it's basically saying is that if the plugin hasn't been loaded onto the server before (Which it hasn't, because it has always failed.) then find and return the class from the loader. Except, the loader keeps error-ing to the ClassNotFoundException and the cachedClass is returning null. I don't understand why this is happening when WorldEdit and WorldGuard work just fine.


    Update 2: Figured out the problem! I simply had to change two settings within the cauldron.yml config file. For anyone reading, this is what has to be changed:
    Code:
    plugin-settings:
      default:
        remap-plugin-file: false
        custom-class-loader: false
     
    Last edited: Jul 27, 2016
Thread Status:
Not open for further replies.

Share This Page