|Re: [p2-dev] Automated bundle installation and startup without platform restart|
I have not had the time to look at the details of simpleconfigurator, but I think it worth asking on the equinox-dev ml as to why the fragments are being refreshed.
From: p2-dev-bounces@xxxxxxxxxxx [mailto:p2-dev-bounces@xxxxxxxxxxx]
On Behalf Of Chip Downs
With a lot of prayer and some reverse-engineering, I found a couple of workarounds that should do the trick.
I couldn't avoid the need for classloading logic based on HookConfigurators (osgi.hook.configurators.include). Although framework extensions wouldn't work, my logic had to be in the framework classpath for the HookRegistry to instantiate their implementations.
Since our app includes a JRE customized with various things (e.g., accessibility), the classpath would work if I included my HookConfigurator jars in the JRE's lib/ext directory. However, that's a messy way to go, especially since a copy of the org.eclipse.osgi jar had to be colocated with them to avoid NoClassDefFound errors. I also needed to set osgi.frameworkParentClassloader=current in my config.ini.
The better way involved the osgi.frameworkClassPath property. After converting my HookConfigurators' fragments into regular plug-in bundles (or regular jars for that matter), the HookRegistry could "see" them if the property simply pointed to them by relative path. Here's what the necessary properties looked like in the config.ini file:
osgi.frameworkClassPath=., ../plugins/com.bea.weblogic.osgi.adapterhooks_22.214.171.124211011922.jar, ../plugins/com.cma.ssl.adapterhooks_126.96.36.199211011922.jar, ../org.eclipse.equinox.servletbridge.extensionbundle_1.2.0.v20100503.jar
Still trying to work this problem. Getting much closer, but still not there yet.
It looks like my platform is restarting due to 2 framework extension fragments we have in our product. As far as I can tell, no bundles or features depend on them, aside from my "management" application, (which I've tried to make as absolutely small as possible).
I've watched the content of the bundles.info file very closely during installation, but the fragments are not being updated (or downloaded at all) from my p2 repository. Although I cannot see any reason why the fragments would be refreshed, the PackageAdmin is doing it nonetheless when called by the simple configurator.
Can I force them from being refreshed? I like what you said below about making sure "that the 'management' application (the one that installs the other apps) and all its dependencies are not changeable." Is there some kind of "magic" configuration option that makes a bundle (or set of bundles) not changeable?
For this to happens means that the bundles you are installing are not the same than those that you have been running since step #2.
I understand that the point is to try to have a new application running, but what I'm getting at is that the installation of your application is causing a new version of the runtime (and maybe other bundles) to be brought in. Consequently, when you invoke applyConfiguration() on simpleconfigurator, the runtime bundles are stopped and uninstalled to get the new ones to run.
The easiest way to know if this is really the problem is to look at the content of the bundles.info before and after the install and see if some key bundles like runtime, osgi, equinox.app, and friends have not changed. simpleconfigurator does not do anything fancy, it just makes sure that all the bundles and only those listed in this file are indeed installed in the fwk and started accordingly.
One side note, from what I understand or your system, I would say that you may even want to ensure that the "management" application (the one that installs the other apps) and all its dependencies are not changeable since otherwise the install of an app could actually cause your management to be restarted while it is installing the new one :)