That seems to be a bug in Equinox. You may wish to file a bug report.

For giggles, try update 1 without stopping it first. The update operation 
will automatically stop and restart the updated bundle.

Note: in order for import and exporting the package to work here, the 
exported package in A' must be backwards compatible with the exported 
package in A. This is because the remaining code in A' will be 
implementing/using the interface from A.
-- 

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
[EMAIL PROTECTED]

office: +1 386 848 1781
mobile: +1 386 848 3788




From:
Mark <[EMAIL PROTECTED]>
To:
"Equinox development mailing list" <equinox-dev@eclipse.org>
Date:
2008-01-25 12:59
Subject:
Re: [equinox-dev] is this a service tracker bug?



Try adding: 

Import-Package: bundlea.service 

to the Bundle A manifest. 

=========================================================
I just tried the suggestion above - but it blows up?

Framework is launched.

id    State       Bundle
0    ACTIVE      org.eclipse.osgi_3.3.1.R33x_v20070828
1    ACTIVE      bundleA_1.0.0
2    ACTIVE      bundleB_1.0.0

osgi> stop 1
removedService

osgi> update 1

osgi> ss

Framework is launched.

id    State       Bundle
0    ACTIVE      org.eclipse.osgi_3.3.1.R33x_v20070828
1    INSTALLED   bundleA_1.0.0
2    ACTIVE      bundleB_1.0.0

osgi> start 1
org.osgi.framework.BundleException: Exception in bundlea.Activator.start() 
of bundle bundleA.
    at 
org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:1018)
    at 
org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:974)
    at 
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
    at 
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:260)
    at 
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:252)
    at 
org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:260)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at 
org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:150)
    at 
org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:291)
    at 
org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(FrameworkConsole.java:276)
    at 
org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:218)
    at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.IllegalStateException: The state indicates the bundle 
is resolved
    at 
org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureMessage(AbstractBundle.java:1376)
    at 
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:305)
    at 
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:260)
    at 
org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:400)
    at 
org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
    at 
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:417)
    at 
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:189)
    at 
org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:340)
    at 
org.eclipse.osgi.framework.internal.core.SingleSourcePackage.loadClass(SingleSourcePackage.java:37)
    at 
org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:396)
    at 
org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:369)
    at 
org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:357)
    at 
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at bundlea.Activator.start(Activator.java:12)
    at 
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:999)
    at java.security.AccessController.doPrivileged(Native Method)
    at 
org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:993)
    ... 14 more
Nested Exception:
java.lang.IllegalStateException: The state indicates the bundle is 
resolved
    at 
org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureMessage(AbstractBundle.java:1376)
    at 
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:305)
    at 
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:260)
    at 
org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:400)
    at 
org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
    at 
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:417)
    at 
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:189)
    at 
org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:340)
    at 
org.eclipse.osgi.framework.internal.core.SingleSourcePackage.loadClass(SingleSourcePackage.java:37)
    at 
org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:396)
    at 
org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:369)
    at 
org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:357)
    at 
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at bundlea.Activator.start(Activator.java:12)
    at 
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:999)
    at java.security.AccessController.doPrivileged(Native Method)
    at 
org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:993)
    at 
org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:974)
    at 
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
    at 
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:260)
    at 
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:252)
    at 
org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:260)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at 
org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:150)
    at 
org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:291)
    at 
org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(FrameworkConsole.java:276)
    at 
org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:218)
    at java.lang.Thread.run(Thread.java:595)
Nested Exception:
java.lang.IllegalStateException: The state indicates the bundle is 
resolved
    at 
org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureMessage(AbstractBundle.java:1376)
    at 
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:305)
    at 
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:260)
    at 
org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:400)
    at 
org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
    at 
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:417)
    at 
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:189)
    at 
org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:340)
    at 
org.eclipse.osgi.framework.internal.core.SingleSourcePackage.loadClass(SingleSourcePackage.java:37)
    at 
org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:396)
    at 
org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:369)
    at 
org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:357)
    at 
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at bundlea.Activator.start(Activator.java:12)
    at 
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:999)
    at java.security.AccessController.doPrivileged(Native Method)
    at 
org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:993)
    at 
org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:974)
    at 
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
    at 
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:260)
    at 
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:252)
    at 
org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:260)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at 
org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:150)
    at 
org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:291)
    at 
org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(FrameworkConsole.java:276)
    at 
org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:218)
    at java.lang.Thread.run(Thread.java:595)



On 25/01/2008, BJ Hargrave <[EMAIL PROTECTED]> wrote:

Try adding: 

Import-Package: bundlea.service 

to the Bundle A manifest. 

Then when bundle A is updated to A', A' will import the package from A 
which is where bundle B is importing it. So bundle B can "see" the service 
from A' since it implements the interface from A. (This follows from Tom 
Watson's explanation.) 

See 
http://www.osgi.org/blog/2007/04/importance-of-exporting-nd-importing.html
-- 

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
[EMAIL PROTECTED] 

office: +1 386 848 1781
mobile: +1 386 848 3788





_______________________________________________
equinox-dev mailing list
equinox-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/equinox-dev

_______________________________________________
equinox-dev mailing list
equinox-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/equinox-dev


_______________________________________________
equinox-dev mailing list
equinox-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/equinox-dev

Reply via email to