RCP app wont start after update [message #444112] |
Thu, 09 February 2006 19:15  |
Eclipse User |
|
|
|
I have an rcp app running just fine stand alone. I am running with
osgi.clean=true in my config.ini file. I am using features.
Here's the problem:
I update my app's main plugin jar (not using update manager). The first
time I run the app after the update I get the following Exception (see
below). Then, I run the app a second time (without changing anything) and
everything is fine. Why does it fail the first time but run the second
time?
here is the Exception I get on first run:
!ENTRY org.eclipse.osgi 2006-02-09 16:02:13.339
!MESSAGE An error occurred while automatically activating bundle
com.worldpac.pde (5).
!STACK 0
org.osgi.framework.BundleException: The activator
com.worldpac.pde.PDE_Plugin for bundle com.worldpac.pde is invalid
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.load BundleActivator(AbstractBundle.java:149)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:965)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:313)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:264)
at
org.eclipse.core.runtime.adaptor.EclipseClassLoader.findLoca lClass(EclipseClassLoader.java:116)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findLo calClass(BundleLoader.java:337)
at
org.eclipse.osgi.framework.internal.core.SingleSourcePackage .loadClass(SingleSourcePackage.java:37)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:377)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:350)
at
org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader. loadClass(AbstractClassLoader.java:78)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319 )
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at com.worldpac.boot.Bootstrap.<init>(Unknown Source)
at com.worldpac.rcp.bootstrap.Application.run(Unknown Source)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:226)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:376)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:163)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
at org.eclipse.core.launcher.Main.run(Main.java:973)
at org.eclipse.core.launcher.Main.main(Main.java:948)
Caused by: java.lang.ClassNotFoundException: com.worldpac.pde.PDE_Plugin
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:405)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:350)
at
org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader. loadClass(AbstractClassLoader.java:78)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.loadCl ass(BundleLoader.java:275)
at
org.eclipse.osgi.framework.internal.core.BundleHost.loadClas s(BundleHost.java:227)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.load BundleActivator(AbstractBundle.java:142)
... 26 more
Root exception:
java.lang.ClassNotFoundException: com.worldpac.pde.PDE_Plugin
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:405)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:350)
at
org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader. loadClass(AbstractClassLoader.java:78)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.loadCl ass(BundleLoader.java:275)
at
org.eclipse.osgi.framework.internal.core.BundleHost.loadClas s(BundleHost.java:227)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.load BundleActivator(AbstractBundle.java:142)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:965)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:313)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:264)
at
org.eclipse.core.runtime.adaptor.EclipseClassLoader.findLoca lClass(EclipseClassLoader.java:116)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findLo calClass(BundleLoader.java:337)
at
org.eclipse.osgi.framework.internal.core.SingleSourcePackage .loadClass(SingleSourcePackage.java:37)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:377)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:350)
at
org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader. loadClass(AbstractClassLoader.java:78)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319 )
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at com.worldpac.boot.Bootstrap.<init>(Unknown Source)
at com.worldpac.rcp.bootstrap.Application.run(Unknown Source)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:226)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:376)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:163)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
at org.eclipse.core.launcher.Main.run(Main.java:973)
at org.eclipse.core.launcher.Main.main(Main.java:948)
|
|
|
|
|
|
|
Re: RCP app wont start after update [message #444217 is a reply to message #444216] |
Fri, 10 February 2006 17:46   |
Eclipse User |
|
|
|
The noRegistry was a better solution to adding the view than clean, though. If you do clean, you lose any other settings (for example, Java code formatting settings would be wiped) but if you do noRegistry then it doesn't remove them.
As for the problem with the startup, I think that's related to you having bi-directional references between two plugins. Only one of them gets started/installed first, with the result that the other one is not installed when the first is activated. If you've got the proper dependencies marked out with the Requires-Bundle, this shouldn't happen, which is why I suspected that you were maybe using buddy classloading to allow your plugins to reference each other.
There isn't a magic flag that will start up both plugins at the same time, so you either have to live with it or change your code so that you don't have bidirectional references between your plugins. I'd be intrigued to find out what you're doing to make this happen, and if my suspicion of using the buddy classloader is correct, because this kind of thing may happen more frequently in the future.
A better approach would be to not do initialisation on bundle startup, but rather do it on demand lazily. That way, you are likely to have the bundle started in order to successfully forward-reference another plugin's classes.
Alex.
|
|
|
Re: RCP app wont start after update [message #444227 is a reply to message #444217] |
Fri, 10 February 2006 19:02   |
Eclipse User |
|
|
|
I am not using buddy class loading. I do not have bidirectional
references.
I have a unidirectional reference to an exported package
(com.worldpac.pde)... My manifest.mf for plugin com.worldpac.boot looks
like this:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Boot Plug-in
Bundle-SymbolicName: com.worldpac.boot
Bundle-Version: 1.0.0
Bundle-ClassPath: .
Bundle-Localization: plugin
Export-Package: com.worldpac.boot,
org.apache.crimson.parser,
org.apache.crimson.parser.resources,
org.apache.crimson.tree,
org.apache.crimson.tree.resources,
org.apache.crimson.treediff,
org.apache.crimson.util,
org.apache.crimson.xhtml,
org.apache.crimson.xhtml.resources,
org.w3c.dom,
org.w3c.dom.html,
org.xml.sax,
org.xml.sax.ext,
org.xml.sax.helpers
Import-Package: com.worldpac.pde
Require-Bundle: com.worldpac.logging,
com.worldpac.util
My manifest.mf for plugin com.worldpac.pde looks like this:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: ProductDevelopmentEnvironment Plug-in
Bundle-SymbolicName: com.worldpac.pde; singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: com.worldpac.pde.PDE_Plugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.apache.axis.webservices,
com.worldpac.logging,
com.worldpac.util
Bundle-Vendor: worldpac.com
Eclipse-AutoStart: true
Export-Package: com.worldpac.pde
NOTE:
I encounter the same problem when I add plugin com.worldpac.pde to my
com.worldpac.boot plugin's manifest.mf as a required bundle:
Require-Bundle: com.worldpac.pde
|
|
|
Re: RCP app wont start after update [message #444250 is a reply to message #444227] |
Sat, 11 February 2006 03:57   |
Eclipse User |
|
|
|
Thanks for the info.
I'm not sure that 'import package' is enough to make sure that Eclipse knows whether to start the bundles in the right order; it might even be doing something syntactic like starting them alphabetically in the case of not figuring out what needs to occur first.
I'd have recommended that you use Require-Bundle in the .boot package, because that would explicitly tell Eclipse which order to start up. If you have this option, and you start it with -clean (once), doesn't that fix the problem?
Also, I'd be curious as to whether you're accessing information from the pde plugin by simple class reference (e.g. this.getClass("com.worldpac.pde.Plugin") or via bundle references (bundleContext.getBundle(...)). The latter way might determine to Eclipse that it needs to be started/installed, if it's not already.
Of course, it could be an inssue with the startup engine and starting up bundles out-of-sequence, but I suspect it's unlikely to be the case.
I'd recommend putting some debug messages in the start methods of your two bundles (so you can see which ones are starting up when) becaues the problem appears to be that the .boot. is getting started before the .pde. plugin. Then it's a case of trying to see if changes to the manifest.mf (e.g. making it a real (non-optional) dependency instead of a virtual one would help.
But regardless of which of these works (or doesn't) you can solve the problem by not referencing the .pde. classes in the .boot. plugin. If you had an interface for your system (say, IPDEHelper) defined in the .boot. plugin, and the .pde. code implemented that interface, then rather than initialise it at start time, you'd initialise it on-demand (like IPDEHelper getIPDEHelper() { if ( helper == null) ...)
Bear in mind that even if you don't have a specific reference in your start method, indirect references (e.g. by instance field definition) will also count.
And lastly, maybe it is starting them up in the right order but .pde. needs something from .boot. and of course the latter is still starting up ;-)
Hope this gives you an idea of where you can go from here,
Alex.
|
|
|
Re: RCP app wont start after update [message #444306 is a reply to message #444250] |
Mon, 13 February 2006 12:16  |
Eclipse User |
|
|
|
Alex
The reason I am not using requires in the .boot plugin is because the
boot plugin is our update plugin and .boot plugin is updating all our
plugins (.pde being the main one) and we do not want to load them until
after the update has done its duty.
I am actually doing something a little funky to start our rcp app from the
boot plugin. I am accessing class PDE_Main from the pde plugin via
reflection (e.g. Class.forName("com.worldpac.pde.PDE_Main").newInstance())
PDE_Main calls into the rcp framework (e.g. new Application().run(null))
What is not clear to me is why all is well if I do not use the clean (or
noRegistryCache) switch....however if i do use either of these switches I
get the class not found exception the first run....but the the next run is
just fine. I do not understand how these switches relate to the classpath?
TX
Scott
|
|
|
Powered by
FUDForum. Page generated in 0.04110 seconds