Help with IllegalAccessException

Discussion in 'Plugin Development' started by masteroftime, Jul 24, 2011.

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

    masteroftime

    I am writing a plugin which allows loading of other plugins written in python. The plugins was originally designed to be a bukkit mod and as such it worked perfectly. But the bukkit team told me to make a plugin instead and now there are IllegalAccessExceptions everywhere.

    There were severeal Exceptions when I accessed protected methods which I resolved by making them public but now there is an Illegal Access when I try to access a public anonymous class.

    The exception:
    Code:
    10:21:31 [SCHWERWIEGEND] Error occurred while enabling TestPlugin v0.1 (Is it up
     to date?): tried to access class bukkit.python.PythonPluginLoader$18 from class
     bukkit.python.PythonPluginLoader
    java.lang.IllegalAccessError: tried to access class bukkit.python.PythonPluginLo
    ader$18 from class bukkit.python.PythonPluginLoader
            at bukkit.python.PythonPluginLoader.createExecutor(PythonPluginLoader.ja
    va:435)
            at org.bukkit.plugin.RegisteredListener.<init>(RegisteredListener.java:2
    6)
            at org.bukkit.plugin.SimplePluginManager.registerEvent(SimplePluginManag
    er.java:360)
            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.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java
    :186)
            at org.python.core.PyObject.__call__(PyObject.java:345)
            at org.python.core.PyMethod.__call__(PyMethod.java:170)
            at org.python.pycode._pyx2.onEnable$2(<iostream>:16)
            at org.python.pycode._pyx2.call_function(<iostream>)
            at org.python.core.PyTableCode.call(PyTableCode.java:165)
            at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
            at org.python.core.PyBaseCode.call(PyBaseCode.java:194)
            at org.python.core.PyFunction.__call__(PyFunction.java:387)
            at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:220)
            at org.python.core.PyMethod.__call__(PyMethod.java:211)
            at org.python.core.PyMethod.__call__(PyMethod.java:201)
            at org.python.core.PyMethod.__call__(PyMethod.java:196)
            at org.python.core.PyObject._jcallexc(PyObject.java:3502)
            at org.python.core.PyObject._jcall(PyObject.java:3534)
            at org.python.proxies.__main__$TestPlugin$0.onEnable(Unknown Source)
            at bukkit.python.PythonPlugin.setEnabled(PythonPlugin.java:125)
            at bukkit.python.PythonPluginLoader.enablePlugin(PythonPluginLoader.java
    :825)
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManage
    r.java:264)
            at bukkit.python.PythonLoader.onEnable(PythonLoader.java:24)
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:126)
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader
    .java:864)
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManage
    r.java:264)
            at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:152)
            at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:137
    )
            at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:284)
            at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:271)
            at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:148)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:335)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    The code where the error occurs.

    Code:
    case PLAYER_PICKUP_ITEM:
                return new EventExecutor() {
                    public void execute(Listener listener, Event event) {
                        ((PlayerListener) listener).onPlayerPickupItem((PlayerPickupItemEvent) event);
                    }
                };
    You can look at the compete code at https://github.com/masteroftime/Python-Plugin-Loader

    The strange thing is that it already worked and that it is an exact copy of the original bukkit code.
     
  2. Offline

    masteroftime

    No one has any idea?
     
  3. Offline

    masteroftime

  4. Not sure about this whole thing but my guess is you still use a plugin.yml so make sure your plugin loads dependancies first by adding.

    Code:
    depend: [APlugin, Anotherone, etc]
    Besides from this I can't offer more insight besides from maybe Java doesn't like being accessed by python.
     
Thread Status:
Not open for further replies.

Share This Page