OxalisCommunity/oxalis

[v.5.4.0] oxalis.inbound fails on startup: NOPLoggerFactory cannot be cast to LoggerContext

Closed this issue · 4 comments

Hello,

We recently attempted an upgrade to version 5.4.0 of oxalis.war, using oxalis.inbound.
The application fails on startup with the error "Error injecting method, java.lang.ClassCastException: org.slf4j.helpers.NOPLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext".

Version 5.3.0 works without issues however.

Full stacktrace:

23-Aug-2022 10:09:40.057 SEVERE [main] org.apache.catalina.core.StandardContext.listenerStart Error configuring application listener of class [network.oxalis.dist.war.WarServletContextListener]
java.lang.IllegalStateException: Unable to create injector, see the following errors:

  1. Error injecting method, java.lang.ClassCastException: org.slf4j.helpers.NOPLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext
    at network.oxalis.commons.logging.LoggingHandler.load(LoggingHandler.java:44)
    at network.oxalis.commons.logging.LoggingModule.configure(LoggingModule.java:41)

1 error
at network.oxalis.inbound.OxalisGuiceContextListener.(OxalisGuiceContextListener.java:48)
at network.oxalis.dist.war.WarServletContextListener.(WarServletContextListener.java:11)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:151)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4549)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5091)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:742)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:718)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:703)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1840)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:525)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:424)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1585)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:308)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:424)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:367)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:966)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1427)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1417)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:258)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:682)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
Caused by: com.google.inject.CreationException: Unable to create injector, see the following errors:

  1. Error injecting method, java.lang.ClassCastException: org.slf4j.helpers.NOPLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext
    at network.oxalis.commons.logging.LoggingHandler.load(LoggingHandler.java:44)
    at network.oxalis.commons.logging.LoggingModule.configure(LoggingModule.java:41)

1 error
at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:543)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:178)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
at com.google.inject.Guice.createInjector(Guice.java:87)
at com.google.inject.Guice.createInjector(Guice.java:69)
at network.oxalis.commons.guice.GuiceModuleLoader.initiate(GuiceModuleLoader.java:66)
at network.oxalis.inbound.OxalisGuiceContextListener.(OxalisGuiceContextListener.java:45)
... 47 more
Caused by: java.lang.ClassCastException: org.slf4j.helpers.NOPLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext
at network.oxalis.commons.logging.LogbackConfigurator.execute(LogbackConfigurator.java:68)
at network.oxalis.commons.logging.LoggingHandler.load(LoggingHandler.java:51)
at network.oxalis.commons.logging.LoggingHandler$$FastClassByGuice$$92a6c670.invoke()
at com.google.inject.internal.SingleMethodInjector$1.invoke(SingleMethodInjector.java:51)
at com.google.inject.internal.SingleMethodInjector.inject(SingleMethodInjector.java:85)
at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:147)
at com.google.inject.internal.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java:101)
at com.google.inject.internal.Initializer$InjectableReference.get(Initializer.java:245)
at com.google.inject.internal.Initializer.injectAll(Initializer.java:140)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:176)
... 52 more

23-Aug-2022 10:09:40.057 SEVERE [main] org.apache.catalina.core.StandardContext.listenerStart Skipped installing application listeners due to previous error(s)

@JesMat Sorry, I am unable to reproduce reported issue. i.e. In my case, oxalis war deployed successfully in Servlet container (i.e. Tomcat 9.x) and I am using Java 8. I can see logs being generated.
Can you please elaborate bit more about your integration, Java version and Servlet container version where you are deploying?

For SLF4j binding issue, please refer : https://www.slf4j.org/codes.html#StaticLoggerBinder . I hope that will help. Thanks

@aaron-kumar ,
Hello and thank you for the response Aaron,

It seems I forgot to mention that we also use your oxalis-as4 plugin.
Sorry about that.

I tried to deploy Oxalis without the AS4 plugin: this resulted in no such errors.
It seems to only occur when oxalis-as4 is used.

Oxalis v5.3.0 in combination with Oxalis-AS4 v5.3.0 works fine.

We are also using Java 8 and Tomcat v9.0.8.

Please let me know if I can provide you with any more helpful info!

Best regards
Jesper Mathiesen

Hi Jesper / @JesMat I hope you are using Oxalis-AS4 version v5.4.0 with Oxalis v5.4.0

If that is the case and you still getting issue then I want to understand your Oxalis-AS4 plugin integration to guide you further. Do you have other things in classpath which is creating problem?

Hi Jesper,

One additional Oxalis user (Member of QA team) confirm that he was Not able to reproduce Logger casting exception with Oxalis-AS4 version v5.4.0 with Oxalis v5.4.0, so it seems that it is your integration specific error.

Meanwhile I am converting this issue to discussion since it is Not a bug in release. We can continue discussion there.