Exception Starting Unresolved Bundles [message #79988] |
Mon, 01 January 2007 14:24 |
Eclipse User |
|
|
|
Originally posted by: jason.zutubi.com
Hi all,
As mentioned in a previous post, I am having some trouble when trying to
install and start bundles in 3.3M4. For example, if I install both
equinox.common and equinox.registry using BundleContext.installBundle,
then start them using Bundle.start(Bundle.START_TRANSIENT), I get an
exception:
org.osgi.framework.BundleException: State change in progress for bundle
" reference:file:C:\tools\cygwin\home\jsankey\repo\pulse\trunk \plugins\internal\org.eclipse.equinox.common_3.3.0.v20061117 -3.3M4.jar "
by thread "main".
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.begi nStateChange(AbstractBundle.java:1141)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.resu me(AbstractBundle.java:347)
at
org.eclipse.osgi.framework.internal.core.Framework.resumeBun dle(Framework.java:1115)
at
org.eclipse.osgi.framework.internal.core.PackageAdminImpl.re sumeBundles(PackageAdminImpl.java:255)
at
org.eclipse.osgi.framework.internal.core.PackageAdminImpl.do ResolveBundles(PackageAdminImpl.java:225)
at
org.eclipse.osgi.framework.internal.core.PackageAdminImpl.re solveBundles(PackageAdminImpl.java:173)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:301)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:260)
at
com.zutubi.pulse.plugins.DefaultPluginManager.loadInternalPl ugins(DefaultPluginManager.java:91)
at
com.zutubi.pulse.plugins.DefaultPluginManager.init(DefaultPl uginManager.java:40)
....
Tracing the code, this feels like a bug. If a bundle is started when in
the INSTALLED state (i.e. not resolved), and a few other (seemingly
common) conditions are met, the above occurs. The bundle is already
undergoing state change by being started, but the resolve->resume
process tries to mark it for state change again. I can overcome this by
forcing the bundles to be resolved (in any of a few different ways)
before I start them.
I also poked into the EclipseStarter and ConfigurationActivator to try
and understand why they are unaffected. In both cases, they avoid the
issue by a call to PackageAdmin.refreshPackages in between installing
and starting bundles (so bundles are resolved before start is called).
In fact, the code in these two classes is pretty much cut-and-pasted
and, to quote a comment, "a hack". This arises as the refresh is
asynchronous but in these cases the code forces it to be synchronous by
waiting for FrameworkEvent.PACKAGES_REFRESHED. All this seems quite
complicated for what ought to be a basic use case: installing and
starting bundles. In my case I am currently just calling
PackageAdmin.resolveBundles, but do wonder when a package refresh is
necessary? My reading of the spec suggests that it is only important
when some bundles are uninstalled, which can happen in the configurator
case but not (as yet) in my own case.
Cheers,
Jason
|
|
|
|
Re: Exception Starting Unresolved Bundles [message #80307 is a reply to message #80264] |
Sat, 06 January 2007 23:59 |
Eclipse User |
|
|
|
Originally posted by: jason.zutubi.com
Tom Watson wrote:
> This is indeed a bug. When I reproduce it I only see a FrameworkEvent
> of type ERROR get posted and written to the log, but the bundle actually
> starts successfully and the exception is not thrown to the caller of
> Bundle.start. Is that what you are seeing?
Yes, you are right. I see the logged exception, but it is not propagated.
> I opened bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=169717 to
> address the invalid FrameworkEvent.
Thanks!
Jason
|
|
|
Powered by
FUDForum. Page generated in 0.03267 seconds