OSGi bundle export versioning - osgi

I'm pretty new in osgi world, and probably missing something, and i'm having troubles exposing different versions of the same sevice for liferay.
Here is what i am trying to do (and sorry for my english):
I wrote a service, wrapped it in a bundle and successfully deployed it on osgi. My bnd.bnd file looks like this
Bundle-Name: it.peernetwork.lr.pilot.test-services
Bundle-SymbolicName: pilot--test-services
Bundle-Version: 7.1.0
Bundle-Activator: it.peernetwork.lr.pilot.testservices.impl.TestServicesActivator
Export-Package: it.peernetwork.lr.pilot.testservices
and, once packaged, the manifest file is like this
Manifest-Version: 1.0
Bnd-LastModified: 1542646653910
Bundle-Activator: it.peernetwork.lr.pilot.testservices.impl.TestServic
esActivator
Bundle-ClassPath: .,lib/pn--logger-7.1.0.jar,lib/pn--services-base-7.1
.0.jar,lib/pn--prop-files-7.1.0.jar,lib/gson-2.8.5.jar,lib/pn--expand
o-values-7.1.0.jar
Bundle-ManifestVersion: 2
Bundle-Name: it.peernetwork.lr.pilot.test-services
Bundle-SymbolicName: pilot--test-services
Bundle-Version: 7.1.0
Created-By: 1.8.0_191 (Oracle Corporation)
Export-Package: it.peernetwork.lr.pilot.testservices;version="7.1.0"
Import-Package: com.liferay.expando.kernel.exception;version="[1.0,2)"
,com.liferay.expando.kernel.model;version="[1.1,2)",com.liferay.expan
do.kernel.service;version="[1.1,2)",com.liferay.portal.kernel.excepti
on;version="[7.2,8)",com.liferay.portal.kernel.model;version="[2.0,3)
",it.peernetwork.lr.pilot.testservices,org.osgi.framework;version="[1
.8,2)"
Javac-Debug: on
Javac-Deprecation: off
Javac-Encoding: UTF-8
Private-Package: it.peernetwork.lr.pilot.test.services.impl,it.peernet
work.lr.pilot.testservices.impl,it.peernetwork.lr.pilot.testservices.
x,lib,it.peernetwork.lr.logger,it.peernetwork.lr.servicesbase,it.peer
network.lr.propfiles,it.peernetwork.lr.propfiles.utils,com.google.gso
n,com.google.gson.annotations,com.google.gson.internal,com.google.gso
n.internal.bind,com.google.gson.internal.bind.util,com.google.gson.in
ternal.reflect,com.google.gson.reflect,com.google.gson.stream,it.peer
network.lr.expandovalues
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Tool: Bnd-3.2.0.201605172007
This manifest file declares
Export-Package: it.peernetwork.lr.pilot.testservices;version="7.1.0"
and i think this is correct.
Once deployed (successfully) i check the bundle state with the command bundle __BUNDLE_ID__ that gives me
pilot--test-services_7.1.0 [1014]
Id=1014, Status=ACTIVE Data Root=/home/ltrioschi/development/liferay-osgi/liferay-ce-portal-7.1.0-ga1/osgi/state/org.eclipse.osgi/1014/data
"Registered Services"
{it.peernetwork.lr.pilot.testservices.UselessService}={service.id=1607, service.bundleid=1014, service.scope=singleton}
No services in use.
Exported packages
it.peernetwork.lr.pilot.testservices; version="7.1.0"[exported]
Imported packages
com.liferay.expando.kernel.exception; version="1.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]>
com.liferay.expando.kernel.model; version="1.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]>
com.liferay.expando.kernel.service; version="1.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]>
com.liferay.portal.kernel.exception; version="7.2.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]>
com.liferay.portal.kernel.model; version="2.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]>
org.osgi.framework; version="1.8.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]>
No fragment bundles
No required bundles
Then i wrote a portlet that requires this service. The bnd.dnd file is
Bundle-Name: it.peernetwork.lr.pilot.test-portlet
Bundle-SymbolicName: pilot--test-portlet
Bundle-Version: 7.1.0
Import-Package: \
it.peernetwork.lr.pilot.testservices;version=[7.1.0],\
*
-metatype: *
And once deployed it loads correctly the service and uses it with no issues.
Now...my problem is i need a new version of the service, but i do not want to undeploy the current version.
So i wrote the new version of the service and the new bnd.bnd file is
Bundle-Name: it.peernetwork.lr.pilot.test-services
Bundle-SymbolicName: pilot--test-services
Bundle-Version: 7.1.1
Bundle-Activator: it.peernetwork.lr.pilot.testservices.impl.TestServicesActivator
Export-Package: it.peernetwork.lr.pilot.testservices
(the only difference is the Bundle-Version)
Once packaged the only difference in manifest file is the Export-Package line
Export-Package: it.peernetwork.lr.pilot.testservices;version="7.1.1"
and looks like it smoothly deploys on osgi
g! lb pilot
START LEVEL 20
ID|State |Level|Name
1014|Active | 10|it.peernetwork.lr.pilot.test-services (7.1.0)
1015|Active | 10|it.peernetwork.lr.pilot.test-services (7.1.1)
but with the command bundle ___NEW_BUNDLE_ID___ i get
No exported packages
instead of
Exported packages
it.peernetwork.lr.pilot.testservices; version="7.1.1"[exported]
(that i expected). It means (to me) that the bundle is deployed, but none of its services are exposed.
Then i updated my portlets bundle (bnd.bnd) this way
Bundle-Name: it.peernetwork.lr.pilot.test-portlet
Bundle-SymbolicName: pilot--test-portlet
Bundle-Version: 7.1.0
Import-Package: \
it.peernetwork.lr.pilot.testservices;version=[7.1.1],\
*
-metatype: *
(changed version in Import-Package) and deployed on osgi. Deploy was correct, but it still uses the old version of the services bundle (7.1.0) even if Import-Package declares version 7.1.1. It does not give error because of the "missing" requested service version.
Can someone give me some tips about what i am doing wrong?
Thanks in advance.
UPDATE 1
Dependencies in build.gradle file have been updated accordingly with the version specified in bnd.bnd.
UPDATE 2
#quatax
The updated portlet bundle's manifest file has Import-Package: it.peernetwork.lr.pilot.testservices;version="[7.1.1]" (followed by all other required imports)...seems correct to me...
UPDATE 3
#Neil Bartlett (Service version updated to 8.0.0)
I updated pilot--test-services bnd.bnd file setting Bundle-Version: 8.0.0.
The whole bnd.bnd file is
Bundle-Name: it.peernetwork.lr.pilot.test-services
Bundle-SymbolicName: pilot--test-services
Bundle-Version: 8.0.0
Bundle-Activator: it.peernetwork.lr.pilot.testservices.impl.TestServicesActivator
Export-Package: it.peernetwork.lr.pilot.testservices
Manifest file is
Manifest-Version: 1.0
Bnd-LastModified: 1543316524201
Bundle-Activator: it.peernetwork.lr.pilot.testservices.impl.TestServic
esActivator
Bundle-ClassPath: .,lib/pn--logger-7.1.0.jar,lib/pn--services-base-7.1
.0.jar,lib/pn--prop-files-7.1.0.jar,lib/gson-2.8.5.jar,lib/pn--expand
o-values-7.1.0.jar
Bundle-ManifestVersion: 2
Bundle-Name: it.peernetwork.lr.pilot.test-services
Bundle-SymbolicName: pilot--test-services
Bundle-Version: 8.0.0
Created-By: 1.8.0_191 (Oracle Corporation)
Export-Package: it.peernetwork.lr.pilot.testservices;version="8.0.0"
Import-Package: com.liferay.expando.kernel.exception;version="[1.0,2)"
,com.liferay.expando.kernel.model;version="[1.1,2)",com.liferay.expan
do.kernel.service;version="[1.1,2)",com.liferay.portal.kernel.excepti
on;version="[7.2,8)",com.liferay.portal.kernel.model;version="[2.0,3)
",it.peernetwork.lr.pilot.testservices,org.osgi.framework;version="[1
.8,2)"
Javac-Debug: on
Javac-Deprecation: off
Javac-Encoding: UTF-8
Private-Package: it.peernetwork.lr.pilot.test.services.impl,it.peernet
work.lr.pilot.testservices.impl,it.peernetwork.lr.pilot.testservices.
x,lib,it.peernetwork.lr.logger,it.peernetwork.lr.servicesbase,it.peer
network.lr.propfiles,it.peernetwork.lr.propfiles.utils,com.google.gso
n,com.google.gson.annotations,com.google.gson.internal,com.google.gso
n.internal.bind,com.google.gson.internal.bind.util,com.google.gson.in
ternal.reflect,com.google.gson.reflect,com.google.gson.stream,it.peer
network.lr.expandovalues
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Tool: Bnd-3.2.0.201605172007
. When i deploy it it seems ok (starts and status is "Active"), but bundle ___ID___ says No exported packages
Then i updated pilot--test-portlet's build.gradle setting the correct version of the dependency (8.0.0). It's manifes file says Import-Package: it.peernetwork.lr.pilot.testservices;version="[8.0,9). When i deploy this package it does not start (status "Installed" and error Unresolved requirement: Import-Package: it.peernetwork.lr.pilot.testservices; version="[8.0.0,9.0.0)")
UPDATE 4 -- -- RESOLVED
Thank you very much #Neil. Thanks to your tips i solved my issue. The right advice was this.
Explicitally declaring
Import-Package: it.peernetwork.lr.pilot.testservices;version="[7.2,8)",\
*
in the pilot--test-services's bnd.bnd file (self import, with the opportune version range) makes osgi export correctly the package and loads the correct class instances when required.
The complete bnd.bnd file is
Bundle-Name: it.peernetwork.lr.pilot.test-services
Bundle-SymbolicName: pilot--test-services
Bundle-Version: 7.2.0
Bundle-Activator: it.peernetwork.lr.pilot.testservices.impl.TestServicesActivator
Export-Package: it.peernetwork.lr.pilot.testservices
Import-Package: it.peernetwork.lr.pilot.testservices;version="[7.2,8)",\
*
In pilot--test-portlet's build.gradle file i only had to update the dependency version
compileOnly group: "it.peernetwork.lr", name: "pilot--test-services", version: "7.2.0"
I tried with version 7.1.0, 7.2.0 and 8.0.0 and works smoothly. All "services" bundles are deployed on osgi. Deploying the portlet bundle with different dependency versions always takes the right service.
Thank you again.

I recommend deleting the Import-Package instruction from your bnd.bnd file for the pilot--test-portlet bundle. It is not necessary: bnd will generate all the imports you need based on the actual requirements in your code.
Your original bundle pilot--test-services both exports and imports the package it.peernetwork.lr.pilot.testservices. This is correct when your bundle makes use of the package itself in addition to exporting it. Therefore when you install both v7.1.0 and v7.1.1, the v7.1.0 bundle will import the package from the other version instead of exporting the older version. The pilot--test-portlet correctly imports from version 7.1.1.
In other words, everything here is working the way it should.

Related

Eclipse application not loading required bundle

I have an Eclipse RCP-based application that has a dependency on a bundle that requires sun.misc. At start time, it is not resolved because it can't find the package:
id State Bundle
150 INSTALLED org.diirt.support.diirt-pva_3.1.6.20170118092719
osgi> start 150
gogo: BundleException: Could not resolve module: org.diirt.support.diirt-pva [150]
Unresolved requirement: Import-Package: org.epics.pvaccess; version="[4.1.0,5.0.0)"
-> Export-Package: org.epics.pvaccess; bundle-symbolic-name="org.epics.pvAccessJava"; bundle-version="4.1.3"; version="4.1.3"; uses:="org.epics.pvdata.pv"
org.epics.pvAccessJava [307]
Unresolved requirement: Import-Package: sun.misc
Meanwhile in the built product's plugins directory is com.diffplug.osgi.extension.sun.misc_0.0.0.jar. This provides the package sun.misc:
Manifest-Version: 1.0
Export-Package: sun.misc
Fragment-Host: system.bundle; extension:=framework
Bundle-ManifestVersion: 2
Bundle-License: public domain - http://unlicense.org/
Bundle-SymbolicName: com.diffplug.osgi.extension.sun.misc
Bundle-Version: 0.0.0
However, this is not loaded when the application starts:
osgi> ss diff
"Framework is launched."
id State Bundle
Why is this required bundle not loaded?
Incidentally, this plugin is required in a feature that is included in the product.
As far as I can tell, sun.misc should be resolvable in com.diffplug.osgi:com.diffplug.osgi.extension.sun.misc:0.0.0
Perhaps you could try adding this to your project?

Apache felix osgi unable to export package

I have below set up in manifest.mf file,
Manifest-Version: 1.0
Bnd-LastModified: 1359719312904
Bundle-Activator: org.amdatu.mongo.impl.Activator
Bundle-ManifestVersion: 2
Bundle-Name: org.amdatu.mongo
Bundle-SymbolicName: org.amdatu.mongo
Bundle-Version: 1.0.4
Created-By: 1.7.0_09 (Oracle Corporation)
Export-Package: org.amdatu.mongo;uses:="com.mongodb";version="1.0"
Import-Package: com.mongodb,org.amdatu.mongo;version="[1.0,2)",org.apach
e.felix.dm;version="[3.0,4)",org.osgi.framework;version="[1.5,2)",org.o
sgi.service.cm;version="[1.3,2)",org.osgi.service.log;version="[1.3,2)"
Private-Package: org.amdatu.mongo.impl
Tool: Bnd-1.51.0
When I install this bundle I am not getting org.amdatu.mongo package in export list in apache felix?
Please check the image below ...my bundle is in active plus running state.Still I am not able to see export package??
I have no package with ID 508 from which this bundle importing the org.amdatu.mongo
I have search in web console and I got only one bundle.Please check the image below,
The problem is not that Felix is unable to export the package. It just doesn't need to.
You have listed the package org.amdatu.mongo as both an export and an import. This gives the OSGi Framework a choice: import it if there is an another bundle already exporting it; otherwise, export it.
So in other words you are seeing normal, correct behaviour.

OSGi companion bundle needed?

I have two different projects in Eclipse based on Bndtools.
The first produces a JAR with following manifest :
Manifest-Version: 1.0
Bnd-LastModified: 1450251340248
Bundle-Activator: org.osgi.tutorial.MessageCounterActivator3
Bundle-ManifestVersion: 2
Bundle-Name: org.osgi.tutorial
Bundle-SymbolicName: org.osgi.tutorial
Bundle-Version: 0.0.0.201512160735
Created-By: 1.8.0_66 (Oracle Corporation)
Import-Package: org.osgi.book.reader.api,org.osgi.framework;version="[1.3,2)",org.osgi.util.tracker;version="[1.4,2)"
Private-Package: org.osgi.tutorial
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Tool: Bnd-3.0.0.201509101326
the second has the following manifest :
Manifest-Version: 1.0
Bnd-LastModified: 1450536025075
Bundle-Activator: org.osgi.book.configadmin.ServerConnectionActivator
Bundle-ManifestVersion: 2
Bundle-Name: org.osgi.book.configadmin
Bundle-SymbolicName: org.osgi.book.configadmin
Bundle-Version: 0.0.0.201512191440
Created-By: 1.8.0_66 (Oracle Corporation)
Import-Package: org.osgi.framework;version="[1.3,2)",org.osgi.service.cm;version="[1.3,2)"
Private-Package: org.osgi.book.configadmin;version="1.0.0"
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Tool: Bnd-3.0.0.201509101326
The two projects need the osgi.cmpn : the first for ServiceTracker (package org.osgi.util.tracker) and the second for ManagedService (package org.osgi.service.cm).
The first project works great : I install and start the bundle without problems.
I can install the bundle from the second project but when I start it I receive the following error :
org.osgi.framework.BundleException: Unresolved constraint in bundle org.osgi.book.configadmin [6]: Unable to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.service.cm)(version>=1.3.0)(!(version>=2.0.0)))
What's the problem ? If both the project need osgi.cmpn JAR ... why the first doesn't throw this error on starting ?
Thanks,
Paolo.
See this question. Never deploy the compendium jar in OSGi. Instead you need a bundle that implements the spec you depend on.
In your case you need a config admin service impl. There are implementations from felix and from eclipse. Both contain the api.

OSGi two dependency chains - cannot resolve dependencies

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
OK, there seems to be a bug (in my opinion) in the repositories.bnd. It seems that the amdatu release repository needs to be above dependencies and snapshots.. The following changes solved the 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
The problem here is happening because the javax.servlet is available 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 so the module org.apache.felix.http.whiteboard does not know which javax.servlet to wire with. you could solve the problem by removing the duplication.

Virgo Osgi Web Bundle - Web-Fragment

My problem is web-fragment bundle is not working.
I have two projects:
One where I create a web bundle with Virgo Server with this manifest.mf:
Manifest-Version: 1.0
Bnd-LastModified: 1381358185168
Build-Jdk: 1.6.0_37
Built-By: juliocesarreymendez
Bundle-ClassPath: .,WEB-INF/classes,WEB-INF/lib/commons-lang-2.6.jar
Bundle-Description: http://localhost:8090/system/console/bundles
Bundle-ManifestVersion: 2
Bundle-Name: first-maven-virgo-project
Bundle-SymbolicName: first-maven-virgo-project
Bundle-Version: 1.0.0
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: *;scope=compile|runtime;
Embed-Directory: WEB-INF/lib
Embed-Transitive: true
Embedded-Artifacts: WEB-INF/lib/commons-lang-2.6.jar;g="commons-lang";a=
"commons-lang";v="2.6"
Export-Package: com.roshka.virgo.web;uses:="javax.servlet,javax.servlet.
annotation,javax.servlet.http";version="1.0.0"
Import-Package: javax.servlet,javax.servlet.annotation,javax.servlet.htt
p
Tool: Bnd-2.1.0.20130426-122213
Web-ContextPath: /hello
The project deployment on virgo server works find. I can even test it on localhost:8080/hello.
However, when I create another bundle project (Web Fragment) with this manifest.mf:
Manifest-Version: 1.0
Bnd-LastModified: 1381357367000
Build-Jdk: 1.6.0_37
Built-By: juliocesarreymendez
Bundle-ClassPath: .,commons-lang-2.6.jar
Bundle-Description: http://localhost:8090/system/console/bundles
Bundle-ManifestVersion: 2
Bundle-Name: first-bundle-par
Bundle-SymbolicName: first-bundle-par
Bundle-Version: 1.0.0
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: *;scope=compile|runtime;
Embed-Directory: .
Embed-Transitive: true
Embedded-Artifacts: commons-lang-2.6.jar;g="commons-lang";a="commons-lan
g";v="2.6"
Export-Package: com.roshka.servlet2;version="1.0.0";uses:="javax.servlet
,javax.servlet.annotation,javax.servlet.http"
Fragment-Host: first-maven-virgo-project
Import-Package: javax.servlet,javax.servlet.annotation,javax.servlet.htt
p
Tool: Bnd-2.1.0.20130426-122213
Deployment works, but has no binding with /hello context path or first-maven-virgo-project web bundle.
What's wrong in my project? Does Virgo support Web-Fragment OSGI?
Thanks.
Make sure you are deploying your file with a jar extension and not a war extension.

Resources