Featherboard Java 17

Discussion in 'Spigot Plugin Help' started by DeprecatedLuke, Nov 25, 2021.

  1. Nashorn requires unsafe, unsafe version that allows you to do anything isn't present in java 17 (even in openjdk!) so yah, good luck.

    Code (Text):

    [22:50:02 ERROR]: Error occurred while enabling FeatherBoard v5.0.4 (Is it up to date?)
    java.lang.ExceptionInInitializerError: null
        at org.openjdk.nashorn.internal.runtime.Context.compile(Context.java:1509) ~[?:?]
        at org.openjdk.nashorn.internal.runtime.Context.compileScript(Context.java:1449) ~[?:?]
        at org.openjdk.nashorn.internal.runtime.Context.compileScript(Context.java:759) ~[?:?]
        at org.openjdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:528) ~[?:?]
        at org.openjdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:517) ~[?:?]
        at org.openjdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:395) ~[?:?]
        at org.openjdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:151) ~[?:?]
        at be.maximvdw.featherboard.ZD.k(ZD.java:119) ~[FeatherBoard.jar:?]
        at be.maximvdw.featherboard.ZD.<init>(ZD.java:101) ~[FeatherBoard.jar:?]
        at be.maximvdw.featherboard.GD.k(GD.java:32) ~[FeatherBoard.jar:?]
        at be.maximvdw.featherboard.GD.V(GD.java:81) ~[FeatherBoard.jar:?]
        at be.maximvdw.featherboard.FeatherBoard.t(FeatherBoard.java:63) ~[FeatherBoard.jar:?]
        at be.maximvdw.featherboard.Q3.x(Q3.java:13) ~[FeatherBoard.jar:?]
        at be.maximvdw.featherboard.Q3.onEnable(Q3.java:38) ~[FeatherBoard.jar:?]
        at be.maximvdw.featherboard.FeatherBoard.onEnable(FeatherBoard.java:70) ~[FeatherBoard.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[okspigot-1.17.1.jar:git-OkSpigot]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[okspigot-1.17.1.jar:git-OkSpigot]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[okspigot-1.17.1.jar:git-OkSpigot]
        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:583) ~[okspigot-1.17.1.jar:git-OkSpigot]
        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:497) ~[okspigot-1.17.1.jar:git-OkSpigot]
        at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:731) ~[okspigot-1.17.1.jar:git-OkSpigot]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:357) ~[okspigot-1.17.1.jar:git-OkSpigot]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1225) ~[okspigot-1.17.1.jar:git-OkSpigot]
        at net.minecraft.server.MinecraftServer.lambda$spin$3(MinecraftServer.java:316) ~[okspigot-1.17.1.jar:git-OkSpigot]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
    Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: no such method: sun.misc.Unsafe.defineAnonymousClass(Class,byte[],Object[])Class/invokeVirtual
        at org.openjdk.nashorn.internal.runtime.Context$AnonymousContextCodeInstaller.lambda$getDefineAnonymousClass$0(Context.java:335) ~[?:?]
        at java.security.AccessController.doPrivileged(AccessController.java:318) ~[?:?]
        at org.openjdk.nashorn.internal.runtime.Context$AnonymousContextCodeInstaller.getDefineAnonymousClass(Context.java:327) ~[?:?]
        at org.openjdk.nashorn.internal.runtime.Context$AnonymousContextCodeInstaller.<clinit>(Context.java:317) ~[?:?]
        ... 25 more
    Caused by: java.lang.NoSuchMethodException: no such method: sun.misc.Unsafe.defineAnonymousClass(Class,byte[],Object[])Class/invokeVirtual
        at java.lang.invoke.MemberName.makeAccessException(MemberName.java:976) ~[?:?]
        at java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:1117) ~[?:?]
        at java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:3649) ~[?:?]
        at java.lang.invoke.MethodHandles$Lookup.findVirtual(MethodHandles.java:2680) ~[?:?]
        at org.openjdk.nashorn.internal.runtime.Context$AnonymousContextCodeInstaller.lambda$getDefineAnonymousClass$0(Context.java:329) ~[?:?]
        at java.security.AccessController.doPrivileged(AccessController.java:318) ~[?:?]
        at org.openjdk.nashorn.internal.runtime.Context$AnonymousContextCodeInstaller.getDefineAnonymousClass(Context.java:327) ~[?:?]
        at org.openjdk.nashorn.internal.runtime.Context$AnonymousContextCodeInstaller.<clinit>(Context.java:317) ~[?:?]
        ... 25 more
    Caused by: java.lang.NoSuchMethodError: 'java.lang.Class sun.misc.Unsafe.defineAnonymousClass(java.lang.Class, byte[], java.lang.Object[])'
        at java.lang.invoke.MethodHandleNatives.resolve(Native Method) ~[?:?]
        at java.lang.invoke.MemberName$Factory.resolve(MemberName.java:1085) ~[?:?]
        at java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:1114) ~[?:?]
        at java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:3649) ~[?:?]
        at java.lang.invoke.MethodHandles$Lookup.findVirtual(MethodHandles.java:2680) ~[?:?]
        at org.openjdk.nashorn.internal.runtime.Context$AnonymousContextCodeInstaller.lambda$getDefineAnonymousClass$0(Context.java:329) ~[?:?]
        at java.security.AccessController.doPrivileged(AccessController.java:318) ~[?:?]
        at org.openjdk.nashorn.internal.runtime.Context$AnonymousContextCodeInstaller.getDefineAnonymousClass(Context.java:327) ~[?:?]
        at org.openjdk.nashorn.internal.runtime.Context$AnonymousContextCodeInstaller.<clinit>(Context.java:317) ~[?:?]
        ... 25 more
     
    Tested with:
    - https://adoptium.net/?variant=openjdk17&jvmVariant=hotspot
    - openjdk-17-jdk package on linux

    Stack overflow:
    - https://stackoverflow.com/questions...-openjdk-nashorn-have-any-support-for-java-17 (Looks like only a version bumb is required)
     
    #1 DeprecatedLuke, Nov 25, 2021
    Last edited: Nov 25, 2021