Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-11222

[GSS](7.0.z) JCL component is using the same object in different web classloaders.

XMLWordPrintable

    • Hide

      The attached files has the following content:

      • demo-jar project
      • demo-war project
      • demo2-war project
      • logging-profiles.xml file

      First, use the logging-profiles.xml file as a reference to add the profile logging to standalone.xml.

      Second, build the projects using maven tool.

      Third, deploy the two web projects in EAP7.0.x and open the browser url:
      Log from war1: http://localhost:8080/demo-war/servlet
      Log from war2: http://localhost:8080/demo2-war/servlet

      You should see the output described before.

      Show
      The attached files has the following content: demo-jar project demo-war project demo2-war project logging-profiles.xml file First, use the logging-profiles.xml file as a reference to add the profile logging to standalone.xml. Second, build the projects using maven tool. Third, deploy the two web projects in EAP7.0.x and open the browser url: Log from war1: http://localhost:8080/demo-war/servlet Log from war2: http://localhost:8080/demo2-war/servlet You should see the output described before.
    • EAP 7.0.7

      The issue is related to the org.apache.commons.logging.LogFactory that loads the same object reference even though in a different(war) web classloaders.

      This is the output of the sample project in attach. As you can see, the keyword "WAR1" appears more than it should, because the last 3 logs was invoked from the second web app (war2):

      ========================================================
      WAR1 16:55:52,206 WARN [at.co.svc.demo.DemoServlet] (default task-2) doGet called
      WAR1 16:55:52,208 WARN [at.co.svc.LoggerDemo] (default task-2) hello world from demo2
      WAR1 16:55:52,208 INFO [at.co.svc.LoggerDemo] (default task-2) ModuleClassLoader for Module "deployment.demo-war.war:main" from Service Module Loader
      WAR1 16:55:52,208 INFO [at.co.svc.LoggerDemo] (default task-2) LOG object id: org.apache.commons.logging.impl.SLF4JLocationAwareLog@797ae2a9

      WAR2 16:55:56,335 WARN [at.co.svc.demo2.DemoServlet] (default task-4) doGet called
      WAR1 16:55:56,336 WARN [at.co.svc.LoggerDemo] (default task-4) hello world from demo2
      WAR1 16:55:56,337 INFO [at.co.svc.LoggerDemo] (default task-4) ModuleClassLoader for Module "deployment.demo2-war.war:main" from Service Module Loader
      WAR1 16:55:56,338 INFO [at.co.svc.LoggerDemo] (default task-4) LOG object id: org.apache.commons.logging.impl.SLF4JLocationAwareLog@797ae2a9
      ========================================================

      The logging profile approach used here is documented in the official guide and all the dependencies are in jboss modules structure:

      https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Administration_and_Configuration_Guide/sect-Logging_Profiles.html

              rhn-support-iweiss Ingo Weiss
              rhn-support-mcarvalh Marcus Carvalho (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: