Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 366218 - Insufficient diagnostics for uses constraint failure
Summary: Insufficient diagnostics for uses constraint failure
Status: CLOSED WORKSFORME
Alias: None
Product: Virgo
Classification: RT
Component: runtime (show other bugs)
Version: 3.0.1.RELEASE   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL: http://www.eclipse.org/forums/index.p...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-09 11:08 EST by Glyn Normington CLA
Modified: 2011-12-13 05:04 EST (History)
1 user (show)

See Also:


Attachments
exports javax.transaction and toxic.export with uses on javax.transaction (419 bytes, application/java-archive)
2011-12-12 11:34 EST, Glyn Normington CLA
no flags Details
imports toxic.export and, optionally, javax.transaction tied to system bundle (442 bytes, application/java-archive)
2011-12-12 11:35 EST, Glyn Normington CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Glyn Normington CLA 2011-12-09 11:08:51 EST
The following diagnostics are produced:


[2011-12-09 15:47:39.487] fs-watcher                   <DE0002E> Installation of bundle 'org.springframework.data.neo4j' version '2.0.0.BUILD-SNAPSHOT' failed. org.eclipse.virgo.kernel.osgi.framework.UnableToSatisfyBundleDependenciesException: Unable to satisfy dependencies of bundle 'org.springframework.data.neo4j' at version '2.0.0.BUILD-SNAPSHOT': Cannot resolve: org.springframework.data.neo4j
    Resolver report:
        Uses violation: <Import-Package: org.neo4j.kernel.impl.persistence; version="0.0.0"> in bundle <org.springframework.data.neo4j_2.0.0.BUILD-SNAPSHOT[1323445019050]>
             Resolver reported uses conflict for import
        Uses violation: <Import-Package: org.neo4j.index.impl.lucene; version="0.0.0"> in bundle <org.springframework.data.neo4j_2.0.0.BUILD-SNAPSHOT[1323445019050]>
             Resolver reported uses conflict for import
        Uses violation: <Import-Package: org.neo4j.kernel; version="0.0.0"> in bundle <org.springframework.data.neo4j_2.0.0.BUILD-SNAPSHOT[1323445019050]>
             Resolver reported uses conflict for import
        Uses violation: <Import-Package: org.neo4j.kernel.impl.transaction; version="0.0.0"> in bundle <org.springframework.data.neo4j_2.0.0.BUILD-SNAPSHOT[1323445019050]>
             Resolver reported uses conflict for import
        Uses violation: <Import-Package: org.neo4j.kernel.impl.nioneo.store; version="0.0.0"> in bundle <org.springframework.data.neo4j_2.0.0.BUILD-SNAPSHOT[1323445019050]>
             Resolver reported uses conflict for import
        Uses violation: <Import-Package: org.neo4j.kernel.impl.core; version="0.0.0"> in bundle <org.springframework.data.neo4j_2.0.0.BUILD-SNAPSHOT[1323445019050]>
             Resolver reported uses conflict for import

	at org.eclipse.virgo.kernel.install.pipeline.stage.resolve.internal.QuasiResolveStage.process(QuasiResolveStage.java:46)
        etc.

which give little indication of the real problem which appears to be that the "Neo4j" bundle exports some packages with uses constraints on packages such as javax.transaction that it neither imports nor exports (the packages are provided in the bundle's classpath). Thus any bundle that attempts to wire to one of these package and javax.transaction or javax.transaction.xa will fail to resolve.

However, this is just a theory. It helped the user find a fix, but when I tried to recreate this with a minimal example, the problem would not reproduce. Hence we are left with the problem of debugging the full set of bundles.

Steps to reproduce:

1. Unzip neo4j-bundle.zip. (I will attempt to attach this to the bug.)
2. Unzip Virgo Tomcat Server 3.0.1.RELEASE and replace the repository/ext Spring 3.0.5 JARs with their 3.0.6 equivalents.
3. Place the contents of the repository/usr directory in the first unzip into Virgo's repository/usr.
4. Place the bundle neo4j-osgi-bundle-0.1-SNAPSHOT.jar from the pickup directory in the first unzip into Virgo's repository/usr. (This avoids an ordering issue in pickup.)
5. Place the bundle spring-data-neo4j-2.0.0.BUILD-SNAPSHOT.jar from the pickup directory in the first unzip into Virgo's pickup directory.
6. Start Virgo with bin/startup.sh -clean.
7. Observe the diagnostics appearing on the console.
Comment 1 Glyn Normington CLA 2011-12-09 11:21:21 EST
First zip too large for an attachment. I'll store it here for a while:
http://dl.dropbox.com/u/2487064/neo4j-bundle.zip
Comment 2 Glyn Normington CLA 2011-12-09 11:22:33 EST
Second zip file also too large: http://dl.dropbox.com/u/2487064/spring-framework-dist-3.0.6.RELEASE.zip
Comment 3 Glyn Normington CLA 2011-12-09 11:52:16 EST
Interestingly I did manage to recreate the uses constraint failure with a pair of minimal bundles after observing that the "neo4j" super bundle exports javax.transaction and the other bundle imports it with a version range that makes it wire to the system bundle. However, the diagnostics in that case were as expected, i.e. much better:


[2011-12-09 16:49:53.692] fs-watcher                   <DE0002E> Installation of bundle 'toxic-user' version '0.0.0' failed. org.eclipse.virgo.kernel.osgi.framework.UnableToSatisfyBundleDependenciesException: Unable to satisfy dependencies of bundle 'toxic-user' at version '0.0.0': Cannot resolve: toxic-user
    Resolver report:
        Uses violation: <Import-Package: toxic; version="0.0.0"> in bundle <toxic-user_0.0.0[1323449391479]>
            Found conflicts:
                package        'javax.transaction_0.0.0' in bundle 'toxic-bundle_0.0.0[1323449391480]' used by 'toxic_0.0.0' in bundle 'toxic-bundle_0.0.0[1323449391480]'
                conflicts with 'javax.transaction_1.1.0' in bundle 'org.eclipse.osgi_3.7.1.R37x_v20110808-1106[0]' imported by bundle 'toxic-user_0.0.0[1323449391479]'
                package        'javax.transaction_0.0.0' in bundle 'toxic-bundle_0.0.0[1323449391480]' used by 'toxic_0.0.0' in bundle 'toxic-bundle_0.0.0[1323449391480]'
                conflicts with 'javax.transaction_1.0.1' in bundle 'org.eclipse.osgi_3.7.1.R37x_v20110808-1106[0]' imported by bundle 'toxic-user_0.0.0[1323449391479]'


	at org.eclipse.virgo.kernel.install.pipeline.stage.resolve.internal.QuasiResolveStage.process(QuasiResolveStage.java:46)
        etc.
Comment 4 Glyn Normington CLA 2011-12-12 11:33:39 EST
After debugging through UsesAnalyser, the reason that detailed diagnostics are not produced became clear: the conflicting import of, for example, javax.transaction is marked as optional and so the resolver is free to discard the import to avoid the conflict. It appears that Equinox did not discard the import in this case and so it failed with a uses violation that UsesAnalyser was not able to grok.

I beef up the minimal testcase to make the import of javax.transaction optional and the problem behaviour reproduced. To reproduce this failure, place the attached toxic-exporter.jar in repository/usr and the attached toxic-user-optional.jar in pickup and cold start Virgo. The diagnostics are as follows, because the UsesAnalyser can't see why the optional javax.transaction import was not discarded:

[2011-12-12 16:21:29.001] fs-watcher                   <DE0002E> Installation of bundle 'toxic-user' version '0.0.0' failed. org.eclipse.virgo.kernel.osgi.framework.UnableToSatisfyBundleDependenciesException: Unable to satisfy dependencies of bundle 'toxic-user' at version '0.0.0': Cannot resolve: toxic-user
    Resolver report:
        Uses violation: <Import-Package: toxic; version="0.0.0"> in bundle <toxic-user_0.0.0[1323706887184]>
             Resolver reported uses conflict for import
Comment 5 Glyn Normington CLA 2011-12-12 11:34:43 EST
Created attachment 208267 [details]
exports javax.transaction and toxic.export with uses on javax.transaction
Comment 6 Glyn Normington CLA 2011-12-12 11:35:31 EST
Created attachment 208268 [details]
imports toxic.export and, optionally, javax.transaction tied to system bundle
Comment 7 Glyn Normington CLA 2011-12-12 11:42:19 EST
The system bundle exports should be set to contain the following in order to reproduce this behaviour in vanilla Equinox:

 javax.transaction,\
 javax.transaction;version="1.0.1",\
 javax.transaction;version="1.1.0",\
Comment 8 Glyn Normington CLA 2011-12-13 05:04:59 EST
Raised separate Equinox bug 366509 and closing this Virgo bug as "working as designed".