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

[GSS](7.3.z) WFCORE-5118 - Cannot get resources from ContextClassLoader with Server Lifecycle Events

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.3.4.CR1, 7.3.4.GA
    • 7.3.2.GA
    • Management
    • None
    • +
    • Hide

      Reproducer

      reproduce.zip
       ├── modules
       │   └── test
       │       └── listener
       │           └── main
       │               ├── module.xml
       │               └── TestService.jar
       └── standalone
          └── configuration
              └── standalone-test.xml
      
      TestService.jar
       ├── test
       │   └── listener
       │       ├── TestListener.class
       │       └── TestListener.java
       └── test.txt
      
      test/listener/TestListener.java
      public class TestListener implements ProcessStateListener {
      
          public void init(ProcessStateListenerInitParameters parameters) {
          	System.out.println("-------------------- TestListener init start");
          	System.out.println("Find test.txt in ClassLoader 1 : " + Thread.currentThread().getContextClassLoader().getResource("test.txt"));
          	System.out.println("Find test.txt in ClassLoader 2 : " + ClassLoader.getSystemClassLoader().getResource("test.txt"));
          	System.out.println("-------------------- TestListener init end");
          }
      

      Steps to reproduce
      1. Install JBoss EAP 7.3.x.
      2. Unzip reproduce.zip under the EAP_HOME
      3. Run the EAP 7.3 with standalone-test.xml.

      $ ./standalone.sh -c standalone-test.xml

      4. Cannot find the test.txt which is in the TestService.jar root.

      10:58:06,294 INFO  [stdout] (ServerService Thread Pool -- 48) -------------------- TestListener init start
      10:58:06,295 INFO  [stdout] (ServerService Thread Pool -- 48) Find test.txt in ClassLoader 1 : null
      10:58:06,295 INFO  [stdout] (ServerService Thread Pool -- 48) Find test.txt in ClassLoader 2 : null
      10:58:06,295 INFO  [stdout] (ServerService Thread Pool -- 48) -------------------- TestListener init end
      
      Show
      Reproducer reproduce.zip ├── modules │   └── test │   └── listener │   └── main │   ├── module.xml │   └── TestService.jar └── standalone └── configuration └── standalone-test.xml TestService.jar ├── test │   └── listener │   ├── TestListener.class │   └── TestListener.java └── test.txt test/listener/TestListener.java public class TestListener implements ProcessStateListener { public void init(ProcessStateListenerInitParameters parameters) { System .out.println( "-------------------- TestListener init start" ); System .out.println( "Find test.txt in ClassLoader 1 : " + Thread .currentThread().getContextClassLoader().getResource( "test.txt" )); System .out.println( "Find test.txt in ClassLoader 2 : " + ClassLoader .getSystemClassLoader().getResource( "test.txt" )); System .out.println( "-------------------- TestListener init end" ); } Steps to reproduce 1. Install JBoss EAP 7.3.x. 2. Unzip reproduce.zip under the EAP_HOME 3. Run the EAP 7.3 with standalone-test.xml. $ ./standalone.sh -c standalone-test.xml 4. Cannot find the test.txt which is in the TestService.jar root. 10:58:06,294 INFO [stdout] (ServerService Thread Pool -- 48) -------------------- TestListener init start 10:58:06,295 INFO [stdout] (ServerService Thread Pool -- 48) Find test.txt in ClassLoader 1 : null 10:58:06,295 INFO [stdout] (ServerService Thread Pool -- 48) Find test.txt in ClassLoader 2 : null 10:58:06,295 INFO [stdout] (ServerService Thread Pool -- 48) -------------------- TestListener init end

      Listener application cannot refer to their own resources from ContextClassLoader.

              rhn-support-rmartinc Ricardo Martin Camarero
              rhn-support-enagai Eiichi Nagai (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: