1

We're using OSGi for a rest application using bdntools and eclipse. We've deployed the application and everything is working OK.
The run descriptor we were using was OK, but we've copied the run requirements to a new run descriptor and now we are unable to resolve the dependencies, caused by the following error:

Uses constraint violation. 
Unable to resolve resource org.apache.felix.http.whiteboard [org.apache.felix.http.whiteboard ver=2.2.0]
because it is exposed to package 'javax.servlet' from resources
org.amdatu.multitenant.org.apache.felix.http.jetty [org.amdatu.multitenant.org.apache.felix.http.jetty ver=1.0.0]
and org.apache.felix.http.jetty [org.apache.felix.http.jetty ver=2.2.0] via two dependency chains.

We're having this problem more often, usually it is solved by creating a new run descriptor, but not this time..

Is this a bug in bndtools or are we doing something wrong? We also have the impression it might have something to do with multiple repositories.

Edit: Here is the run descriptor and are the manifests of the bundles.

Run descriptor:

-runfw: org.apache.felix.framework;version='[4,5)'
-runee: JavaSE-1.7
-runsystemcapabilities: ${native_capability}

-resolve.effective: active

-runrequires: osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.shell)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.command)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.http.jetty)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.http.whiteboard)'

Manifest org.apache.felix.http.jetty:

Manifest-Version: 1.0
Export-Package: org.apache.felix.http.api;uses:="javax.servlet,org.osg
i.service.http";version="2.0.4",org.osgi.service.http;uses:="javax.se
rvlet.http,javax.servlet";version="1.2",javax.servlet.resources;versi
on="2.5",javax.servlet;version="2.5",javax.servlet.jsp.resources;vers
ion="2.5",javax.servlet.http;uses:="javax.servlet";version="2.5"
Built-By: fmeschbe
Tool: Bnd-0.0.357
Bundle-Name: Apache Felix Http Jetty
Created-By: Apache Maven Bundle Plugin
Bundle-Vendor: The Apache Software Foundation
DynamicImport-Package: org.osgi.service.cm;version=1.2
Build-Jdk: 1.6.0_13
Bundle-Version: 2.2.0
Bnd-LastModified: 1296053619491
Bundle-Activator: org.apache.felix.http.jetty.internal.JettyActivator
Bundle-ManifestVersion: 2
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-Description: Apache Felix is an OSGi implementation.
Bundle-DocURL: http://www.apache.org/
Bundle-SymbolicName: org.apache.felix.http.jetty
Import-Package: javax.net.ssl;resolution:=optional,javax.security.cert
;resolution:=optional,javax.servlet;resolution:=optional;version="2.5
",javax.servlet.http;resolution:=optional;version="2.5",javax.servlet
.jsp.resources;resolution:=optional;version="2.5",javax.servlet.resou
rces;resolution:=optional;version="2.5",javax.xml.parsers;resolution:
=optional,org.apache.felix.http.api;resolution:=optional;version="2.0
",org.osgi.framework;resolution:=optional;version="1.3",org.osgi.serv
ice.http;resolution:=optional;version="1.2",org.osgi.service.log;reso
lution:=optional;version="1.3",org.osgi.util.tracker;resolution:=opti
onal;version="1.3",org.slf4j;resolution:=optional,org.xml.sax;resolut
ion:=optional,org.xml.sax.helpers;resolution:=optional

Manifest org.amdatu.multitenant.org.apache.felix.http.jetty:

Manifest-Version: 1.0
Bnd-LastModified: 1338812262683
Build-Jdk: 1.6.0_32
Built-By: ?
Bundle-Activator: org.amdatu.tenant.adapter.MultiTenantBundleActivator
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.html
Bundle-ManifestVersion: 2
Bundle-Name: Amdatu Web - Multi-Tenant HttpService
Bundle-SymbolicName: org.amdatu.multitenant.org.apache.felix.http.jetty
Bundle-Version: 1.0.0
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: *;scope=compile;inline=true
Embed-Transitive: false
Export-Package: org.apache.felix.http.api;uses:="javax.servlet,org.osgi.
service.http";version="2.0.4",org.osgi.service.http;uses:="javax.servle
t.http,javax.servlet";version="1.2",javax.servlet.resources;version="2.
5",javax.servlet;version="2.5",javax.servlet.jsp.resources;version="2.5
",javax.servlet.http;uses:="javax.servlet";version="2.5"
Import-Package: javax.net.ssl;resolution:=optional,javax.security.cert;r
esolution:=optional,javax.servlet;resolution:=optional;version="2.5",ja
vax.servlet.http;resolution:=optional;uses:="javax.servlet";version="2.
5",javax.servlet.jsp.resources;resolution:=optional;version="2.5",javax
.servlet.resources;resolution:=optional;version="2.5",javax.xml.parsers
;resolution:=optional,org.amdatu.tenant;version="[1.0,2)",org.amdatu.te
nant.adapter;version="[1.0,2)",org.apache.felix.http.api;resolution:=op
tional;uses:="javax.servlet,org.osgi.service.http";version="2.0",org.os
gi.framework;resolution:=optional;version="1.3",org.osgi.service.cm;res
olution:=optional;version="1.2",org.osgi.service.http;resolution:=optio
nal;uses:="javax.servlet.http,javax.servlet";version="1.2",org.osgi.ser
vice.log;resolution:=optional;version="1.3",org.osgi.util.tracker;resol
ution:=optional;version="1.3",org.slf4j;resolution:=optional,org.xml.sa
x;resolution:=optional,org.xml.sax.helpers;resolution:=optional
Tool: Bnd-1.50.0
X-MultiTenant-Binding: PLATFORM
X-MultiTenant-Bundle-Activator: org.apache.felix.http.jetty.internal.Jet
tyActivator
X-MultiTenant-Scope: (&(objectClass=org.osgi.service.log.LogService)(|(o
rg.amdatu.tenant.pid=%TENANTPID%)(!(org.amdatu.tenant.pid=*))))
X-MultiTenant-Version: 1

Whiteboard manifest:

Manifest-Version: 1.0
Bnd-LastModified: 1386080857007
Build-Jdk: 1.7.0_40
Built-By: jawi
Bundle-Activator: org.apache.felix.http.whiteboard.internal.WhiteboardAc
 tivator
Bundle-Description: Apache Felix is an OSGi implementation.
Bundle-DocURL: http://www.apache.org/
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-ManifestVersion: 2
Bundle-Name: Apache Felix Http Whiteboard
Bundle-SymbolicName: org.apache.felix.http.whiteboard
Bundle-Vendor: The Apache Software Foundation
Bundle-Version: 2.2.2
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: org.apache.felix.http.base;inline=org/apache/felix/htt
 p/base/internal/AbstractActivator*.class|org/apache/felix/http/base/int
 ernal/logger/*
Export-Package: org.apache.felix.http.whiteboard;version="1.0"
Implementation-Title: Apache Felix Http Whiteboard
Implementation-Vendor: The Apache Software Foundation
Implementation-Vendor-Id: org.apache.felix
Implementation-Version: 2.2.2
Import-Package: javax.servlet,javax.servlet.http,org.apache.felix.http.a
 pi;version="[2.0,3)",org.osgi.framework;version="[1.5,2)",org.osgi.serv
 ice.http;version="[1.2,2)",org.osgi.service.log;version="[1.3,2)",org.o
 sgi.util.tracker;version="[1.4,2)"
Specification-Title: Apache Felix Http Whiteboard
Specification-Vendor: The Apache Software Foundation
Specification-Version: 2.2.2
Tool: Bnd-1.50.0
4

2 回答 2

1

好的,repositories.bnd 中似乎有一个错误(在我看来)。似乎 amdatu 发布存储库需要在依赖项和快照之上。以下更改解决了该错误:

-plugin:\
aQute.bnd.deployer.repository.LocalIndexedRepo; name=Release;      local=${workspace}/cnf/releaserepo;pretty=true,\
aQute.bnd.deployer.repository.LocalIndexedRepo; name=Local;        local=${workspace}/cnf/localrepo;pretty=true,\
    aQute.bnd.deployer.repository.FixedIndexedRepo; name=Bndtools Hub; locations=https://github.com/bndtools/bundle-hub/raw/master/index.xml.gz,\
    aQute.bnd.deployer.repository.FixedIndexedRepo; name=Amdatu Dependencies; locations=http://repository.amdatu.org/dependencies/index.xml.gz,\
    aQute.bnd.deployer.repository.FixedIndexedRepo; name=Amdatu Snapshots; locations=http://repository.amdatu.org/snapshot/index.xml.gz,\
    aQute.bnd.deployer.repository.FixedIndexedRepo; name=Amdatu Release; locations=http://repository.amdatu.org/release/index.xml.gz,\
    aQute.lib.deployer.FileRepo;                    name=Build;        location=${workspace}/cnf/buildrepo

-releaserepo: Release

.

-plugin:\
    aQute.bnd.deployer.repository.LocalIndexedRepo; name=Release;      local=${workspace}/cnf/releaserepo;pretty=true,\
    aQute.bnd.deployer.repository.LocalIndexedRepo; name=Local;        local=${workspace}/cnf/localrepo;pretty=true,\
    aQute.bnd.deployer.repository.FixedIndexedRepo; name=Bndtools Hub; locations=https://github.com/bndtools/bundle-hub/raw/master/index.xml.gz,\
    aQute.bnd.deployer.repository.FixedIndexedRepo; name=Amdatu Release; locations=http://repository.amdatu.org/release/index.xml.gz,\
    aQute.bnd.deployer.repository.FixedIndexedRepo; name=Amdatu Dependencies; locations=http://repository.amdatu.org/dependencies/index.xml.gz,\
    aQute.bnd.deployer.repository.FixedIndexedRepo; name=Amdatu Snapshots; locations=http://repository.amdatu.org/snapshot/index.xml.gz,\
    aQute.lib.deployer.FileRepo;                    name=Build;        location=${workspace}/cnf/buildrepo

-releaserepo: Release
于 2014-03-31T14:01:55.033 回答
0

这里的问题正在发生,因为javax.servlet可以从资源 org.amdatu.multitenant.org.apache.felix.http.jetty org.amdatu.multitenant.org.apache.felix.http.jetty ver=1.0.0 和 org.apache .felix.http.jetty org.apache.felix.http.jetty ver=2.2.0 所以模块org.apache.felix.http.whiteboard不知道javax.servlet要连接哪个。您可以通过删除重复来解决问题。

于 2014-03-28T16:46:14.703 回答