我们在使用bdntools和eclipse的rest应用程序中使用OSGi。我们已经部署了应用程序,一切正常。
我们使用的运行描述符是可以的,但是我们已经将运行需求复制到一个新的运行描述符,现在我们无法解决依赖关系,这是由以下错误引起的:
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.
我们经常遇到这个问题,通常通过创建一个新的运行描述符来解决,但这次不是…
这是一个bug在bndtools还是我们做错了什么?我们也有这样的印象,它可能与多个存储库有关。
编辑:下面是运行描述符和包的清单。
运行描述符:
-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)'
清单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
清单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
白板清单:
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
好的,在repository . bind中似乎有一个bug(在我看来)。似乎amdatu发布库需要在依赖项和快照之上。下面的修改解决了这个bug:
-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
这里发生的问题是因为javax.servlet
可以从资源中获得org.amdatu.multitenant.org.apache. felixhttp.jetty ver=1.0.0和org.apache. felixhttp.jetty org.apache. felixhttp.jetty ver=2.2.0,所以模块org.apache.felix.http.whiteboard
不知道与哪个javax.servlet
连接。您可以通过删除重复来解决这个问题。