Hello,
No, I do not, but I also tried it with that without any success. Nor do I
with the 'refresh' Equinox console command. I always get the same exception
stack...
Actually what I try to do is to provide a proof-of-concept Equinox
application that is dynamically/at-runtime extendable (through service
provider components) without the need to stop/restart the base application.
But it's really strange that I don't have any problem with my bundles in
Apache Felix and SCR.
Perhaps do you know some other working solution for the requirement?
Many thanks, Csaba.
2012/2/8 Alex Blewitt <
alex.blewitt@xxxxxxxxx>
Do you have an optional import for the package name?
If you do, and that bundle starts first, then it won't be wired to the
package. If you start up the bundle containing the package first, then
start up the provider, it will resolve the list of optional imports. Once
started, even if an optional package is added later it's not added to the
existing running bundle's package list. If you do a 'refresh' on the
service provider, does the problem go away?
Alex
On 8 Feb 2012, at 09:38, Csaba Szucs wrote:
> Hello Guys,
>
> I have an Equinox OSGi application using Declarative Services with 3
plugins:
> -a service interface plugin
> -a service provider component
> -a service consumer component (cardinality: 0..n, policy: dynamic)
>
> Framework is launched.
> id State Bundle
> 0 ACTIVE org.eclipse.osgi_3.8.0.v20110908-1857
> 3 ACTIVE osgi.example.service.consumer_1.0.0.qualifier
> 4 ACTIVE org.eclipse.osgi.services_3.3.0.v20110711-1243
> 5 ACTIVE org.eclipse.equinox.util_1.0.300.v20110502
> 6 ACTIVE org.eclipse.equinox.ds_1.3.100.v20110705
> 10 ACTIVE osgi.example.service_interface_1.0.0.qualifier
> 11 ACTIVE osgi.example.service.implementation_1.0.0.qualifier
>
> In case the application is launched, the service consumer is triggered.
>
> But in case the service provider is installed and started only after
the application has launched, SCR fails to load service implementation
class. See exception stack below!
>
> What is the problem with this runtime/post-application deployment of
the service component?
>
> Please note:
> With Apache Felix and SCR, there is no problem with the runtime
deployment at all.
>
> Many thanks, Csaba.
>
> Framework is launched.
> id State Bundle
> 0 ACTIVE org.eclipse.osgi_3.8.0.v20110908-1857
> 3 ACTIVE osgi.example.service.consumer_1.0.0.qualifier
> 4 ACTIVE org.eclipse.osgi.services_3.3.0.v20110711-1243
> 5 ACTIVE org.eclipse.equinox.util_1.0.300.v20110502
> 6 ACTIVE org.eclipse.equinox.ds_1.3.100.v20110705
> 10 ACTIVE osgi.example.service_interface_1.0.0.qualifier
>
> osgi> install
file:/home/csaba/eclipse_distros/Indigo/workspace/osgi.example.service.implementation
> Bundle id is 11.
>
> id State Bundle
> 11 INSTALLED osgi.example.service.implementation_1.0.0.qualifier
>
> osgi> start 11
>
> Here SCR throws an exception:
>
>
> !SESSION 2012-02-06 21:01:12.378
-----------------------------------------------
> eclipse.buildId=unknown
> java.version=1.6.0_20
> java.vendor=Sun Microsystems Inc.
> BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
> Command-line arguments: -dev
file:/home/csaba/eclipse_distros/Indigo/workspace/.metadata/.plugins/org.eclipse.pde.core/New_configuration
(1)/dev.properties -os linux -ws gtk -arch x86 -consoleLog -console
-consolelog
>
> !ENTRY org.eclipse.equinox.ds 4 0 2012-02-06 21:03:11.214
> !MESSAGE Exception occurred while creating new instance of component
Component[
> name = osgi.example.service.implementation
> activate = activate
> deactivate = deactivate
> modified =
> configuration-policy = optional
> factory = null
> autoenable = true
> immediate = false
> implementation = osgi.example.service.implementation.ServiceImpl
> state = Unsatisfied
> properties =
> serviceFactory = false
> serviceInterface = [osgi.example.service_interface.Service]
> references = null
> located in bundle = osgi.example.service.implementation_1.0.0.qualifier
[13]
> ]
> !STACK 0
> java.lang.ClassNotFoundException:
osgi.example.service.implementation.ServiceImpl
> at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal
(BundleLoader.java:513)
> at org.eclipse.osgi.internal.loader.BundleLoader.findClass
(BundleLoader.java:429)
> at org.eclipse.osgi.internal.loader.BundleLoader.findClass
(BundleLoader.java:417)
> at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass
(DefaultClassLoader.java:107)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
> at org.eclipse.osgi.internal.loader.BundleLoader.loadClass
(BundleLoader.java:345)
> at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass
(BundleHost.java:229)
> at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass
(AbstractBundle.java:1208)
> at
org.eclipse.equinox.internal.ds.model.ServiceComponent.createInstance
(ServiceComponent.java:480)
> at
org.eclipse.equinox.internal.ds.model.ServiceComponentProp.createInstance
(ServiceComponentProp.java:271)
> at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build
(ServiceComponentProp.java:332)
> at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent
(InstanceProcess.java:588)
> at org.eclipse.equinox.internal.ds.ServiceReg.getService
(ServiceReg.java:53)
> at org.eclipse.osgi.internal.serviceregistry.ServiceUse$1.run
(ServiceUse.java:141)
> at java.security.AccessController.doPrivileged(Native Method)
> at org.eclipse.osgi.internal.serviceregistry.ServiceUse.getService
(ServiceUse.java:139)
> at
org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.getService
(ServiceRegistrationImpl.java:468)
> at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getService
(ServiceRegistry.java:467)
> at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.getService
(BundleContextImpl.java:594)
> at org.eclipse.equinox.internal.ds.InstanceProcess.getService
(InstanceProcess.java:686)
> at org.eclipse.equinox.internal.ds.model.ComponentReference.getMethod
(ComponentReference.java:111)
> at org.eclipse.equinox.internal.ds.model.ComponentReference.bind
(ComponentReference.java:322)
> at
org.eclipse.equinox.internal.ds.model.ServiceComponentProp.bindReference
(ServiceComponentProp.java:441)
> at org.eclipse.equinox.internal.ds.InstanceProcess.dynamicBind
(InstanceProcess.java:415)
> at org.eclipse.equinox.internal.ds.Resolver.getEligible
(Resolver.java:319)
> at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged
(SCRManager.java:221)
> at
org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged
(FilteredServiceListener.java:104)
> at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent
(BundleContextImpl.java:861)
> at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent
(EventManager.java:230)
> at
org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous
(ListenerQueue.java:148)
> at
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged
(ServiceRegistry.java:819)
> at
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent
(ServiceRegistry.java:771)
> at
org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register
(ServiceRegistrationImpl.java:130)
> at
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService
(ServiceRegistry.java:214)
> at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService
(BundleContextImpl.java:433)
> at org.eclipse.equinox.internal.ds.InstanceProcess.registerService
(InstanceProcess.java:504)
> at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents
(InstanceProcess.java:259)
> at org.eclipse.equinox.internal.ds.Resolver.buildNewlySatisfied
(Resolver.java:441)
> at org.eclipse.equinox.internal.ds.Resolver.enableComponents
(Resolver.java:213)
> at org.eclipse.equinox.internal.ds.SCRManager.performWork
(SCRManager.java:800)
> at org.eclipse.equinox.internal.ds.SCRManager$QueuedJob.dispatch
(SCRManager.java:767)
> at org.eclipse.equinox.internal.ds.WorkThread.run(WorkThread.java:89)
> at org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor.run
(Executor.java:70)
>
> !ENTRY org.eclipse.equinox.ds 4 0 2012-02-06 21:03:11.216
> !MESSAGE Exception occurred while creating new instance of component
Component[
> name = osgi.example.service.implementation
> activate = activate
> deactivate = deactivate
> modified =
> configuration-policy = optional
> factory = null
> autoenable = true
> immediate = false
> implementation = osgi.example.service.implementation.ServiceImpl
> state = Unsatisfied
> properties =
> serviceFactory = false
> serviceInterface = [osgi.example.service_interface.Service]
> references = null
> located in bundle = osgi.example.service.implementation_1.0.0.qualifier
[13]
> ]
> !STACK 0
> java.lang.ClassNotFoundException:
osgi.example.service.implementation.ServiceImpl
> at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal
(BundleLoader.java:513)
> at org.eclipse.osgi.internal.loader.BundleLoader.findClass
(BundleLoader.java:429)
> at org.eclipse.osgi.internal.loader.BundleLoader.findClass
(BundleLoader.java:417)
> at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass
(DefaultClassLoader.java:107)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
> at org.eclipse.osgi.internal.loader.BundleLoader.loadClass
(BundleLoader.java:345)
> at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass
(BundleHost.java:229)
> at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass
(AbstractBundle.java:1208)
> at
org.eclipse.equinox.internal.ds.model.ServiceComponent.createInstance
(ServiceComponent.java:480)
> at
org.eclipse.equinox.internal.ds.model.ServiceComponentProp.createInstance
(ServiceComponentProp.java:271)
> at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build
(ServiceComponentProp.java:332)
> at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent
(InstanceProcess.java:588)
> at org.eclipse.equinox.internal.ds.ServiceReg.getService
(ServiceReg.java:53)
> at org.eclipse.osgi.internal.serviceregistry.ServiceUse$1.run
(ServiceUse.java:141)
> at java.security.AccessController.doPrivileged(Native Method)
> at org.eclipse.osgi.internal.serviceregistry.ServiceUse.getService
(ServiceUse.java:139)
> at
org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.getService
(ServiceRegistrationImpl.java:468)
> at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getService
(ServiceRegistry.java:467)
> at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.getService
(BundleContextImpl.java:594)
> at org.eclipse.equinox.internal.ds.InstanceProcess.getService
(InstanceProcess.java:686)
> at org.eclipse.equinox.internal.ds.model.ComponentReference.getMethod
(ComponentReference.java:111)
> at org.eclipse.equinox.internal.ds.model.ComponentReference.bind
(ComponentReference.java:322)
> at
org.eclipse.equinox.internal.ds.model.ServiceComponentProp.bindReference
(ServiceComponentProp.java:441)
> at org.eclipse.equinox.internal.ds.InstanceProcess.dynamicBind
(InstanceProcess.java:415)
> at org.eclipse.equinox.internal.ds.Resolver.getEligible
(Resolver.java:319)
> at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged
(SCRManager.java:221)
> at
org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged
(FilteredServiceListener.java:104)
> at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent
(BundleContextImpl.java:861)
> at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent
(EventManager.java:230)
> at
org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous
(ListenerQueue.java:148)
> at
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged
(ServiceRegistry.java:819)
> at
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent
(ServiceRegistry.java:771)
> at
org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register
(ServiceRegistrationImpl.java:130)
> at
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService
(ServiceRegistry.java:214)
> at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService
(BundleContextImpl.java:433)
> at org.eclipse.equinox.internal.ds.InstanceProcess.registerService
(InstanceProcess.java:504)
> at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents
(InstanceProcess.java:259)
> at org.eclipse.equinox.internal.ds.Resolver.buildNewlySatisfied
(Resolver.java:441)
> at org.eclipse.equinox.internal.ds.Resolver.enableComponents
(Resolver.java:213)
> at org.eclipse.equinox.internal.ds.SCRManager.performWork
(SCRManager.java:800)
> at org.eclipse.equinox.internal.ds.SCRManager$QueuedJob.dispatch
(SCRManager.java:767)
> at org.eclipse.equinox.internal.ds.WorkThread.run(WorkThread.java:89)
> at org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor.run