4 Replies Latest reply on Jun 5, 2011 5:50 PM by David Langford

    Getting a 'unsatisfied dependencies' error when deploying my service

    David Langford Newbie

      Hey All

       

      I'm following the demo-videos on the http://fusesource.com/products/enterprise-servicemix/ page. In particular this video http://download.progress.com/open/progress/fuse_esb/deploying_web_service_into_fuse_esb4.mov .

       

      I'm good all the way up to the last step. When I deploy payments-web-service into the esb, it tries to start and says 'waiting' when I use 'osgi:list', then after a few minutes it fails to start. And I get the following error from osgi:list (I copied just the section I think is most important). *The question is what am I doing wrong and how can I fix it?*

       

      -


       

      18:07:33,510 | ERROR | Timer-0          | WaiterApplicationContextExecutor | ?                                   ? | 72 - org.springframework.osgi.extender - 1.2.0 | *Unable to create application context for , unsatisfied dependencies: Dependency on (from bean )*

      org.springframework.context.ApplicationContextException: Application context initialization for 'com.progress.pso.payments-web-service' has timed out

           at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.timeout(DependencyWaiterApplicationContextExecutor.java:462)[72:org.springframework.osgi.extender:1.2.0]

           at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.access$000(DependencyWaiterApplicationContextExecutor.java:51)[72:org.springframework.osgi.extender:1.2.0]

           at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$WatchDogTask.run(DependencyWaiterApplicationContextExecutor.java:108)[72:org.springframework.osgi.extender:1.2.0]

           at java.util.TimerThread.mainLoop(Timer.java:512)[:1.6.0_24]

           at java.util.TimerThread.run(Timer.java:462)[:1.6.0_24]

       

      -


       

       

      Some notes:

       

      - I'm using Apache ServiceMix (4.3.1-fuse-01-15)

      - In the video he uses com.progress.pso.osgi.payments_api.Payments but in my code i'm using com.progress.pso.payments_api.PaymentsApi . This is because i'm using what his previous video said to use. In his new video he changes the namespace, but I kept it how it was.

      - There are two components/modules/projects (don't really know the word sorry).

      1. payments-api

      2. payments-web-service

      - When I use osgi:list, it just says payments-api not payments-api (0.0.1.SNAPSHOT) like in the video. I don't know why this is, I have set the version number in the POM

      - When I use osgi:list it says payments-api has Started, no errors are loged when I restart that service.

       

      - payments-api bundle-context.xml content is below

       

      -


       

      -


       

      - payments-api bundle-context-osgi.xml content is below

       

      -


       

      -


       

      - payments-web-service bundle-context.xml content is below

       

      -


       

      -


       

      - payments-web-service bundle-context-osgi.xml content is below

       

      -


       

      -


       

       

      My assumption is that somewhere i'm using the wrong namespace somewhere and its not matching up. But i've tripled checked everything and i'm at a loss. Any help will be super.

       

      Cheers

       

      Lango

        • 1. Re: Getting a 'unsatisfied dependencies' error when deploying my service
          Freeman(Yue) Fang Master

          Hi,

           

          This error means your bundle reference an OSGi service with interface com.progress.pso.payments_api.PaymentsApi, but there's no exposed OSGi service which implements com.progress.pso.payments_api.PaymentsApi in the OSGi container.

           

          From your bundle-context.xml, only here

          <osgi:service ref="payments_service" auto-export="all-classes" />

          expose an OSGi service, but I can't find what ref="payments_service" is, does it implement com.progress.pso.payments_api.PaymentsApi interface?

           

          Freeman

          • 2. Re: Getting a 'unsatisfied dependencies' error when deploying my service
            David Langford Newbie

            Thanks!

             

            I've updated the the following files

             

            payments-api bundle-context.xml

            -


            ...

             

            ...

            -


             

            payments-api bundle-context-osgi.xml

            -


            ...

            <osgi:service ref="paymentsApi" auto-export="all-classes" />

            ...

            -


             

            payments-web-service bundle-context.xml

            -


            ...

             

            ...

            -


             

            payments-web-service bundle-context-osgi.xml

            -


            ...

            <osgi:reference id="paymentsApi" bean-name="paymentsApi"

                   interface="com.progress.pso.payments_api.PaymentsApi"/>

            ...

            -


             

            And it is is starting up fine now and I can call the service.

             

            It's clearer now that you have pointed it out to me, thanks for that. I come from a dotNet background so sometimes I get a bit lost in all these new acronyms

             

            Another issue has popped up now though (not sure if i should log a new forum post for this), but if i modify payments-api: com.progress.pso.payments_api.PaymentsApi, by say, adding a new log message, and then run osgi:update 205 to update payments-api the new log messages are not showing when I call the service (but the old log messages from that class are).

             

            Which is weird because its the same command I ran to update it when I updated bundle-context-osgi.xml and bundle-context.xml.

             

            Which makes me think its some type of cache, so I

             

            1. Deleted the folder containing the jar in my .m2 repository

            2. Ran osgi:update 205, got a error saying it can't find the file. Which is what I was expecting

            3. Ran the payments-api install using maven in Eclipse.

            4. Saw that it re-created the folder I deleted in step 1.

            5. I ran osgi:update 205 again, and it worked fine

            6. I checked the log by using osgi:log and there were no errors

            7. I used Soap-ui to call payments_web_service successfully

            8. Checking the log, I can see payments-web-service received the soap request successfully, it then called payments-api and everything went fine. Except that the logging information from payments-api is old and not the new logging information I'm expected. This is wrong. I don't know why this is happening?

            • 3. Re: Getting a 'unsatisfied dependencies' error when deploying my service
              Freeman(Yue) Fang Master

              Hi,

               

              If the bundle you're updating still used(such as import package) by other bundles. Let's say the bundle you're updating is bundle A, and another bundle B import package from Bundle A. So the scenario is that

               

              Before you update Bundle A, in OSGi container

               

              Bundle A in Revision1<============Bundle B in Revision1

               

              After you update Bundle A, in OSGi container

              Bundle A in Revision1<============Bundle B in Revision1 and there's also a Bundle A in Revision2(so here in the OSGi container two revisions for BundleA, but only  Revision1 take effect)

              at this moment Bundle B in Revision1 still refer the Bundle A in Revision1, you need explicitly refresh Bundle A which in turn will cause all other bundles use(and transitively use) Bundle A to re-resolve(this operation is really heavy loaded work as so many bundles might be resolved again, it depend on if BundleA play a very basic bundle role), after that the new revision2 for BundleA take effect.

               

              So after you refresh BundleA, in OSGi container,

              Bundle A in Revision2<============Bundle B in Revision1

              At this moment you changes for that snapshot BundleA take effect.

               

              This kind of two-steps update/refresh operation avoid unnecessarily frequently resolving lots of bundles(as it's cpu consuming task), you can updated several bundles and then refresh  once to get all changes take effect as one goal, and this behavior is totally from OSGi spec.

               

              The different scenario is that if the SNAPSHOT Bundle A is self-used, no other Bundles import package or OSGi service from Bundle A, then update BundleA means the new revision will take effect immediately.

               

               

              That's said, just do osgi:refresh 205 should be able to pick your change.

               

              Hope this helps

               

              Freeman

              • 4. Re: Getting a 'unsatisfied dependencies' error when deploying my service
                David Langford Newbie

                Yep, that makes sense. Thanks heaps for all your help! It's working correctly now.