4

This exception is being thrown; how to fix it?

java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.net.URLClassLoader.addURL(java.net.URL) accessible: module java.base does not "opens java.net" to unnamed module @338aec90
        at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) ~[?:?]
        at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[?:?]
        at java.lang.reflect.Method.checkCanSetAccessible(Method.java:199) ~[?:?]
        at java.lang.reflect.Method.setAccessible(Method.java:193) ~[?:?]
        at net.byteflux.libby.classloader.URLClassLoaderHelper.<init>(URLClassLoaderHelper.java:37) ~[LifeSteal-1.0.jar:?]
        at net.byteflux.libby.BukkitLibraryManager.<init>(BukkitLibraryManager.java:28) ~[LifeSteal-1.0.jar:?]
        at in.arcadelabs.lifesteal.handler.DependencyHandler.<init>(DependencyHandler.java:18) ~[LifeSteal-1.0.jar:?]
        at in.arcadelabs.lifesteal.LifeStealPlugin.onLoad(LifeStealPlugin.java:39) ~[LifeSteal-1.0.jar:?]
        at org.bukkit.craftbukkit.v1_19_R1.CraftServer.loadPlugins(CraftServer.java:425) ~[purpur-1.19.jar:git-Purpur-1670]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:313) ~[purpur-1.19.jar:git-Purpur-1670]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1137) ~[purpur-1.19.jar:git-Purpur-1670]
        at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:307) ~[purpur-1.19.jar:git-Purpur-1670]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]

I am using a dependency manager library called libby (https://github.com/Byteflux/libby) so when I call LibraryManager libraryManager = new BukkitLibraryManager(); it thows exception

Slaw
  • 37,820
  • 8
  • 53
  • 80
Ixf1nity
  • 51
  • 1
  • 1
  • 4
  • 1
    Seems like "libby" hasn't been updated to work with newer versions of Java. But you could try running the code with `--add-opens=java.base/java.net=ALL-UNNAMED`. – Slaw Jul 03 '22 at 06:37
  • It looks like this fork may have addressed the issue ... https://github.com/AlessioDP/libby – Stephen C Jul 03 '22 at 09:59
  • [This Q&A](https://stackoverflow.com/questions/48041764) gives some background on what "libby" was apparently trying to do. This is the kind of thing that JEP 260 and JEP 396 are intended to stop. – Stephen C Jul 03 '22 at 15:39

1 Answers1

4

did you upgrade your JDK / JRE lately?

I had that same error message, when I downgrade to older Java version it was fixed.

Micha Kaufman
  • 777
  • 7
  • 11
  • 1
    you can check your Gradle version as well. I changed the updated version in gradle-wrapper.properties file and inside the project level, Gradle file and that worked for me. – Vivek Pratap Singh Oct 01 '22 at 03:11