IConfigurationElement not found running exe [message #467004] |
Fri, 27 April 2007 04:08  |
Eclipse User |
|
|
|
Originally posted by: bsu.bergauer.ch
Hi,
Maybe someone can shed some light for me regarding following problem:
I have defined an extension point in a plugin of my RCP application. When I
run the product inside Eclipse it all works well, however after exporting
the application the extension point contributions are not "seen" by the
application. The call to the extensionRegistry is during the login phase of
the application before the workbench is initialized. I must be missing
something in my deployment export...
Log running from Eclipse:
extensionRegistry.getExtensionPoints():
[Lorg.eclipse.core.internal.registry.ExtensionPointHandle;@7 05d28
Number of configurationElements: 1
{[Lorg.eclipse.core.runtime.IConfigurationElement;@f429d7}
Log running from Rcp-exe:
extensionRegistry.getExtensionPoints():
[Lorg.eclipse.core.internal.registry.ExtensionPointHandle;@f 1fad1
Number of configurationElements: 0
{[Lorg.eclipse.core.internal.registry.ConfigurationElementHa ndle;@89ec59}
Thanks,
Bj
|
|
|
|
Re: IConfigurationElement not found running exe [message #467260 is a reply to message #467055] |
Wed, 02 May 2007 04:32   |
Eclipse User |
|
|
|
Originally posted by: bsu.bergauer.ch
Hi Alex,
Sorry for the late anwer, there has been some holidays in between... :o)
It is probably as you say, that the plugin isn't installed at that time,
however it is not clear to me how I do ensure that it is.
I have a base plugin (ch.bergauer.rcp.amset) in which the rcp product is
defined. When the rcp application is started, but before the workbench is
initiated, a login dialog is invoked from another plugin
(ch.bergauer.rcp.intro). This intro plugin defines an extension point
datastoreInitializer which is used by a third plugin
(ch.bergauer.rcp.datastore.teneo). The login dialog is displayed but the
datastore is not initiated because the datastoreInitializer is not found.
In the base plugin I declared both the intro and the datastore plugins as
required plugins, in the intro plugin I declared the datastrore plugin as
required
and in the datastore plugin I declared the intro plugin as required.
Starting the product from the Eclipse IDE works, but the exported exe
doesn't.
The config.ini looks like follows:
[config.ini start]
#Product Runtime Configuration File
osgi.splashPath=platform:/base/plugins/ch.bergauer.rcp.amset
eclipse.product=ch.bergauer.rcp.amset.product
osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.update.configura
tor@3:start,org.eclipse.core.runtime@start
osgi.bundles.defaultStartLevel=4
[config.ini end]
Greetings
Bj
|
|
|
|
|
Re: IConfigurationElement not found running exe [message #467308 is a reply to message #467305] |
Wed, 02 May 2007 13:23   |
Eclipse User |
|
|
|
OK, so if I understand, in a Bundle/Plugin start() method, you're looking for this extension, and it's not there?
Eclipse starts these bundles asynchronously. So you're not guaranteed that bundle 1 will start before bundle 2 (or vice versa). Is it possible that it's a race condition? Mind you, as long as it's been RESOLVED (which it has to be, to get into the RESOLVED state) then it should be possible to see the configuration elements.
In the console, wait until everything starts (it's certainly odd to see STARTING listed everywhere; you've not got breakpoints all over the place in debug mode, have you?) and wait until they're all ACTIVE. Once they are, stop and start your datastoreInitializer bundle; when it comes up, your extension point should be started. At least that would give you a clue if there's a problem.
The goal is to set up a listener which listens out for newly installed items so that you can take advantage of them, but for now, just doing that will determine if you have a race condition.
But the STARTING stuff looks weird. Why aren't they all ACTIVE?
Alex.
|
|
|
Re: IConfigurationElement not found running exe [message #467323 is a reply to message #467308] |
Thu, 03 May 2007 02:35   |
Eclipse User |
|
|
|
Originally posted by: bsu.bergauer.ch
Hi Alex,
I'm really thankful for the time you spend assisting me resolving this issue
and I hope this thread will be helpful for others facing a similar problem!
No, I'm not halting it up with breakpoints, actually I only have this
problem when the application runs as deployed exe. Got the point checking
for when the extension is getting loaded, will get right to this morning. In
the mean time I supply some additional data below:
I have taken use of an example out of an RCP book in order to have the user
login before the workbench starts up. Before the user can login, though, I
need to start up the embedded database in order to know what users are
registered and compare passwords and so. This occurs before the workbench is
initiated, in the run() method of the Application class (see code below). In
the LoginDialog, invoked from authenticate(display) I scan the extension
registry to find the datastore initializer. This worked well running the
application from inside the Eclipse IDE so I actually never reflected that
it might be an approach causing trouble running as rcp exe.
So I start up the application and a login dialog pops up just afer the
splash. The user can select project location (workspace) and the database
located there is getting loaded. Next the user enters username and password
and the authenticate(display) methods returns to load the workbench. So the
point in time where I query the extension registry is when the login dialog
just popped up.
If I set Eclipse-LazyStart: false in the Manifest.MF of the datastore plugin
(as well as in the libraries the plugin uses) the plugin is in the RESOLVED
state. I then queried the extension registry in the OSGI console:
osgi> ns -v ch.bergauer.rcp.amset
Extension point(s):
-------------------
ch.bergauer.rcp.amset.databaseInitializer [from ch.bergauer.rcp.amset] <--
This is the one I want before the workbench starts
ch.bergauer.rcp.amset.initialPerspective [from ch.bergauer.rcp.amset]
Extension(s):
-------------------
Id: ch.bergauer.rcp.amset.application PointId:
org.eclipse.core.runtime.applications [from ch.bergauer.rcp.amset]
Id: null PointId: org.eclipse.help.toc [from ch.bergauer.rcp.amset]
Id: ch.bergauer.rcp.amset.product PointId: org.eclipse.core.runtime.products
[from ch.bergauer.rcp.amset]
Id: null PointId: org.eclipse.ui.intro [from ch.bergauer.rcp.amset]
Id: null PointId: org.eclipse.ui.intro.config [from ch.bergauer.rcp.amset]
osgi> ns -v ch.bergauer.rcp.datastore.teneo
Extension point(s):
-------------------
Extension(s):
-------------------
<-- It is obviously not yet loaded here
osgi>
Application.java
====================
public Object run(Object args) throws Exception {
Display display = PlatformUI.createDisplay();
try {
if (authenticate(display)) {
int returnCode = PlatformUI.createAndRunWorkbench(display,
new ApplicationWorkbenchAdvisor());
if (returnCode == PlatformUI.RETURN_RESTART) {
return IPlatformRunnable.EXIT_RESTART;
}
}
return IPlatformRunnable.EXIT_OK;
} finally {
display.dispose();
}
}
private boolean authenticate(Display display) {
LoginDialog loginDialog = new LoginDialog(display);
loginDialog.open();
return loginDialog.isAuthenticated();
}
====================
Greetings
Bj
|
|
|
|
Re: IConfigurationElement not found running exe [message #467385 is a reply to message #467369] |
Thu, 03 May 2007 08:44  |
Eclipse User |
|
|
|
Originally posted by: bsu.bergauer.ch
Hi Alex,
> Can't you just specify your bundle in the config.ini's osgi.bundles
property?
I tried that before I started this thread, however as the database
initializer makes use of org.eclipse.emf.ecore.EPackages it seemed to me
that the list of bundles in the config.ini file got too long having to
include all dependencies.
> By the way, I don't see any extensions for your extension point. Are there
any?
Well, that is the root of this problem. I do have defined the extensions and
they show up (also in the osgi console) when I run the application through
the Exclipse IDE. If I run the application as deployed exe they are not
registered for that plugin anymore.
In order to go on with my project, I have now merged the datastore plugin
into the base plugin. I do not have the desired plugin design anymore, but
the application is running as deployed exe (outside of Eclipse IDE).
I thank you very much, Alex, for your patiency and good suggestions. Thanks
to your input I learned a lot more about OSGI and the bundle concept! :o)
Cheers!
Bj
|
|
|
Powered by
FUDForum. Page generated in 0.06454 seconds