4 Replies Latest reply on Jul 12, 2011 5:37 PM by Craig Ching

    Infinispan 5.0.0.CR7 and OSGi

    Craig Ching Newbie

      We've been using Infinispan 4.2.0.Final in our OSGi environment for awhile.  To get it running took a lot of luck and duct tape (i.e. lots of fragments!, we didn't want to use TCCL if we could avoid it).  So I'm very interested in 5.0.0.x's ability to set the classloaders for the cache and am working on upgrading.  So, questions:


      1.  We have been using declaritive configuration.  I'm assuming setting the classloader isn't going to able to be done declaritively.  Something I've never done with Infinispan is mix-and-match delcarative with programmatic.  Is that possible?  Or are we going to have to do our configuration programmatically now to set bundle class loaders?


      2.  My initial tests are getting this error:



      Caused by: java.lang.IllegalArgumentException: Indexing was not enabled on this cache. interface org.hibernate.search.spi.SearchFactoryIntegrator not found in registry

                at org.infinispan.query.SearchManagerImpl.extractType(SearchManagerImpl.java:61)

                at org.infinispan.query.SearchManagerImpl.<init>(SearchManagerImpl.java:53)

                at org.infinispan.query.Search.getSearchManager(Search.java:36)

                at xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



      even though I have this configured:


      <indexing enabled="true" indexLocalOnly="true">


              <property name="hibernate.search.default.directory_provider" value="filesystem" />






      before I dive into the code, does anyone have any guidance for me?  My configuration works just fine in normal JSE, so it must be something with an implementation of the specified interface not getting loaded.  If I could just figure out who is responsible for instantiating the indexing configuration I should be able to understand what's going on.


      Any help is appreciated!

        • 1. Re: Infinispan 5.0.0.CR7 and OSGi
          Craig Ching Newbie



             // Modules must be on the same classloader as Infinispan

             // TODO revise this assumption

             protected static List<ModuleLifecycle> moduleLifecycles = ModuleProperties.resolveModuleLifecycles(null);


          Appears to be my immediate problem (number 2 above), Infinispan isn't loading the query module.  I'm not sure how to resolve this, I'm not even sure yet if a bundle fragment will allow me to inject the classes into infinispan-core since it appears to use the System class loader.  Am I wrong about that?  Back to digging ...

          • 2. Re: Infinispan 5.0.0.CR7 and OSGi
            Craig Ching Newbie

            Also as an FYI, this code in ModuleProperties.loadModuleProperties():


                    Collection<URL> resources = new FileLookup().lookupFileLocations(MODULE_PROPERTIES_FILENAME, cl);

                    if (resources == null)

                        throw new IOException("Could not find " + MODULE_PROPERTIES_FILENAME

                                        + " files on classpath for module " + moduleName);


            The if (resources == null) condition will never be true because of:


                  Collection<URL> urls = new HashSet<URL>();


                  return urls;


            in FileLookup.getAsURLsFromClassLoader().  If it had, it might have been easier to figure out what was going wrong.

            • 3. Re: Infinispan 5.0.0.CR7 and OSGi
              Pete Muir Master

              Infinispan uses the system classloader and the Infinispan classloader to try to load modules. Looks like this assumption is wrong in OSGi, please file a JIRA issue for this, we can try to unravel it a bit more ;-)


              Please include the details you have dug up on this thread.

              • 4. Re: Infinispan 5.0.0.CR7 and OSGi
                Craig Ching Newbie

                Thanks for the response Pete.  I've opened:




                Let me know if I can be of any assistance, though I don't really know where to begin ;-)