2017-05-24 77 views
1

我有一個設置,我使用Akka 2.5和Slf4j(用loj4j2)。但在啓動時它拋出Akka 2.5和Slf4j用nashorn拋出NPE

[java] Exception in thread "main" java.lang.ExceptionInInitializerError 
[java]  at jdk.nashorn.internal.lookup.MethodHandleFactory$StandardMethodHandleFunctionality.<init>(MethodHandleFactory.java:325) 
[java]  at jdk.nashorn.internal.lookup.MethodHandleFactory.<clinit>(MethodHandleFactory.java:103) 
[java]  at jdk.nashorn.internal.runtime.Context.initLoggers(Context.java:1404) 
[java]  at jdk.nashorn.internal.runtime.Context.<init>(Context.java:549) 
[java]  at jdk.nashorn.internal.runtime.Context.<init>(Context.java:466) 
[java]  at jdk.nashorn.api.scripting.NashornScriptEngine$1.run(NashornScriptEngine.java:129) 
[java]  at jdk.nashorn.api.scripting.NashornScriptEngine$1.run(NashornScriptEngine.java:125) 
[java]  at java.security.AccessController.doPrivileged(Native Method) 
[java]  at jdk.nashorn.api.scripting.NashornScriptEngine.<init>(NashornScriptEngine.java:125) 
[java]  at jdk.nashorn.api.scripting.NashornScriptEngineFactory.getScriptEngine(NashornScriptEngineFactory.java:148) 
[java]  at org.apache.logging.log4j.core.script.ScriptManager.<init>(ScriptManager.java:96) 
[java]  at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:214) 
[java]  at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244) 
[java]  at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545) 
[java]  at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617) 
[java]  at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634) 
[java]  at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229) 
[java]  at org.apache.logging.log4j.core.async.AsyncLoggerContext.start(AsyncLoggerContext.java:76) 
[java]  at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152) 
[java]  at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45) 
[java]  at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194) 
[java]  at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:122) 
[java]  at org.apache.logging.log4j.jul.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:34) 
[java]  at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46) 
[java]  at org.apache.logging.log4j.jul.LogManager.getLogger(LogManager.java:89) 
[java]  at java.util.logging.LogManager.demandLogger(LogManager.java:551) 
[java]  at java.util.logging.Logger.demandLogger(Logger.java:455) 
[java]  at java.util.logging.Logger.getLogger(Logger.java:502) 
[java]  at com.lmax.disruptor.FatalExceptionHandler.<clinit>(FatalExceptionHandler.java:27) 
[java]  at com.lmax.disruptor.dsl.ExceptionHandlerWrapper.<init>(ExceptionHandlerWrapper.java:8) 
[java]  at com.lmax.disruptor.dsl.Disruptor.<init>(Disruptor.java:66) 
[java]  at com.lmax.disruptor.dsl.Disruptor.<init>(Disruptor.java:105) 
[java]  at org.apache.logging.log4j.core.async.AsyncLoggerDisruptor.start(AsyncLoggerDisruptor.java:92) 
[java]  at org.apache.logging.log4j.core.async.AsyncLoggerContext.start(AsyncLoggerContext.java:75) 
[java]  at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152) 
[java]  at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45) 
[java]  at org.apache.logging.log4j.LogManager.getContext(LogManager.java:307) 
[java]  at org.apache.log4j.LogManager$PrivateManager.getContext(LogManager.java:215) 
[java]  at org.apache.log4j.LogManager.getLogger(LogManager.java:74) 
[java]  at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:66) 
[java]  at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270) 
[java]  at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281) 
[java]  at com.aaa.aaa.AAAService.<clinit>(AAAService.java:45) 
[java] Caused by: java.lang.NullPointerException 
[java]  at jdk.nashorn.internal.runtime.Context.initLoggers(Context.java:1404) 
[java]  at jdk.nashorn.internal.runtime.Context.<init>(Context.java:549) 
[java]  at jdk.nashorn.internal.runtime.Context.<init>(Context.java:466) 
[java]  at jdk.nashorn.api.scripting.NashornScriptEngine$1.run(NashornScriptEngine.java:129) 
[java]  at jdk.nashorn.api.scripting.NashornScriptEngine$1.run(NashornScriptEngine.java:125) 
[java]  at java.security.AccessController.doPrivileged(Native Method) 
[java]  at jdk.nashorn.api.scripting.NashornScriptEngine.<init>(NashornScriptEngine.java:125) 
[java]  at jdk.nashorn.api.scripting.NashornScriptEngineFactory.getScriptEngine(NashornScriptEngineFactory.java:148) 
[java]  at org.apache.logging.log4j.core.script.ScriptManager.<init>(ScriptManager.java:96) 
[java]  at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:214) 
[java]  at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244) 
[java]  at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545) 
[java]  at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617) 
[java]  at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634) 
[java]  at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229) 
[java]  at org.apache.logging.log4j.core.async.AsyncLoggerContext.start(AsyncLoggerContext.java:76) 
[java]  at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152) 
[java]  at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45) 
[java]  at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194) 
[java]  at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:122) 
[java]  at org.apache.logging.log4j.jul.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:34) 
[java]  at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46) 
[java]  at org.apache.logging.log4j.jul.LogManager.getLogger(LogManager.java:89) 
[java]  at java.util.logging.LogManager.demandLogger(LogManager.java:551) 
[java]  at java.util.logging.Logger.demandLogger(Logger.java:455) 
[java]  at java.util.logging.Logger.getLogger(Logger.java:502) 
[java]  at jdk.nashorn.internal.runtime.logging.DebugLogger.instantiateLogger(DebugLogger.java:84) 
[java]  at jdk.nashorn.internal.runtime.logging.DebugLogger.<init>(DebugLogger.java:77) 
[java]  at jdk.nashorn.internal.runtime.logging.DebugLogger.<clinit>(DebugLogger.java:55) 
[java]  ... 43 more 
[java] 2017-05-24 11:07:18,278 main DEBUG Scala REPL Version: 2.0, Language: Scala, Threading: Not Thread Safe, Compile: true, Names: {scala} 

任何想法,如何解決這個問題?

+0

是否有任何特殊的類加載器參與?或者這是一個使用第三方庫的直接應用程序?並請提交bug或發送詳細信息給nashorn-dev openjdk別名。 –

回答

0

我正在使用Scala 2.12。然後我將它改回Scala 2.11。它解決了這個問題。

相關問題