Reputation: 111
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
Upvotes: 10
Views: 26790
Reputation: 351
This is my case:
Reason: I updated my AS, it uses jdk17 by default which caused the problem
Solution: Change "gradle jdk location" in your AS, use your lower version jdk like jdk11 solved my problem
Upvotes: 0
Reputation: 11
Open gradle-wrapper.properties, and update the distributionUrl to the latest version.
For example, update
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-bin.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
Upvotes: 1
Reputation: 1035
did you upgrade your JDK / JRE lately?
I had that same error message, when I downgrade to older Java version it was fixed.
Upvotes: 6