haksunlinm opened a new issue, #1506: URL: https://github.com/apache/logging-log4j2/issues/1506
## Description I googled this problem and it seems that this field causes a lot of issues in deployment. I wonder why and why this field is so special and causes the error. ## Configuration **Version:** 2.17.0 **Operating system:** in use with Kotlin and Jupyter **JDK:** open JDK 11 ## Logs ``` EMPTY_BYTE_ARRAY java.lang.NoSuchFieldError: EMPTY_BYTE_ARRAY at org.apache.logging.log4j.core.config.ConfigurationSource.(ConfigurationSource.java:56) at org.apache.logging.log4j.core.config.NullConfiguration.(NullConfiguration.java:32) at org.apache.logging.log4j.core.LoggerContext.(LoggerContext.java:85) at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.createContext(ClassLoaderContextSelector.java:254) at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:218) at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:136) at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:123) at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:117) at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:150) at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47) at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194) at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:581) at org.jzy3d.chart.factories.ChartFactory.(ChartFactory.java:37) at Line_23.chart(Line_23.jupyter-kts:14) at Line_23.(Line_23.jupyter-kts:45) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at kotlin.script.experimental.jvm.BasicJvmScriptEvaluator.evalWithConfigAndOtherScriptsResults(BasicJvmScriptEvaluator.kt:105) at kotlin.script.experimental.jvm.BasicJvmScriptEvaluator.invoke$suspendImpl(BasicJvmScriptEvaluator.kt:47) at kotlin.script.experimental.jvm.BasicJvmScriptEvaluator.invoke(BasicJvmScriptEvaluator.kt) at kotlin.script.experimental.jvm.BasicJvmReplEvaluator.eval(BasicJvmReplEvaluator.kt:49) at org.jetbrains.kotlinx.jupyter.repl.impl.InternalEvaluatorImpl$eval$resultWithDiagnostics$1.invokeSuspend(InternalEvaluatorImpl.kt:103) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284) at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85) at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59) at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source) at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38) at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source) at org.jetbrains.kotlinx.jupyter.repl.impl.InternalEvaluatorImpl.eval(InternalEvaluatorImpl.kt:103) at org.jetbrains.kotlinx.jupyter.repl.impl.CellExecutorImpl$execute$1$result$1.invoke(CellExecutorImpl.kt:71) at org.jetbrains.kotlinx.jupyter.repl.impl.CellExecutorImpl$execute$1$result$1.invoke(CellExecutorImpl.kt:69) at org.jetbrains.kotlinx.jupyter.ReplForJupyterImpl.withHost(repl.kt:635) at org.jetbrains.kotlinx.jupyter.repl.impl.CellExecutorImpl.execute(CellExecutorImpl.kt:69) at org.jetbrains.kotlinx.jupyter.repl.CellExecutor$DefaultImpls.execute$default(CellExecutor.kt:15) at org.jetbrains.kotlinx.jupyter.ReplForJupyterImpl$evalEx$1.invoke(repl.kt:444) at org.jetbrains.kotlinx.jupyter.ReplForJupyterImpl$evalEx$1.invoke(repl.kt:433) at org.jetbrains.kotlinx.jupyter.ReplForJupyterImpl.withEvalContext(repl.kt:397) at org.jetbrains.kotlinx.jupyter.ReplForJupyterImpl.evalEx(repl.kt:433) at org.jetbrains.kotlinx.jupyter.ReplForJupyterImpl.eval(repl.kt:485) at org.jetbrains.kotlinx.jupyter.messaging.ProtocolKt$shellMessagesHandler$2$res$1.invoke(protocol.kt:321) at org.jetbrains.kotlinx.jupyter.messaging.ProtocolKt$shellMessagesHandler$2$res$1.invoke(protocol.kt:320) at org.jetbrains.kotlinx.jupyter.JupyterExecutorImpl$runExecution$execThread$1.invoke(execution.kt:33) at org.jetbrains.kotlinx.jupyter.JupyterExecutorImpl$runExecution$execThread$1.invoke(execution.kt:31) at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)``` ## Reproduction Initially, I thought it might be a problem with the kotlin-jupyter kernel. So, I submitted an issue in their github/issue. https://github.com/Kotlin/kotlin-jupyter/issues/417 After more research, I found this problem appearing in other deployment as well. This field is just sometimes not accessible. The code to reproduce it is: @file:Repository("https://repo1.maven.org/maven2") @file:DependsOn("org.apache.logging.log4j:log4j-api:2.20.0") var c1 = org.apache.logging.log4j.util.Constants.JAVA_MAJOR_VERSION // always OK c1 var c2 = org.apache.logging.log4j.util.Constants.EMPTY_BYTE_ARRAY // often can't be found c2 All it does is to load the jar, and try to access the field: var c2 = org.apache.logging.log4j.util.Constants.EMPTY_BYTE_ARRAY And it is missing. You will need a jupyter-kotlin server to run this code. I prepare an instance here: http://35.223.178.227:8888/tree?token=5d6c7622a457c14fcad438dbe89ff57be4a564021d23e07e -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
