7 Replies Latest reply on Apr 18, 2013 4:30 PM by jamezp

    using log4j.xml in 7.1.3 (EAP 6.0.1GA)

    warneronstine

      I have tried multiple different ways to get my log4j working, but to no avail. When we were on 7.1.1 the below worked beautifully. We migrated to 7.1.3 (EAP 6.0.1GA) and it is no longer working and I've gone through several of the forum solutions as well as the migration guide but nothing seems to be working.

       

      Here's my current jboss-deployment-structure file:

       

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">

       

          <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

          <deployment>

              <exclusions>

                  <module name="org.apache.log4j"/>

              </exclusions>

          </deployment>

          <sub-deployment name="rf-service-ejb-0.1-SNAPSHOT.jar">

              <exclusions>

                  <module name="org.apache.log4j"/>

              </exclusions>

              <dependencies>

                  <module name="deployment.rf-service-ear.ear.Log4j"/>

              </dependencies>

          </sub-deployment>

          <module name="deployment.rf-service-ear.ear.Log4j">

              <resources>

                  <resource-root path="lib/log4j-1.2.17.jar">

                  </resource-root>

              </resources>

          </module>

      </jboss-deployment-structure>

      I've tried just the basic exclusion (and nothing else). I have also added this to the server startup (as recommended by the migration guide):

      -Dorg.jboss.as.logging.per-deployment=false

       

      My current error is below

       

      11:47:47,252 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 95) MSC000001: Failed to start service jboss.deployment.subunit."rf-service-ear.ear"."rf-service-ejb-0.1-SNAPSHOT.jar".component.RfServiceControl.START: org.jboss.msc.service.StartException in service jboss.deployment.subunit."rf-service-ear.ear"."rf-service-ejb-0.1-SNAPSHOT.jar".component.RfServiceControl.START: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance

       

      at org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:57) [jboss-as-ee-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]

      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_15]

      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.7.0_15]

      at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.7.0_15]

      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_15]

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_15]

      at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_15]

      at org.jboss.threads.JBossThread.run(JBossThread.java:122)

      Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance

      at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:163) [jboss-as-ee-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]

      at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:85) [jboss-as-ee-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]

      at org.jboss.as.ejb3.component.singleton.SingletonComponent.getComponentInstance(SingletonComponent.java:118)

      at org.jboss.as.ejb3.component.singleton.SingletonComponent.start(SingletonComponent.java:133)

      at org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:54) [jboss-as-ee-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]

      ... 7 more

      Caused by: javax.ejb.EJBException: JBAS014580: Unexpected Error

      at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:161)

      at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228)

      at org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:331)

      at org.jboss.as.ejb3.tx.SingletonLifecycleCMTTxInterceptor.processInvocation(SingletonLifecycleCMTTxInterceptor.java:57)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

      at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

      at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

      at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161) [jboss-as-ee-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]

      ... 11 more

      Caused by: java.lang.LinkageError: loader constraint violation: when resolving field "LOG" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the referring class, com/fourtwosix/razorfish/common/j2eeservices/ServiceControlBase, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for the field's resolved type, viceControlBase, have different Class objects for that type

      at com.fourtwosix.razorfish.j2eeservices.RfServiceControl.startup(RfServiceControl.java:32)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_15]

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_15]

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_15]

      at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_15]

      at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptorFactory$ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptorFactory.java:130) [jboss-as-ee-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

      at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

      at org.jboss.as.weld.injection.WeldInjectionInterceptor.processInvocation(WeldInjectionInterceptor.java:73)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

      at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:95) [jboss-as-ee-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

      at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

      at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

      at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:226)

      ... 20 more

      Anyone have any clue what I'm doing wrong? (Oh, and I've verified that my log4j.xml file is in my lib directory as is the log4j-1.2.17.jar file. I've also tried putting the log4j.xml file in the META-INF directory and it still fails. Here's my log4j.xml file (which was working).

       

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

      <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

          <appender class="org.apache.log4j.ConsoleAppender" name="stdout">

              <layout class="org.apache.log4j.PatternLayout">

                  <param value="%d %p [%c] - &lt;%m&gt;%n" name="ConversionPattern"/>

              </layout>

          </appender>

          <!-- Perf4J appenders -->

          <!--

             This AsyncCoalescingStatisticsAppender groups StopWatch log messages

             into GroupedTimingStatistics messages which it sends on the

             file appender defined below

          -->

          <appender name="CoalescingStatistics"

                    class="org.perf4j.log4j.AsyncCoalescingStatisticsAppender">

              <!--

                The TimeSlice option is used to determine the time window for which

                all received StopWatch logs are aggregated to create a single

                GroupedTimingStatistics log. Here we set it to 10 seconds, overriding

                the default of 30000 ms

              -->

              <param name="TimeSlice" value="10000"/>

              <appender-ref ref="fileAppender"/>

          </appender>

          <!-- This file appender is used to output aggregated performance statistics -->

          <appender name="fileAppender" class="org.apache.log4j.FileAppender">

              <param name="File" value="perfStats.log"/>

              <layout class="org.apache.log4j.PatternLayout">

                  <param name="ConversionPattern" value="%m%n"/>

              </layout>

          </appender>

       

       

          <!-- Loggers -->

          <!--

            The Perf4J logger. Note that org.perf4j.TimingLogger is the value of the

            org.perf4j.StopWatch.DEFAULT_LOGGER_NAME constant. Also, note that

            additivity is set to false, which is usually what is desired - this means

            that timing statements will only be sent to this logger and NOT to

            upstream loggers.

          -->

          <logger name="org.perf4j.TimingLogger" additivity="false">

              <level value="INFO"/>

              <appender-ref ref="CoalescingStatistics"/>

          </logger>

       

       

          <logger name="com.lordofthejars.nosqlunit.mongodb">

              <level value="debug"/>

          </logger>

          <root>

              <level value="INFO"/>

              <appender-ref ref="stdout"/>

          </root>

      </log4j:configuration>

       

       

      Thanks in advance, been beating my head against this particular rock for the past 2 days.