Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-3699

In Fuse 6.2, Thread.currentThread().getContextClassLoader() returns a different classloader than in Fuse 6.1

    XMLWordPrintable

Details

    • % %
    • Hide

      1) Extract and Build attached example TestBundleActivator.zip
      2) Deploy it in JBoss Fuse 6.2.0
      3) In example, there is a small test-case testing the behaviour of classloader

      ClassLoader cl1 = Thread.currentThread().getContextClassLoader();
      ClassLoader cl2 = this.getClass().getClassLoader();
      logger.info("cl1: "+cl1+ " ; cl2: "+cl2);
      

      4) Following output is received

       2015-07-15 14:05:40,017 | INFO  | l Console Thread | ActivateTest
       | 280 - camel-bundleactivator-example - 1.0.0 | cl1:
       sun.misc.Launcher$AppClassLoader@92524b0 ; cl2:
       camel-bundleactivator-example [280]
      

      5) If we analyze it than we find that classloaders returned here are different. But in Fuse 6.1, classloaders returned are same in both cases.

      Show
      1) Extract and Build attached example TestBundleActivator.zip 2) Deploy it in JBoss Fuse 6.2.0 3) In example, there is a small test-case testing the behaviour of classloader ClassLoader cl1 = Thread .currentThread().getContextClassLoader(); ClassLoader cl2 = this .getClass().getClassLoader(); logger.info( "cl1: " +cl1+ " ; cl2: " +cl2); 4) Following output is received 2015-07-15 14:05:40,017 | INFO | l Console Thread | ActivateTest | 280 - camel-bundleactivator-example - 1.0.0 | cl1: sun.misc.Launcher$AppClassLoader@92524b0 ; cl2: camel-bundleactivator-example [280] 5) If we analyze it than we find that classloaders returned here are different. But in Fuse 6.1, classloaders returned are same in both cases.

    Description

      -There is some difference in classloaders used in 6.1 and 6.2. This is also reproducible locally(attached is the test-case).

      • A test bundle activator code-snippet
         @Override
         public void start(BundleContext arg0) throws Exception {
                 
             ClassLoader cl1 = Thread.currentThread().getContextClassLoader();
             ClassLoader cl2 = this.getClass().getClassLoader();
             logger.info("cl1: "+cl1+ " ; cl2: "+cl2);
                 
         }
        
      • Behaviour of this snippet in Fuse 6.1 and 6.2 is different.
      • In Fuse 6.1, It prints
         14:04:42,119 | INFO  | l Console Thread | ActivateTest                     |
         256 - camel-bundleactivator-example - 1.0.0 | cl1:
         camel-bundleactivator-example [256] ; cl2: camel-bundleactivator-example [256]
        
      • Observation: cl1 and cl2 both are same.
      • In Fuse 6.2, It prints
         2015-07-15 14:05:40,017 | INFO  | l Console Thread | ActivateTest
         | 280 - camel-bundleactivator-example - 1.0.0 | cl1:
         sun.misc.Launcher$AppClassLoader@92524b0 ; cl2:
         camel-bundleactivator-example [280]
         
      • Observation: cl1 and cl2 are different. cl1 returns
        "sun.misc.Launcher$AppClassLoader@92524b0".

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rhn-support-cpandey Chandra Shekhar Pandey (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: