geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1132889 - /geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/osgi/GeronimoBundleClassFinder.java
Date Tue, 07 Jun 2011 07:33:57 GMT
Author: xuhaihong
Date: Tue Jun  7 07:33:57 2011
New Revision: 1132889

URL: http://svn.apache.org/viewvc?rev=1132889&view=rev
Log:
Be more tolerant while searching availabe binding classes

Modified:
    geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/osgi/GeronimoBundleClassFinder.java

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/osgi/GeronimoBundleClassFinder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/osgi/GeronimoBundleClassFinder.java?rev=1132889&r1=1132888&r2=1132889&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/osgi/GeronimoBundleClassFinder.java
(original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/osgi/GeronimoBundleClassFinder.java
Tue Jun  7 07:33:57 2011
@@ -27,12 +27,16 @@ import org.apache.xbean.osgi.bundle.util
 import org.apache.xbean.osgi.bundle.util.DiscoveryRange;
 import org.osgi.framework.Bundle;
 import org.osgi.service.packageadmin.PackageAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @version $Rev$ $Date$
  */
 public class GeronimoBundleClassFinder implements ClassFinder {
 
+    private static final Logger logger = LoggerFactory.getLogger(GeronimoBundleClassFinder.class);
+
     private PackageAdmin packageAdmin;
 
     public GeronimoBundleClassFinder(PackageAdmin packageAdmin) {
@@ -40,9 +44,9 @@ public class GeronimoBundleClassFinder i
     }
 
     @Override
-    public ArrayList<Class> getClassesFromJarFile(final String packageName, ClassLoader
cl) throws ClassNotFoundException {        
+    public ArrayList<Class> getClassesFromJarFile(final String packageName, ClassLoader
cl) throws ClassNotFoundException {
         Bundle bundle = BundleUtils.getBundle(cl, true);
-        if(bundle == null) {
+        if (bundle == null) {
             return new ArrayList<Class>();
         }
         //TODO Do we need to limit the scanning scope in the target application ? As we share
one bundle for all the sub modules except for car
@@ -71,7 +75,19 @@ public class GeronimoBundleClassFinder i
         Set<String> classNames = bundleClassFinder.find();
         ArrayList<Class> clses = new ArrayList<Class>(classNames.size());
         for (String className : classNames) {
-            clses.add(bundle.loadClass(className));
+            try {
+                Class<?> cls = bundle.loadClass(className);
+                //Invoke getConstructors() to force the classloader to resolve the target
class 
+                cls.getConstructors();
+                clses.add(cls);
+            } catch (Throwable e) {
+                String message = "Fail to load class " + className + " in GeronimoBundleClassFinder,
it might not be considered while processing SOAP message due to " + e.getMessage();
+                if (logger.isDebugEnabled()) {
+                    logger.debug(message, e);
+                } else {
+                    logger.warn(message);
+                }
+            }
         }
         return clses;
     }



Mime
View raw message