4 Replies Latest reply on Dec 8, 2010 8:42 AM by Lin Ye

    Embedding Infinispan jars into our bundle

    Lin Ye Novice

      We are using Infinispan in OSGi container. As currently the jars from JBoss in general are not very OSGi friendly, we got a lot of class loading issues come and go. Now we decided to embed the Infinispan related jars in our bundle. It works mostly except two xml files in JGroups.jar - jg-magic-map.xml & jg-protocol-ids.xml. They are referenced by the code, and at the top level of the jar file. To include them in our bundle, the "*" has to be used to include everything, that's not desired. Otherwise, we have to extract those two files and put them into the resources of our project, that would cause undesirable upgrade hassle. I am wondering if the JGroups team has a plan to move those two files to a subdirectory in the jar file, that would make our life easier.


      Also, is embedding the jars into our bundle a violation of the LGPL license? Please suggest.

        • 1. Re: Embedding Infinispan jars into our bundle
          Manik Surtani Master

          The former is a question for the JGroups team.  They're usually on IRC (Freenode) on #jgroups or on their mailing list - https://sourceforge.net/mail/?group_id=6081


          As for the LGPL, it isn't a violation to the best of my knowledge, but I am not a lawyer.


          As for getting Infinispan to play nicely in an OSGi container, could you tell me which specific jars cause problems?

          1 of 1 people found this helpful
          • 2. Re: Embedding Infinispan jars into our bundle
            Lin Ye Novice

            The ClassNotFoundException happens to different classes from time to time. Basically, org.infinispan.util.Util.loadClass(String classname) is being used in many places to load a class by name. In general, loading class by name easily leads to class loading issue in OSGi, as there is no prior knowledge on which class will be loaded and it won't be added to the Import-Package of the bundle's manifest file when the jar is wrapped into a bundle.


            We actually used "DynamicImport-Package=*" for a few bundles (although it's not a good practice in OSGi), including infinispan-core, river, and marshalling-api, but still see the class loading issue come & go. So we finally decided to try embedding the jars.

            • 3. Re: Embedding Infinispan jars into our bundle
              Markus Gritsch Newbie

              Hi Lin, i read your above entries about integrating infinispan with osgi. With a bit osgi experience i would be interested in your solution. I guess you are wrapping the infinispan related jar files up in osgi bundles by adding the missing metadata. I have already done this before with a different multimodule app and i can tell it`s a hell regarding to Classloading issues only. Are your bundles available so i can take a look over, to get speed up with integrating infinispan to my current project millipede.


              regards gurkerl

              • 4. Re: Embedding Infinispan jars into our bundle
                Lin Ye Novice

                We're using maven, so I am using Maven Bundle Plugin (built on top of bnd tool). For Maven Bundle Plugin version 1.2.0 onwards, "embedding dependencies" feature is available (you can get more information at http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html?cf03380E65=16878693!MjA0MDI3NjQ3OmNvcnByYWRpdXNzc286ciiwRAnlTrIQRuNA/XqnBA==). Basically, I have the following snippet in my POM file (currently I excluded a few packages from Import-Package as we don't use them). The generated manifest file is as attached.