PaperMC / Velocity

The modern, next-generation Minecraft server proxy.
https://papermc.io/software/velocity
GNU General Public License v3.0
1.79k stars 632 forks source link

Since build 447 unable to use nashorn-core #1462

Open kangarko opened 1 week ago

kangarko commented 1 week ago

Background:

There is a problem since Velocity build 447 preventing Rhino (javascript engine) to work. The problem started in build 447 after updating the dependencies: https://github.com/PaperMC/velocity/commit/f2d6e143ae872f7da83d69a97acca0412923c7f6

This affects all plugins using JavaScript variables which are now unable to use the nashorn-core library.

How to fix:

This has already been fixed at Java's team, see https://github.com/openjdk/nashorn/commit/5e789478bf74d39f48f7db22f8fdd878f8a77c6f

However ETA for nashorn-core release, so the relevant library has prepared a patch already:

https://github.com/apache/logging-log4j2/pull/3125

Please consider shipping logging-log4j2 2.25.0-SNAPSHOT into velocity to solve this problem.

Stack trace:

2024-11-21T11:13:03.785832500Z VelocityControl - Task Executor #0 ERROR Cannot set JUL log level through log4j-api: ignoring call to Logger.setLevel(OFF)
[12:13:03 INFO] [disabled]: methodType class java.lang.Object [class java.lang.Object] (Object)Object
[12:13:03 ERROR]: java.lang.reflect.InvocationTargetException
[12:13:03 ERROR]:   at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
[12:13:03 ERROR]:   at java.base/java.lang.reflect.Method.invoke(Method.java:580)
[12:13:03 ERROR]:   at org.mineacademy.fo.platform.FoundationPlatform.<init>(FoundationPlatform.java:53)
[12:13:03 ERROR]:   at org.mineacademy.fo.platform.VelocityPlatform.<init>(VelocityPlatform.java:42)
[12:13:03 ERROR]:   at org.mineacademy.fo.platform.VelocityPlatform.inject(VelocityPlatform.java:39)
[12:13:03 ERROR]:   at org.mineacademy.fo.platform.VelocityPlugin.onProxyInitialization(VelocityPlugin.java:221)
[12:13:03 ERROR]:   at org.mineacademy.fo.platform.Lmbda$1.execute(Unknown Source)
[12:13:03 ERROR]:   at com.velocitypowered.proxy.event.UntargetedEventHandler$VoidHandler.lambda$buildHandler$0(UntargetedEventHandler.java:56)
[12:13:03 ERROR]:   at com.velocitypowered.proxy.event.VelocityEventManager.fire(VelocityEventManager.java:676)
[12:13:03 ERROR]:   at com.velocitypowered.proxy.event.VelocityEventManager.lambda$fire$5(VelocityEventManager.java:541)
[12:13:03 ERROR]:   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[12:13:03 ERROR]:   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[12:13:03 ERROR]:   at java.base/java.lang.Thread.run(Thread.java:1583)
[12:13:03 ERROR]: Caused by: java.lang.ExceptionInInitializerError
[12:13:03 ERROR]:   at org.openjdk.nashorn.internal.codegen.CompilerConstants.staticCall(CompilerConstants.java:566)
[12:13:03 ERROR]:   at org.openjdk.nashorn.internal.runtime.JSType.<clinit>(JSType.java:85)
[12:13:03 ERROR]:   at org.openjdk.nashorn.internal.lookup.MethodHandleFactory$StandardMethodHandleFunctionality.describe(MethodHandleFactory.java:347)
[12:13:03 ERROR]:   at org.openjdk.nashorn.internal.lookup.MethodHandleFactory$StandardMethodHandleFunctionality.debug(MethodHandleFactory.java:376)
[12:13:03 ERROR]:   at org.openjdk.nashorn.internal.lookup.MethodHandleFactory$StandardMethodHandleFunctionality.findStatic(MethodHandleFactory.java:543)
[12:13:03 ERROR]:   at org.openjdk.nashorn.internal.lookup.MethodHandleFactory.<clinit>(MethodHandleFactory.java:114)
[12:13:03 ERROR]:   at org.openjdk.nashorn.internal.runtime.linker.Bootstrap.<clinit>(Bootstrap.java:68)
[12:13:03 ERROR]:   at org.openjdk.nashorn.internal.runtime.Context.<init>(Context.java:655)
[12:13:03 ERROR]:   at org.openjdk.nashorn.internal.runtime.Context.<init>(Context.java:585)
[12:13:03 ERROR]:   at org.openjdk.nashorn.api.scripting.NashornScriptEngine.lambda$new$0(NashornScriptEngine.java:126)
[12:13:03 ERROR]:   at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
[12:13:03 ERROR]:   at org.openjdk.nashorn.api.scripting.NashornScriptEngine.<init>(NashornScriptEngine.java:124)
[12:13:03 ERROR]:   at org.openjdk.nashorn.api.scripting.NashornScriptEngineFactory.getScriptEngine(NashornScriptEngineFactory.java:152)
[12:13:03 ERROR]:   at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
[12:13:03 ERROR]:   ... 12 more
[12:13:03 ERROR]: Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.invoke.MethodHandle.type()" because "target" is null
[12:13:03 ERROR]:   at java.base/java.lang.invoke.MethodHandles.insertArgumentsChecks(MethodHandles.java:5308)
[12:13:03 ERROR]:   at java.base/java.lang.invoke.MethodHandles.insertArguments(MethodHandles.java:5277)
[12:13:03 ERROR]:   at org.openjdk.nashorn.internal.lookup.MethodHandleFactory.addDebugPrintout(MethodHandleFactory.java:287)
[12:13:03 ERROR]:   at org.openjdk.nashorn.internal.lookup.MethodHandleFactory$StandardMethodHandleFunctionality.debug(MethodHandleFactory.java:376)
[12:13:03 ERROR]:   at org.openjdk.nashorn.internal.lookup.MethodHandleFactory$StandardMethodHandleFunctionality.findStatic(MethodHandleFactory.java:543)
[12:13:03 ERROR]:   at org.openjdk.nashorn.internal.lookup.Lookup.findOwnMH(Lookup.java:212)
[12:13:03 ERROR]:   at org.openjdk.nashorn.internal.lookup.Lookup.<clinit>(Lookup.java:54)
[12:13:03 ERROR]:   ... 26 more

Code:

a

(The "at org.mineacademy.fo.platform.FoundationPlatform.(FoundationPlatform.java:55) ~[?:?]" is highlighted)

Thanks. Matej

kangarko commented 1 week ago

Update: This could be solved by bumping the log4j jul dep as mentioned at https://github.com/apache/logging-log4j2/pull/3125#issuecomment-2491011731