Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 364003

Summary: Unable to satisfy dependencies of bundle 'com.springsource.org.apache.xerces'
Product: [RT] Virgo Reporter: borobudur Mising name <borobudur>
Component: unknownAssignee: Glyn Normington <glyn.normington>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: glyn.normington
Version: 3.0.1.RELEASE   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
URL: http://www.eclipse.org/forums/index.php/t/261212/
Whiteboard:

Description borobudur Mising name CLA 2011-11-17 01:56:04 EST
Build Identifier: virgo-tomcat-server-3.0.1.RELEASE

Can't start the following bundle from the spring bundle repository in the virgo server:

      com.springsource.org.apache.xerces-2.8.1.jar


The depending two bundles are installed properly:

      com.springsource.org.apache.xml.resolver-1.2.0.jar
      com.springsource.org.apache.xmlcommons-1.3.4.jar

Reproducible: Always

Steps to Reproduce:
1.Pickup: com.springsource.org.apache.xmlcommons-1.3.4.jar
2.Pickup: com.springsource.org.apache.xml.resolver-1.2.0.jar
3.Pickup: com.springsource.org.apache.xerces-2.8.1.jar -> UnableToSatisfyBundleDependenciesException
Comment 1 borobudur Mising name CLA 2011-11-17 01:58:26 EST
See discussion in virgo forum: http://www.eclipse.org/forums/index.php/t/261212/
Comment 2 Glyn Normington CLA 2011-11-21 07:12:43 EST
(In reply to comment #0)
> Build Identifier: virgo-tomcat-server-3.0.1.RELEASE
> 
> Can't start the following bundle from the spring bundle repository in the virgo
> server:
> 
>       com.springsource.org.apache.xerces-2.8.1.jar
> 
> 
> The depending two bundles are installed properly:
> 
>       com.springsource.org.apache.xml.resolver-1.2.0.jar
>       com.springsource.org.apache.xmlcommons-1.3.4.jar
> 
> Reproducible: Always
> 
> Steps to Reproduce:
> 1.Pickup: com.springsource.org.apache.xmlcommons-1.3.4.jar
> 2.Pickup: com.springsource.org.apache.xml.resolver-1.2.0.jar
> 3.Pickup: com.springsource.org.apache.xerces-2.8.1.jar ->
> UnableToSatisfyBundleDependenciesException

Since the xerces bundle is a fragment of xmlcommons, it cannot be deployed successfully after xmlcommons is resolved since that is too late for the fragment to attach to its host. So this scenario is working as designed.
Comment 3 Glyn Normington CLA 2011-11-21 07:17:39 EST
I tried placing xerces and xml.resolver in repository/usr and then copying xmlcommons to pickup. xmlcommons was successfully deployed, but xerces was not attached as a fragment, contrary to what I expected.
Comment 4 Glyn Normington CLA 2011-11-21 07:22:49 EST
For completeness, I also tried placing xml.resolver and xmlcommons in repository/usr and then copying xerces to pickup. xerces would not resolve, with symptoms similar to those in comment 2:

<DE0002E> Installation of bundle 'com.springsource.org.apache.xerces' version '2.8.1' failed. org.eclipse.virgo.kernel.osgi.framework.UnableToSatisfyBundleDependenciesException: Unable to satisfy dependencies of bundle 'com.springsource.org.apache.xerces' at version '2.8.1': Cannot resolve: com.springsource.org.apache.xerces
    Resolver report:
        A Fragment-Host could not be resolved. The affected fragment is com.springsource.org.apache.xerces_2.8.1
...etc.
Comment 5 Glyn Normington CLA 2011-11-21 07:28:19 EST
The next step is to debug the following method of DependencyCalculator:

    private Set<BundleDescription> getNewImmediateDependencies(BundleDescription bundle, Collection<BundleDescription> newBundles) {
        Set<BundleDescription> immediateDependencies = new HashSet<BundleDescription>();
        immediateDependencies.addAll(Arrays.asList(bundle.getFragments()));
        immediateDependencies.addAll(Arrays.asList(bundle.getResolvedRequires()));
        immediateDependencies.addAll(getPackageProviders(bundle));

        HostSpecification hostSpecification = bundle.getHost();
        if (hostSpecification != null) {
            for (BundleDescription host : hostSpecification.getHosts()) {
                immediateDependencies.add(host);
            }
        }
        immediateDependencies.retainAll(newBundles);
        return immediateDependencies;
    }

as this should detect fragment and host dependencies.
Comment 6 Glyn Normington CLA 2011-11-21 07:30:56 EST
But first I will try to reproduce the issues using a kernel build as that will be more self-contained.
Comment 7 Glyn Normington CLA 2011-11-21 11:57:00 EST
(In reply to comment #3)
> I tried placing xerces and xml.resolver in repository/usr and then copying
> xmlcommons to pickup. xmlcommons was successfully deployed, but xerces was not
> attached as a fragment, contrary to what I expected.

This turns out to be working as designed because DependencyCalculator ignores fragments in the repository. If this function is needed, an enhancement bugzilla should be raised.
Comment 8 Glyn Normington CLA 2011-11-21 12:00:56 EST
(In reply to comment #4)
> For completeness, I also tried placing xml.resolver and xmlcommons in
> repository/usr and then copying xerces to pickup. xerces would not resolve, ...

When I ran this under a debugger, DependencyCalculator. getNewImmediateDependencies appeared not to be called. Will try again tomorrow.
Comment 9 Glyn Normington CLA 2011-11-22 05:49:05 EST
I just noticed a basic issue: xerces 2.8.1 requires xmlcommons 1.3.3:

Fragment-Host: com.springsource.org.apache.xmlcommons;bundle-version="
 [1.3.3,1.3.3]"

Repeating the tests with 1.3.3, shows that xerces can be deployed successfully with xmlcommons and xml.resolver in repository/usr:

74	RESOLVED    com.springsource.org.apache.xerces_2.8.1
	            Master=76
75	ACTIVE      com.springsource.org.apache.xml.resolver_1.2.0
76	ACTIVE      com.springsource.org.apache.xmlcommons_1.3.3
	            Fragments=74

Deploying xmlcommons 1.3.3 with xerces and xml.resolver in repository/usr also works:

74	ACTIVE      com.springsource.org.apache.xmlcommons_1.3.3
	            Fragments=75
75	RESOLVED    com.springsource.org.apache.xerces_2.8.1
	            Master=74
76	ACTIVE      com.springsource.org.apache.xml.resolver_1.2.0

Therefore closing this bug as invalid.
Comment 10 Glyn Normington CLA 2011-11-22 05:51:02 EST
(In reply to comment #7)
> (In reply to comment #3)
> > I tried placing xerces and xml.resolver in repository/usr and then copying
> > xmlcommons to pickup. xmlcommons was successfully deployed, but xerces was not
> > attached as a fragment, contrary to what I expected.
> 
> This turns out to be working as designed because DependencyCalculator ignores
> fragments in the repository. If this function is needed, an enhancement
> bugzilla should be raised.

This observation was incorrect. I realise now that DependencyCalculator does take into account the repository. The debug session with the wrong version of xmlcommons was simply misleading.
Comment 11 Glyn Normington CLA 2011-11-23 05:54:14 EST
(In reply to comment #4)
> For completeness, I also tried placing xml.resolver and xmlcommons in
> repository/usr and then copying xerces to pickup. xerces would not resolve,
> with symptoms similar to those in comment 2:
> 
> <DE0002E> Installation of bundle 'com.springsource.org.apache.xerces' version
> '2.8.1' failed.
> org.eclipse.virgo.kernel.osgi.framework.UnableToSatisfyBundleDependenciesException:
> Unable to satisfy dependencies of bundle 'com.springsource.org.apache.xerces'
> at version '2.8.1': Cannot resolve: com.springsource.org.apache.xerces
>     Resolver report:
>         A Fragment-Host could not be resolved. The affected fragment is
> com.springsource.org.apache.xerces_2.8.1
> ...etc.

Raised bug 364567 to improve the diagnostics as the current diagnostics give no hint that a matching host is not available.
Comment 12 borobudur Mising name CLA 2011-11-24 10:42:13 EST
(In reply to comment #9)
> I just noticed a basic issue: xerces 2.8.1 requires xmlcommons 1.3.3:
> 
> Fragment-Host: com.springsource.org.apache.xmlcommons;bundle-version="
>  [1.3.3,1.3.3]"
> 
> Repeating the tests with 1.3.3, shows that xerces can be deployed successfully
> with xmlcommons and xml.resolver in repository/usr:
> 
> 74    RESOLVED    com.springsource.org.apache.xerces_2.8.1
>                 Master=76
> 75    ACTIVE      com.springsource.org.apache.xml.resolver_1.2.0
> 76    ACTIVE      com.springsource.org.apache.xmlcommons_1.3.3
>                 Fragments=74
> 
> Deploying xmlcommons 1.3.3 with xerces and xml.resolver in repository/usr also
> works:
> 
> 74    ACTIVE      com.springsource.org.apache.xmlcommons_1.3.3
>                 Fragments=75
> 75    RESOLVED    com.springsource.org.apache.xerces_2.8.1
>                 Master=74
> 76    ACTIVE      com.springsource.org.apache.xml.resolver_1.2.0
> 
> Therefore closing this bug as invalid.

Thanks! Sorry for the trouble.