Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Since build 447 unable to use nashorn-core #1462

Open
kangarko opened this issue Nov 21, 2024 · 1 comment
Open

Since build 447 unable to use nashorn-core #1462

kangarko opened this issue Nov 21, 2024 · 1 comment
Labels
type: bug Something isn't working

Comments

@kangarko
Copy link

kangarko commented Nov 21, 2024

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: f2d6e14

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 openjdk/nashorn@5e78947

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

apache/logging-log4j2#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 kangarko added the type: bug Something isn't working label Nov 21, 2024
@kangarko kangarko changed the title Nashorn method handle debug logging breaks with log4j-jul Since build 447 unable to use nashorn-core Nov 21, 2024
@kangarko
Copy link
Author

Update: This could be solved by bumping the log4j jul dep as mentioned at apache/logging-log4j2#3125 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant