Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-832

logback conditional configuration fails when loaded within axis2

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.1.0
    • Component/s: None
    • Labels:
      None

      Description

      Hello, I have a logback configuration like this:

          <if condition='property("CONTEXT_NAME").equalsIgnoreCase("my.propject.name")'>
              <then>
                  <property name="logentries.token" value="my-token" />
                  <property name="appender" value="logentries" /> 
              </then>
          </if>
      

      This works fine when loaded via Tomcat or run through a test, but when run through an axis2 aar, I get this exception:

      00:31:58,704 |-ERROR in ch.qos.logback.core.joran.conditional.IfAction - Failed to parse condition [property("CONTEXT_NAME").equalsIgnoreCase("inovacel.server")] org.codehaus.janino.JaninoRuntimeException: Cannot load class "ch.qos.logback.core.spi.PropertyContainer" through the given ClassLoader
      at org.codehaus.janino.JaninoRuntimeException: Cannot load class "ch.qos.logback.core.spi.PropertyContainer" through the given ClassLoader
      at at org.codehaus.janino.ReflectionIClass.classToIClass(ReflectionIClass.java:310)
      at at org.codehaus.janino.ReflectionIClass.classesToIClasses(ReflectionIClass.java:320)
      at at org.codehaus.janino.ReflectionIClass.access$200(ReflectionIClass.java:38)
      at at org.codehaus.janino.ReflectionIClass$ReflectionIMethod.getParameterTypes(ReflectionIClass.java:226)
      at at org.codehaus.janino.IClass$IMethod.getDescriptor(IClass.java:807)
      at at org.codehaus.janino.IClass.getIMethods(IClass.java:180)
      at at org.codehaus.janino.IClass.getIMethods(IClass.java:195)
      at at org.codehaus.janino.IClass.getIMethods(IClass.java:170)
      at at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:372)
      at at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:357)
      at at org.codehaus.janino.UnitCompiler$3.visitPackageMemberClassDeclaration(UnitCompiler.java:312)
      at at org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:770)
      at at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:319)
      at at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:288)
      at at org.codehaus.janino.SimpleCompiler.compileToClassLoader(SimpleCompiler.java:393)
      at at org.codehaus.janino.ClassBodyEvaluator.compileToClass(ClassBodyEvaluator.java:311)
      at at org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:224)
      at at org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:194)
      at at org.codehaus.commons.compiler.Cookable.cook(Cookable.java:80)
      at at org.codehaus.commons.compiler.Cookable.cook(Cookable.java:72)
      at at ch.qos.logback.core.joran.conditional.PropertyEvalScriptBuilder.build(PropertyEvalScriptBuilder.java:50)
      at at ch.qos.logback.core.joran.conditional.IfAction.begin(IfAction.java:67)
      at at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:276)
      at at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:148)
      at at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:130)
      at at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:50)
      at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:157)
      at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:143)
      at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:106)
      at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:56)
      at at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
      at at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:148)
      at at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
      at at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
      at at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
      at at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:107)
      at at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:295)
      at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269)
      at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281)
      at at com.assuredlabor.inovacel.server.SpringInit.<clinit>(SpringInit.java)
      at at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      at at java.lang.Class.newInstance0(Class.java:355)
      at at java.lang.Class.newInstance(Class.java:308)
      at at org.apache.axis2.deployment.ServiceBuilder.loadServiceLifeCycleClass(ServiceBuilder.java:518)
      at at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:213)
      at at org.apache.axis2.deployment.ServiceGroupBuilder.populateServiceGroup(ServiceGroupBuilder.java:101)
      at at org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:109)
      at at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:143)
      at at org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java:82)
      at at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
      at at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:813)
      at at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
      at at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)
      at at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
      at at org.apache.axis2.deployment.DeploymentEngine.loadServices(DeploymentEngine.java:142)
      at at org.apache.axis2.deployment.WarBasedAxisConfigurator.loadServices(WarBasedAxisConfigurator.java:283)
      at at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:95)
      at at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:584)
      at at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:454)
      at at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
      at at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
      at at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
      at at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5033)
      at at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5317)
      at at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
      at at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
      at at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
      at at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
      at at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1655)
      at at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      at at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at at java.lang.Thread.run(Thread.java:662)

      I realize this is probably an esoteric problem, but I wanted to report it. Please let me know if you know of any work around. I tried moving all the logback, slf4j, and janino, etc jars into tomcat, and the error went away, but logging did not seem to work for my axis2 aar file. (Other webapps were logging fine in that situation.)

        Attachments

          Activity

            People

            • Assignee:
              tony19 Tony Trinh
              Reporter:
              josh@assuredlabor.com Joshua Chaitin-Pollak
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: