1 Reply Latest reply on Aug 27, 2012 9:08 AM by thomas.diesler

    Error loading classes from osgi bundles

    sbesada

      Hi,

       

      We are trying the new version jboss-as-7.2.0.Alpha1-SNAPSHOT and we have found an error when JBOSS try to load some clasess from osgi bundles. Truth to be told, our application works properly in an Equinox installation but in jboss-as when a osgi bundle need to load one imperted class from another osgi bundle, the jboss-as doesn´t find it. To solve this problem,  we have to change the class FallbackLoader.java. We have change the method findModuleDynamically where we have replaced  "if (importedPaths.contains(path)){ return null }" for

       

      if (importedPaths.contains(path)){

                Set<XBundle>  bundles = bundleManager.getBundles();

                for (Iterator iterator = bundles.iterator(); iterator.hasNext();) {

                  XBundle xBundle = (XBundle) iterator.next();

                  if (null != xBundle.getEntry(resName)){

                      XBundleRevision brev = xBundle.getBundleRevision();

                      ModuleIdentifier identifier = moduleManager.getModuleIdentifier(brev);

                      Module candidate = moduleManager.getModule(identifier);

                      return candidate;

                     

                  }

              }

       

      So, when a osgi bundle need a imported class, jboss look for in osgi bundles.

       

      Does this change have sense?