[jboss-cvs] JBossAS SVN: r95916 - in projects/jboss-osgi: trunk/distribution/installer/src/main/resources/jbossas and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Nov 2 08:49:24 EST 2009


Author: thomas.diesler at jboss.com
Date: 2009-11-02 08:49:24 -0500 (Mon, 02 Nov 2009)
New Revision: 95916

Modified:
   projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java
   projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml
Log:
Fix MC service init classloader 
Add javax.transaction to syscp

Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java	2009-11-02 13:25:53 UTC (rev 95915)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java	2009-11-02 13:49:24 UTC (rev 95916)
@@ -56,38 +56,24 @@
       if ("org.jboss.osgi.framework".equals(systemBundleName))
          return;
       
+      // Get the classloader that is used to initialize the MC service
+      ClassLoader classLoader = getClass().getClassLoader();
+      
       ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
       try
       {
-         Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+         Thread.currentThread().setContextClassLoader(classLoader);
          mcService = new MicrocontainerServiceImpl(context);
          mcService.start();
-         
-         // Track the MicrocontainerService
-         ServiceTracker tracker = new ServiceTracker(context, MicrocontainerService.class.getName(), null)
-         {
-            @Override
-            public Object addingService(ServiceReference reference)
-            {
-               MicrocontainerService mcService = (MicrocontainerService)super.addingService(reference);
-               
-               // Register the DeployerService that uses the MC deployers
-               Properties props = new Properties();
-               props.setProperty("provider", "microcontainer");
-               props.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
-               MainDeployer mainDeployer = (MainDeployer)mcService.getRegisteredBean("MainDeployer");
-               MicrocontainerDeployerServiceImpl deployerService = new MicrocontainerDeployerServiceImpl(context, mainDeployer);
-               context.registerService(DeployerService.class.getName(), deployerService, props);
-               
-               return mcService;
-            }
-         };
-         tracker.open();
       }
       finally
       {
          Thread.currentThread().setContextClassLoader(ctxLoader);
       }
+
+      // Track the MicrocontainerService and register the DeployerService
+      MicrocontainerServiceTracker tracker = new MicrocontainerServiceTracker(context, classLoader);
+      tracker.open();
    }
 
    public void stop(BundleContext context)
@@ -95,4 +81,41 @@
       if (mcService != null)
          mcService.stop();
    }
+   
+   /** 
+    * Register the DeployerService that uses the MC deployers
+    */
+   class MicrocontainerServiceTracker extends ServiceTracker
+   {
+      private ClassLoader classLoader;
+      
+      public MicrocontainerServiceTracker(BundleContext context, ClassLoader classLoader)
+      {
+         super(context, MicrocontainerService.class.getName(), null);
+         this.classLoader = classLoader;
+      }
+      
+      @Override
+      public Object addingService(ServiceReference reference)
+      {
+         MicrocontainerService mcService = (MicrocontainerService)super.addingService(reference);
+         ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+         try
+         {
+            Thread.currentThread().setContextClassLoader(classLoader);
+            
+            Properties props = new Properties();
+            props.setProperty("provider", "microcontainer");
+            props.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
+            MainDeployer mainDeployer = (MainDeployer)mcService.getRegisteredBean("MainDeployer");
+            MicrocontainerDeployerServiceImpl deployerService = new MicrocontainerDeployerServiceImpl(context, mainDeployer);
+            context.registerService(DeployerService.class.getName(), deployerService, props);
+         }
+         finally
+         {
+            Thread.currentThread().setContextClassLoader(ctxLoader);
+         }
+         return mcService;
+      }
+   }
 }
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml	2009-11-02 13:25:53 UTC (rev 95915)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml	2009-11-02 13:49:24 UTC (rev 95916)
@@ -26,6 +26,7 @@
           <key>org.osgi.framework.system.packages.extra</key>
           <value>
             <!-- system -->
+            javax.transaction;version=1.0,
             javax.xml.bind.annotation;version=2.1,
             org.apache.xerces.dom;version=2.9,
             org.jnp.interfaces;version=5.0,




More information about the jboss-cvs-commits mailing list