6 Replies Latest reply on Apr 29, 2009 1:01 PM by Jamie Goodyear

    Xaware bundle exception

    Ankit Vernekar Newbie

      Hello Folks,

                     I have a java class using xaware api and I wan to develop a pojo service of this similar to the payments api.But I am facing some problems doing so.To use the Xaware I need two jars Xa-server.jar and jdom.jar

       

      They have been referenced in the jdk lib.When i perform a maven install on this pojo service it shows a successful build and is successfully registered with servicemix.But when i do a osgi start it shows the following error

       

      ERROR BundleException: Unresolved constraint in bundle 186: package; (package=or

      g.xaware.api)

       

          Can anybody point where i might be going wrong.Thank You in advance.

       

      Regards

      Ankit Vernekar

        • 1. Re: Xaware bundle exception
          Jamie Goodyear Newbie

          Hi,

           

          How are you building this bundle? If your using the bundle plugin for maven (BND tool) then you probably need to update the import package list or bundle-classpath entry. There is some good documentation on this available on the Apache Felix BND page: http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html. The way you create a bundle with BND is to tell it the content of the bundle's JAR file as a subset of the available classes. The directives you supply BND with will construct the bundle's manifest headers, which contain entires such as imports, exports, classpath, and other variables. There is a also good introduction to BND available as well on this blog.

           

          Cheers,

          Jamie

           

          http://icodebythesea.blogspot.com/

          • 2. Re: Xaware bundle exception
            Ankit Vernekar Newbie

            Hi Jamie,

                         Yes I am using maven to build the osgi bundle in eclipse.Read the article you have referred to,Its good.But there are few warnings coming in the successful build. please have a look.

             

            Include-Resource: overriding META-INF/spring/bundle-context-osgi.xml=src/main/resources/META-INF/spring/bundle-context-osgi.xml,META-INF/spring/bundle-context.xml=src/main/resources/META-INF/spring/bundle-context.xml,log4j.properties=src/main/resources/log4j.properties,META-INF/MANIFEST.MF=META-INF/MANIFEST.MF,META-INF/readme.txt=META-INF/readme.txt with src/main/resources (add {maven-resources} if you want to include the maven resources)

            Warning building bundle com.progress.pso:payments-osgi-pojo-service:bundle:0.0.1-SNAPSHOT : Instructions in Export-Package that are never used: org\.sl4j, org\.xaware\.api\..*|org\.xaware\.api

            Warning building bundle com.progress.pso:payments-osgi-pojo-service:bundle:0.0.1-SNAPSHOT : Superfluous export-package instructions:

             

            Also my manifest file shows error in Import package.The errors are

             

            No available bundle exports package 'org.slf4j'

            Unsatisfied constraint: 'Import-Package: org.springframework.beans.factory; version="2.5.0"'

             

            Do suggest a solution if possible as I am new to this field.Thank You

             

            Regards,

            Ankit

            • 3. Re: Xaware bundle exception
              Jamie Goodyear Newbie

              It looks like we are going to have to work around a bit with your bundle directives. Could you post the instructions your passing the maven-bundle-plugin here?

               

              Thanks,

              Jamie

              • 4. Re: Xaware bundle exception
                Ankit Vernekar Newbie

                HI,

                     I have attached 3 files.Transformer.java uses the xaware api in the trnsform method.The bundle-context which register the Transformer bean and the Pom.xml which contains the detail about the plugins and dependencies.

                Thank you in advance.

                 

                Regards,

                Ankit

                • 5. Re: Xaware bundle exception
                  Jamie Goodyear Newbie

                  Thanks Ankit, I'll post back here what I find.

                   

                  Cheers,

                  Jamie

                  • 6. Re: Xaware bundle exception
                    Jamie Goodyear Newbie

                    Hi Ankit,

                     

                    I see that you have your Xa-server.jar referenced in your jdk lib, in the below sample I have for you would access the jar from some location where you build your application. I've labeled the two sections I'd edit and included some sample code for the entries.

                     

                    dependencies

                     

                    Here we add a dependency on the xa-server jar.

                     

                    $/lib/Xa-server.jar</systemPath> </dependency>

                    maven-bundle-plugin

                    We place the xa-server jar directly on the classpath for this bundle. The directives for imports and exports will have to still be adjusted for your application, however this should reduce the number of errors your observing. You'll probably also want to place some resources under the  Private-Package directive. Unfortunately I'm not that familiar with xaware, I hope that the below helps. <Bundle-ClassPath>.,Xa-server.jar</Bundle-ClassPath> <Embed-Dependency>*</Embed-Dependency> <Import-Package>*</Import-Package> <Export-Package>     !com.progress.pso.osgi.payments_api.internal,     com.progress.pso.osgi.payments_api*,     org.xaware.api.*,     org.sl4j </Export-Package> <Include-Resource>{maven-resources}, $/lib/Xa-server.jar</Include-Resource>

                     

                     

                    Cheers,

                    Jamie

                     

                    http://icodebythesea.blogspot.com/