2

I have an Eclipse RCP application, and I am trying with no luck to install a plugin I have created that should be deployed separately to the aforementioned application.

To do so, I start the application as ./App -console, and when it has stopped loading, I type:

install file://URLTOjAR/plugin.jar

It returns me a plugin ID (lets say 288), so I type afterwards:

start 288

After this, the plugin is working fine, but when I restart the application, by using ss I only can see that the plugin is only "Resolved", but I'd like it to be started.

Is there a way to automate this?

palacsint
  • 28,416
  • 10
  • 82
  • 109
  • 1
    If you expect your plugin to be `ACTIVE` and it is just `RESOLVED`, use the `diag ` operation in the osgi console. It will show the missing plugins that need to be added in the runtime configuration. – kon Jul 10 '12 at 07:24

5 Answers5

2

Since you are using an Eclipse RCP app, you are most likely using a SimpleConfigurator to determine your list of currently installed bundles. Open the file App/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info

In that file there is a list of installed bundles, their versions and whether or not they should auto-started. You will see a line like this:

ch.qos.logback.classic,0.9.27.v20110224-1110,plugins/ch.qos.logback.classic_0.9.27.v20110224-1110.jar,4,false

The different parts of the line are this:

  1. the bundle identifier
  2. bundle version
  3. jar file name, relative to the install location
  4. start level (usually just set it to 4)
  5. whether or not to auto-start your bundle, change this to true.

So, just add a line like this in your bundles.info and you should be good to go.

Andrew Eisenberg
  • 28,387
  • 9
  • 92
  • 148
1

The installed and started bundle should be started on the next start.

Maybe the activator throws an exception when the framework tries to start the bundle and it remains in RESOLVED state. Check the logs. Maybe the bundle doesn't handle well the services, resources which are not (yet) available when it's starting.

palacsint
  • 28,416
  • 10
  • 82
  • 109
1

And here's another way to do solve this. A bit messier than using the simple configurator (see my other answer), but it should be more widely applicable.

In the file configuration/config.ini, there should be a property osgi.bundles. This property takes a comma separated list of bundles to use in the osgi instance. The property looks like this:

osgi.bundles=file:/path/to/bundle,file:/path/to/other/bundle@1\:start

The @1 is the start level of the bundle and :start means that the bundle should be autostarted.

Andrew Eisenberg
  • 28,387
  • 9
  • 92
  • 148
0

I'm not sure weather i got your question right. But i will give a try:

  1. why are you trying to install bundle/plugin that is not related to the application.If your plugin/bundle has nothing to with the running application environment then just use eclispe environment to launch the bundle with required other plugins.

  2. I think what is happening here is you that bundle get lazy loaded. If the Application plugins does not use the bundle it make sense.

  3. If you really want to make the bundle start with the your application, what you can do is to,

find the configuration file that list all the start info of bundle in your RCP app.

*This can be config.ini file *or the bundles.info file if the application is using simpleconfigurator

insert your bundle information in one of the config files. (theres a parameter to set if you want immediate start - 'true')

HTH, --Pradeep

  • I am trying to install a plugin because I have developed an application for a client, which might be extended by third parties. As you say in point 2, it is not being referenced at all by the application, as long as I don't know which classes will be implemented at all. – Josep Rodríguez López Nov 07 '11 at 07:32
0

Create another plugin which:

  1. Listens to bundle lifecycle events (using BundleListener).
  2. Records added bundles.
  3. When started, looks for records from last launch and starts bundles listed there.
Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487