Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343050 - Document stricter processing of Require-Bundle by Equinox 3.7 in Virgo 3.0 migration notes
Summary: Document stricter processing of Require-Bundle by Equinox 3.7 in Virgo 3.0 mi...
Status: CLOSED FIXED
Alias: None
Product: Virgo
Classification: RT
Component: runtime (show other bugs)
Version: 3.0.0.M03   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: 3.0.0.M04   Edit
Assignee: Glyn Normington CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-16 14:56 EDT by Mario Scalas CLA
Modified: 2011-04-20 06:24 EDT (History)
2 users (show)

See Also:
glyn.normington: documentation+


Attachments
Bundles + Plans to reproduce the problem (must be installed as described in the report) (1.13 MB, application/octet-stream)
2011-04-16 15:03 EDT, Mario Scalas CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mario Scalas CLA 2011-04-16 14:56:59 EDT
Build Identifier: 3.0.0.M03

I use the H2 database and I use it with success in virgo 2.1.0: I wanted to test my application on latest milestone (actually 3.0.0.M03).

I've done the following steps:
 * modified my previous plan to use the new Virgo XSD (used DM Server XSD before)
 * copied the 2 required jars in $VIRGO_HOME/repository/usr 
    * h2-1.3.154.jar (downloaded straight from http://www.h2database.com (which is OSGi-enabled from a long time and always worked fine in my Eclipse/OSGi-based apps)
    * it.amtservices.ido2.infrastructure.database.starter-1.0.0.SNAPSHOT.jar (my application bundle which just starts the database server as a spring bean). It has always worked but in this example is only required to demonstrate that the h2 bundle can't be found.
 * Copied the plans in $VIRGO_HOME/pickup
 * started Virgo

At runtime I get:

...
[2011-04-16 20:39:42.937] fs-watcher                   <HD0003E> Hot re-deploy f
ailed for file 'it.amtservice.ido2-1.0.0.SNAPSHOT.plan'. org.eclipse.virgo.kerne
l.deployer.core.DeploymentException: Dependency satisfaction failed
        at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationD
eployer.driveInstallPipeline(PipelinedApplicationDeployer.java:288)
        at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationD
eployer.doInstall(PipelinedApplicationDeployer.java:164)
        at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationD
eployer.install(PipelinedApplicationDeployer.java:136)
        at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationD
eployer.deploy(PipelinedApplicationDeployer.java:203)
        at org.eclipse.virgo.kernel.deployer.hot.HotDeploymentFileSystemListener
.deploy(HotDeploymentFileSystemListener.java:174)
        at org.eclipse.virgo.kernel.deployer.hot.HotDeploymentFileSystemListener
.onChange(HotDeploymentFileSystemListener.java:81)
        at org.eclipse.virgo.util.io.FileSystemChecker.notifyListeners(FileSyste
mChecker.java:245)
        at org.eclipse.virgo.util.io.FileSystemChecker.check(FileSystemChecker.j
ava:166)
        at org.eclipse.virgo.kernel.deployer.hot.WatchTask.run(WatchTask.java:58
)
        at java.lang.Thread.run(Thread.java:662)
Caused by: org.eclipse.virgo.kernel.osgi.framework.UnableToSatisfyBundleDependen
ciesException: Unable to satisfy dependencies of bundle 'it.amtservices.ido2.inf
rastructure.database.starter' at version '1.0.0.SNAPSHOT': Cannot resolve: it.am
tservices.ido2.infrastructure.database.starter
    Resolver report:
        A Require-Bundle could not be resolved. Caused by missing constraint in
bundle <it.amtservices.ido2.infrastructure.database.starter_1.0.0.SNAPSHOT>
             constraint: <Require-Bundle: org.h2; bundle-version="0.0.0">

This happens even with a clean virgo installation (just added the bundles and plans): the H2 bundle seems pretty fine both to me, Eclipse RCP applications and Virgo 2.1.0 so I think something has changed in Virgo :S

Reproducible: Always

Steps to Reproduce:
1. Put the two JARS in $VIRGO_HOME/repository/usr
2. Put the two plans in $VIRGO_HOME/pickup
3. start virgo
4. Get the exception
Comment 1 Mario Scalas CLA 2011-04-16 15:03:02 EDT
Created attachment 193422 [details]
Bundles + Plans to reproduce the problem (must be installed as described in the report)

This are the dependencies:
 * two plans (one for installing H2, the other for the plugin which triggers the problem)
 * the H2 bundle
 * the database starter plugin.

Installing only the H2 plan (it.amtservice.ido2.util-1.0.0.SNAPSHOT.plan) works fine (the bundle is correctly installed in the runtime). When the it.amtservice.ido2-1.0.0.SNAPSHOT.plan is installed (which uses the H2 bundle), then the problem happens.
Comment 2 Hristo Iliev CLA 2011-04-16 16:17:42 EDT
Seems like the Require-Bundle header in it.amtservices.ido2.infrastructure.database.starter-1.0.0.SNAPSHOT.jar has to be changed to have bundle-version as an attribute:

Require-Bundle: org.h2;bundle-version="[1.3.148,2.0.0)"

Replacing version with bundle-version solved the problem. Virgo now runs on Equinox 3.7, which seems to be more strict with regards to headers/attributes. This would also explain why the bundle was running well before.

For more info check the OSGi specification (3.12.1 Require-Bundle / pages 70-72 for 4.2).
Comment 3 Hristo Iliev CLA 2011-04-16 16:39:46 EDT
I wonder if we could (or in fact should) cover this case with additional checks and more information on how to solve the problem.
Comment 4 Mario Scalas CLA 2011-04-17 01:56:02 EDT
You are right! Replacing (for example):
Require-Bundle: 
 org.h2;version="[1.3.0, 2.0.0)"

into:

Require-Bundle: 
 org.h2;bundle-version="[1.3.0, 2.0.0)"

has worked for me. I had few other bundles that used that form so I'll have to tweak them too.

Perhaps a "migration to Virgo 3.0.0" guide should contain the hint since at runtime Virgo is pretty musch obscure about the issue (until one knows where to look ;))

Thanks Hristo. This may be closed for me.
Comment 5 Glyn Normington CLA 2011-04-18 04:17:20 EDT
Let's use this bug to update the migration notes for 3.0. Changing the title to match.
Comment 7 Glyn Normington CLA 2011-04-20 06:24:00 EDT
Tagging for M04 release notes, even though this is independent of the milestone.