The reason is that for a given OSGi bundle to be able to see a service in
the OSGi registry, it has to have on its classpath all the classes or
interfaces exported by the target OSGi service.  I suspect that in your
case, your client bundle does not import all the needed packages.  You can
see the exact list of classes exported using the "osgi/ls" command and the
list of packages imported using "packages/import" command.
Make sure your bundle imports all the packages from the export list.
This is a drawback of using auto-export imho.

2009/3/16 cmoulliard <[email protected]>

>
> Hi,
>
> I have created an osgi bundle where the bean to expose as a service is
> defined in a spring file :
>
>    <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>                        <property name="brokerURL"
> value="vm://localhost:61616?create=false" />
>    </bean>
>
>    <osgi:service id="activemqservice" ref="activemq"
> auto-export="all-classes"/>
>
> The service is well published. See the log here after.
>
> 13:18:42,058 | DEBUG | xtenderThread-16 | OsgiBundleXmlApplicationContext
>  |
> ractOsgiBundleApplicationContext  247 | Registering BundleContext as a bean
> named bundleContext
> 13:18:42,058 | DEBUG | xtenderThread-16 | WaiterApplicationContextExecutor
> |
> WaiterApplicationContextExecutor  218 | Pre-refresh completed; determining
> dependencies...
> 13:18:42,058 | DEBUG | xtenderThread-16 | DependencyServiceManager
> |
> startup.DependencyServiceManager  253 | Discovered local dependency
> factories: []
> 13:18:42,074 | DEBUG | xtenderThread-16 | DefaultListableBeanFactory
> |
> ort.DefaultSingletonBeanRegistry  214 | Creating shared instance of
> singleton bean 'activemqservice'
> 13:18:42,074 | DEBUG | xtenderThread-16 | DefaultListableBeanFactory
> |
> ractAutowireCapableBeanFactory$1  383 | Creating instance of bean
> 'activemqservice'
> 13:18:42,074 | DEBUG | xtenderThread-16 | DefaultListableBeanFactory
> |
> stractAutowireCapableBeanFactory  459 | Eagerly caching bean
> 'activemqservice' to allow for resolving potential circular references
> 13:18:42,105 | DEBUG | xtenderThread-16 | CachedIntrospectionResults
> |
> beans.CachedIntrospectionResults  151 | Not strongly caching class
>
> [org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean]
> because it is not cache-safe
> 13:18:42,105 | DEBUG | xtenderThread-16 | DefaultListableBeanFactory
> |
> stractAutowireCapableBeanFactory 1367 | Invoking afterPropertiesSet() on
> bean with name 'activemqservice'
> 13:18:42,105 | DEBUG | xtenderThread-16 | DefaultListableBeanFactory
> |
> ractAutowireCapableBeanFactory$1  411 | Finished creating instance of bean
> 'activemqservice'
> 13:18:42,105 | INFO  | xtenderThread-16 | DependencyServiceManager
> |
> startup.DependencyServiceManager  278 | Adding OSGi service dependency for
> importer [&activemqservice] matching OSGi filter
> [(objectClass=org.apache.activemq.camel.component.ActiveMQComponent)]
>
> Unfortunately, the osgi bundle who will consume the osgi:service
>
>        <osgi:reference id="activemqservice"
> interface="org.apache.activemq.camel.component.ActiveMQComponent" />
>
> generates an error
>
> 13:18:42,105 | DEBUG | xtenderThread-16 | DependencyServiceManager
> |
> startup.DependencyServiceManager  226 | 1 OSGi service dependencies, 1
> unsatisfied (for beans [&activemqservice]) in
> OsgiBundleXmlApplicationContext(bundle=reportincident.interfaces,
> config=osgibundle:/META-INF/spring/*.xml)
> 13:18:42,105 | INFO  | xtenderThread-16 | DependencyServiceManager
> |
> startup.DependencyServiceManager  232 |
> OsgiBundleXmlApplicationContext(bundle=reportincident.interfaces,
> config=osgibundle:/META-INF/spring/*.xml) is waiting for unsatisfied
> dependencies [[&activemqservice]]
> 13:18:42,105 | DEBUG | xtenderThread-16 | WaiterApplicationContextExecutor
> |
> WaiterApplicationContextExecutor  257 | Registering service dependency
> dependencyDetector for
> OsgiBundleXmlApplicationContext(bundle=reportincident.interfaces,
> config=osgibundle:/META-INF/spring/*.xml)
> 13:18:42,121 | DEBUG | xtenderThread-16 | DependencyServiceManager
> |
> startup.DependencyServiceManager  297 |
> OsgiBundleXmlApplicationContext(bundle=reportincident.interfaces,
> config=osgibundle:/META-INF/spring/*.xml) has registered service dependency
> dependencyDetector with filter:
> (objectClass=org.apache.activemq.camel.component.ActiveMQComponent)
>
> What is the cause of this issue ? Do I have to change something in my
> MANIFEST file ?
>
>
>
>
> -----
> Charles Moulliard
> SOA Architect
>
> My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/
> --
> View this message in context:
> http://www.nabble.com/1-OSGi-service-dependencies%2C-1-unsatisfied-%28for-beans---activemqservice-%29-in-OsgiBundleXmlApplicationContext-tp22537014p22537014.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Reply via email to