My issue is that the name of the package is the same between import-package
and export-package and maven felix bnd does not add export package :
<configuration>
<manifestLocation>META-INF</manifestLocation>
<instructions>
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<Import-Package>org.apache.activemq.camel.component,*</Import-Package>
<Export-Package>org.apache.activemq.camel.component</Export-Package>
<Include-Resource>src/main/resources</Include-Resource>
<Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
<Private-Package></Private-Package>
</instructions>
</configuration>
and result of the importation (no Export-Package appears)
ActiveMq Broker Feature (103)
-----------------------------
Manifest-Version = 1.0
Bnd-LastModified = 1237215735043
Tool = Bnd-0.0.255
Spring-Context = *;publish-context:=false;create-asynchronously:=true
Bundle-Name = ActiveMq Broker Feature
Built-By = Charlesm
Import-Package = org.apache.activemq.camel.component
Bundle-SymbolicName = reportincident.activemq
Bundle-Version = 1.0.0.SNAPSHOT
Build-Jdk = 1.6.0_12
Created-By = Apache Maven Bundle Plugin
Bundle-ManifestVersion = 2
gnodet wrote:
>
> 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
>
>
-----
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-tp22537014p22540154.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.