2 Replies Latest reply on Jun 8, 2011 4:40 AM by Shamik Bandopadhyay

    Packages -- Cannot be resolved

    Shamik Bandopadhyay Newbie

      Hi,

       

         I'm new to OSGI , trying to deploy and test my first application. I've created to bundles and installed them through admin console. After installing, I could see the following exceptions.

       

      ERROR: com.test.taxonomy.message -- Cannot be resolved

      ERROR: com.test.taxonomy.model -- Cannot be resolved

      ERROR: com.db4o,version=7.12 -- Cannot be resolved

      ERROR: com.db4o.query,version=7.12 -- Cannot be resolved

      org.apache.commons.collections,version=3.2 from org.apache.servicemix.bundles.commons-collections (37)

      ERROR: org.apache.commons.lang,version=2.5 -- Cannot be resolved

      ERROR: org.apache.commons.lang.time,version=2.5 -- Cannot be resolved

      org.apache.log4j from org.ops4j.pax.logging.pax-logging-api (3)

      org.springframework.transaction.annotation,version=2.5 from org.springframework.transaction (74)

      ERROR: org.springmodules.db4o -- Cannot be resolved

       

      com.test.taxonomy.message and com.test.taxonomy.model are couple of non-osgi jar files created by me, which are being internally refered by this osgi bundle. The rest as you see are standard third-party libraries. I've used maven plugin to generate the jar files, all external libraries were resolved during compile time.

       

      Any pointer will be appreciated.

       

      - Thanks

        • 1. Re: Packages -- Cannot be resolved
          Freeman(Yue) Fang Master

          Hi,

           

          Some quick question,

          1. What do you mean by "being internally refered by this osgi bundle", you put non-osgi jar files as embed jar in your bundle? Generally this isn't a good practice in OSGi world, you should also turn non-osgi jars into OSGi friendly bundles first so that it could be used by all other bundles

          2. Are you using FUSE ESB as OSGi container? For all other third-party bundles which pre-installed into FUSE ESB, you need ensure the version also match the import of your customer bundle, for example, we have org.apache.commons.lang(version 2.4) pre-installed, so if your customer bundle need version 2.5, then it can't be resolved.

           

          Btw, compile time successfully doesn't mean it will work during deployment time, it depend on if all necessary bundles is available in the OSGi container. If you're new to OSGi world, you may need take a look at to get some concrete idea about how OSGi container works.

           

          http://fusesource.com/docs/esb/4.3.1/esb_deploy_osgi/index.html

           

          Freeman

          • 2. Re: Packages -- Cannot be resolved
            Shamik Bandopadhyay Newbie

            Freeman, thanks for your reply. As you've guessed right that I'm new to OSGI and struggling a bit to understand the concept. I used couple of third part jars as well a custom jar in my OSGI bundle. I did realize that perhaps the OSGI container requires jars in an OSGI friendly format. But, I'm having a hard time to figure how to achieve that, or what's the best practice in this regard. I tried using <Embed-Dependency> but not been successful so far. It seemed to have its own challenges.

             

            I did go through the fuse documentation you've mentioned, but it didn't have much insight on using non-OSGI jars. The part I'm not clear is how do one resolve the transitive dependencies while using a third party jar. It might have reference to other jars internally,which again are non complaint.