Re: Silently failing declarative services?
Hello. On 2016-08-01T13:09:57 -0400 Benson Margulieswrote: > Is your @Component set up with immediate=true? > It wasn't. Now it is: g! install service0-provider-declarative/target/service0-provider-declarative-0.1.0.jar Bundle ID: 9 g! start 9 DEBUG: WIRE: [com.io7m.experimental.service0-provider-declarative [9](R 9.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=1.8)) -> [org.apache.felix.framework [0](R 0)] Speaker: constructor Speaker: onActivate Thanks! M pgpylqjZ7rkQK.pgp Description: OpenPGP digital signature
Re: Silently failing declarative services?
Is your @Component set up with immediate=true? On Mon, Aug 1, 2016 at 1:08 PM,wrote: > On 2016-08-01T18:26:33 +0200 > Simon Chemouil
wrote: > > > list+org.apache.fe...@io7m.com a écrit le 01/08/2016 18:16 : > > > I don't see a compiled bundle anywhere, only source code. Is there one > > > available, or do I need to build it? > > > > http://felix.apache.org/downloads.cgi > > > > or straight from Maven Central. > > > > It's also good to have an implementation of Metatype and of the > > LogService when you use Felix SCR, since it will complain (but not fail) > > the former is missing, and uses the latter for logging. > > Thank you. Somehow failed to see that the links on that page were > binaries (was looking at the source jars to the right). > > On adding the declarative services bundle, I ran across the following: > > Caused by: java.lang.ClassNotFoundException: *** Class > 'org.osgi.service.cm.ConfigurationListener' was not found. Bundle > org.apache.felix.scr [7] does not import package 'org.osgi.service.cm', > nor is the package exported by any other bundle or available from the > system class loader. *** > > Some checking online indicated that I needed the configuration admin > bundle. I now have these bundles installed: > > g! lb > START LEVEL 1 >ID|State |Level|Name > 0|Active |0|System Bundle (5.4.0)|5.4.0 > 1|Active |1|Apache Felix Bundle Repository (2.0.6)|2.0.6 > 2|Active |1|Apache Felix Configuration Admin Service > (1.8.10)|1.8.10 > 3|Active |1|Apache Felix Gogo Command (0.16.0)|0.16.0 > 4|Active |1|Apache Felix Gogo Runtime (0.16.2)|0.16.2 > 5|Active |1|Apache Felix Gogo Shell (0.10.0)|0.10.0 > 6|Active |1|Apache Felix Log Service (1.0.1)|1.0.1 > 7|Active |1|Apache Felix Metatype Service (1.1.2)|1.1.2 > 8|Active |1|Apache Felix Declarative Services (2.0.4)|2.0.4 > > However, this hasn't solved the original problem: > > g! install > service0-provider-declarative/target/service0-provider-declarative-0.1.0.jar > Bundle ID: 9 > g! start 9 > DEBUG: WIRE: [com.io7m.experimental.service0-provider-declarative [9](R > 9.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=1.8)) -> > [org.apache.felix.framework [0](R 0)] > g! lb > START LEVEL 1 >ID|State |Level|Name > 0|Active |0|System Bundle (5.4.0)|5.4.0 > 1|Active |1|Apache Felix Bundle Repository (2.0.6)|2.0.6 > 2|Active |1|Apache Felix Configuration Admin Service > (1.8.10)|1.8.10 > 3|Active |1|Apache Felix Gogo Command (0.16.0)|0.16.0 > 4|Active |1|Apache Felix Gogo Runtime (0.16.2)|0.16.2 > 5|Active |1|Apache Felix Gogo Shell (0.10.0)|0.10.0 > 6|Active |1|Apache Felix Log Service (1.0.1)|1.0.1 > 7|Active |1|Apache Felix Metatype Service (1.1.2)|1.1.2 > 8|Active |1|Apache Felix Declarative Services (2.0.4)|2.0.4 > 9|Active |1|service0-provider-declarative (0.1.0)|0.1.0 > > The service0-provider-declarative bundle appears to be running, but none > of the > methods have been called. > > M >
Re: Silently failing declarative services?
On 2016-08-01T18:26:33 +0200 Simon Chemouilwrote: > list+org.apache.fe...@io7m.com a écrit le 01/08/2016 18:16 : > > I don't see a compiled bundle anywhere, only source code. Is there one > > available, or do I need to build it? > > http://felix.apache.org/downloads.cgi > > or straight from Maven Central. > > It's also good to have an implementation of Metatype and of the > LogService when you use Felix SCR, since it will complain (but not fail) > the former is missing, and uses the latter for logging. Thank you. Somehow failed to see that the links on that page were binaries (was looking at the source jars to the right). On adding the declarative services bundle, I ran across the following: Caused by: java.lang.ClassNotFoundException: *** Class 'org.osgi.service.cm.ConfigurationListener' was not found. Bundle org.apache.felix.scr [7] does not import package 'org.osgi.service.cm', nor is the package exported by any other bundle or available from the system class loader. *** Some checking online indicated that I needed the configuration admin bundle. I now have these bundles installed: g! lb START LEVEL 1 ID|State |Level|Name 0|Active |0|System Bundle (5.4.0)|5.4.0 1|Active |1|Apache Felix Bundle Repository (2.0.6)|2.0.6 2|Active |1|Apache Felix Configuration Admin Service (1.8.10)|1.8.10 3|Active |1|Apache Felix Gogo Command (0.16.0)|0.16.0 4|Active |1|Apache Felix Gogo Runtime (0.16.2)|0.16.2 5|Active |1|Apache Felix Gogo Shell (0.10.0)|0.10.0 6|Active |1|Apache Felix Log Service (1.0.1)|1.0.1 7|Active |1|Apache Felix Metatype Service (1.1.2)|1.1.2 8|Active |1|Apache Felix Declarative Services (2.0.4)|2.0.4 However, this hasn't solved the original problem: g! install service0-provider-declarative/target/service0-provider-declarative-0.1.0.jar Bundle ID: 9 g! start 9 DEBUG: WIRE: [com.io7m.experimental.service0-provider-declarative [9](R 9.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=1.8)) -> [org.apache.felix.framework [0](R 0)] g! lb START LEVEL 1 ID|State |Level|Name 0|Active |0|System Bundle (5.4.0)|5.4.0 1|Active |1|Apache Felix Bundle Repository (2.0.6)|2.0.6 2|Active |1|Apache Felix Configuration Admin Service (1.8.10)|1.8.10 3|Active |1|Apache Felix Gogo Command (0.16.0)|0.16.0 4|Active |1|Apache Felix Gogo Runtime (0.16.2)|0.16.2 5|Active |1|Apache Felix Gogo Shell (0.10.0)|0.10.0 6|Active |1|Apache Felix Log Service (1.0.1)|1.0.1 7|Active |1|Apache Felix Metatype Service (1.1.2)|1.1.2 8|Active |1|Apache Felix Declarative Services (2.0.4)|2.0.4 9|Active |1|service0-provider-declarative (0.1.0)|0.1.0 The service0-provider-declarative bundle appears to be running, but none of the methods have been called. M pgpML4pv6CmKr.pgp Description: OpenPGP digital signature
Re: Silently failing declarative services?
list+org.apache.fe...@io7m.com a écrit le 01/08/2016 18:16 : > I don't see a compiled bundle anywhere, only source code. Is there one > available, or do I need to build it? http://felix.apache.org/downloads.cgi or straight from Maven Central. It's also good to have an implementation of Metatype and of the LogService when you use Felix SCR, since it will complain (but not fail) the former is missing, and uses the latter for logging. HTH, Simon - To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org
Re: Silently failing declarative services?
Hello. On 2016-08-01T17:32:54 +0200 Frank Lyaruuwrote: > I think you need a bundle providing the SCR runtime: > > http://felix.apache.org/documentation/subprojects/apache-felix-service-component-runtime.html > > Without a DS implementation it simple won't do anything. > > regards, Frank > Ah, makes sense. Didn't realise that the 5.4.0 distribution didn't contain one. I don't see a compiled bundle anywhere, only source code. Is there one available, or do I need to build it? M pgp5FYkxWACif.pgp Description: OpenPGP digital signature
Re: Silently failing declarative services?
I think you need a bundle providing the SCR runtime: http://felix.apache.org/documentation/subprojects/apache-felix-service-component-runtime.html Without a DS implementation it simple won't do anything. regards, Frank On Mon, Aug 1, 2016 at 5:29 PM, <list+org.apache.fe...@io7m.com> wrote: > Hello. > > I'm learning to use OSGi and am using Felix as the container. I have a > trivial Maven project that implements a simple service. There are two > implementations: One using the old style BundleActivator interface and > the other using modern declarative service annotations. > > API module: > > > https://github.com/io7m/osgitest-20160801/blob/master/service0-api/src/main/java/com/io7m/service0/api/SpeakerType.java > > https://github.com/io7m/osgitest-20160801/blob/master/service0-api/pom.xml > > Old-style BundleActivator-based service: > > > https://github.com/io7m/osgitest-20160801/blob/master/service0-provider-imperative/src/main/java/com/io7m/service0/provider_imperative/Speaker.java > > https://github.com/io7m/osgitest-20160801/blob/master/service0-provider-imperative/pom.xml > > New declarative style service: > > > https://github.com/io7m/osgitest-20160801/blob/master/service0-provider-declarative/src/main/java/com/io7m/service0/provider_declarative/Speaker.java > > https://github.com/io7m/osgitest-20160801/blob/master/service0-provider-declarative/pom.xml > > The manifest created by compiling the "imperative" module looks correct > (the text wrapping is actually present in the manifest): > > --8<-- > Manifest-Version: 1.0 > Bnd-LastModified: 1470064469312 > Build-Jdk: 1.8.0_92 > Built-By: someone > Bundle-Activator: com.io7m.service0.provider_imperative.Speaker > Bundle-License: http://io7m.com/license/isc.txt > Bundle-ManifestVersion: 2 > Bundle-Name: service0-provider-imperative > Bundle-SymbolicName: com.io7m.experimental.service0-provider-imperative > Bundle-Version: 0.1.0 > Created-By: Apache Maven Bundle Plugin > Export-Package: com.io7m.service0.provider_imperative;uses:="com.io7m.se > rvice0.api,org.osgi.framework";version="0.1.0",com.io7m.service0.api;ve > rsion="0.1.0" > Import-Package: com.io7m.service0.api;version="[0.1,0.2)",org.osgi.frame > work;version="[1.8,2)" > Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" > Tool: Bnd-3.2.0.201605172007 > -->8-- > > When the bundle is installed and started in Felix, I get the expected > messages on stdout: > > g! install > service0-provider-imperative/target/service0-provider-imperative-0.1.0.jar > Bundle ID: 5 > g! start 5 > DEBUG: WIRE: [com.io7m.experimental.service0-provider-imperative > [5](R5.0)] > osgi.wiring.package;(&(osgi.wiring.package=org.osgi.framework)(version>=1.8.0)(!(version>=2.0.0))) > -> [org.apache.felix.framework [0](R 0)] > DEBUG: WIRE: [com.io7m.experimental.service0-provider-imperative [5](R > 5.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=1.8)) -> > [org.apache.felix.framework [0](R 0)] Speaker: constructor > Speaker: start org.apache.felix.framework.BundleContextImpl@3870e6b0 > > The manifest created by compiling the "declarative" module looks correct: > > --8<-- > Manifest-Version: 1.0 > Bnd-LastModified: 1470064469068 > Build-Jdk: 1.8.0_92 > Built-By: someone > Bundle-License: http://io7m.com/license/isc.txt > Bundle-ManifestVersion: 2 > Bundle-Name: service0-provider-declarative > Bundle-SymbolicName: com.io7m.experimental.service0-provider-declarative > Bundle-Version: 0.1.0 > Created-By: Apache Maven Bundle Plugin > Export-Package: com.io7m.service0.provider_declarative;uses:="com.io7m.s > ervice0.api";version="0.1.0",com.io7m.service0.api;version="0.1.0" > Import-Package: com.io7m.service0.api;version="[0.1,0.2)" > Provide-Capability: osgi.service;objectClass:List="com.io7m.serv > ice0.api.SpeakerType" > Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" > Service-Component: OSGI-INF/com.io7m.service0.provider_declarative.Speak > er.xml > Tool: Bnd-3.2.0.201605172007 > -->8-- > > The OSGI-INF/com.io7m.service0.provider_declarative.Speaker.xml descriptor > inserted into the jar by the Maven plugin looks correct to me: > > --8<-- > > http://www.osgi.org/xmlns/scr/v1.1.0; > name="com.io7m.service0.provider_declarative.Speaker" activate="onActivate"> > > > > > > -->8-- > > However, when installing and starting the bundle, I get nothing: > > g! install > service0-provider-declarative/target/service0-provider-declarative-0
Silently failing declarative services?
Hello. I'm learning to use OSGi and am using Felix as the container. I have a trivial Maven project that implements a simple service. There are two implementations: One using the old style BundleActivator interface and the other using modern declarative service annotations. API module: https://github.com/io7m/osgitest-20160801/blob/master/service0-api/src/main/java/com/io7m/service0/api/SpeakerType.java https://github.com/io7m/osgitest-20160801/blob/master/service0-api/pom.xml Old-style BundleActivator-based service: https://github.com/io7m/osgitest-20160801/blob/master/service0-provider-imperative/src/main/java/com/io7m/service0/provider_imperative/Speaker.java https://github.com/io7m/osgitest-20160801/blob/master/service0-provider-imperative/pom.xml New declarative style service: https://github.com/io7m/osgitest-20160801/blob/master/service0-provider-declarative/src/main/java/com/io7m/service0/provider_declarative/Speaker.java https://github.com/io7m/osgitest-20160801/blob/master/service0-provider-declarative/pom.xml The manifest created by compiling the "imperative" module looks correct (the text wrapping is actually present in the manifest): --8<-- Manifest-Version: 1.0 Bnd-LastModified: 1470064469312 Build-Jdk: 1.8.0_92 Built-By: someone Bundle-Activator: com.io7m.service0.provider_imperative.Speaker Bundle-License: http://io7m.com/license/isc.txt Bundle-ManifestVersion: 2 Bundle-Name: service0-provider-imperative Bundle-SymbolicName: com.io7m.experimental.service0-provider-imperative Bundle-Version: 0.1.0 Created-By: Apache Maven Bundle Plugin Export-Package: com.io7m.service0.provider_imperative;uses:="com.io7m.se rvice0.api,org.osgi.framework";version="0.1.0",com.io7m.service0.api;ve rsion="0.1.0" Import-Package: com.io7m.service0.api;version="[0.1,0.2)",org.osgi.frame work;version="[1.8,2)" Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Tool: Bnd-3.2.0.201605172007 -->8-- When the bundle is installed and started in Felix, I get the expected messages on stdout: g! install service0-provider-imperative/target/service0-provider-imperative-0.1.0.jar Bundle ID: 5 g! start 5 DEBUG: WIRE: [com.io7m.experimental.service0-provider-imperative [5](R5.0)] osgi.wiring.package;(&(osgi.wiring.package=org.osgi.framework)(version>=1.8.0)(!(version>=2.0.0))) -> [org.apache.felix.framework [0](R 0)] DEBUG: WIRE: [com.io7m.experimental.service0-provider-imperative [5](R 5.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=1.8)) -> [org.apache.felix.framework [0](R 0)] Speaker: constructor Speaker: start org.apache.felix.framework.BundleContextImpl@3870e6b0 The manifest created by compiling the "declarative" module looks correct: --8<-- Manifest-Version: 1.0 Bnd-LastModified: 1470064469068 Build-Jdk: 1.8.0_92 Built-By: someone Bundle-License: http://io7m.com/license/isc.txt Bundle-ManifestVersion: 2 Bundle-Name: service0-provider-declarative Bundle-SymbolicName: com.io7m.experimental.service0-provider-declarative Bundle-Version: 0.1.0 Created-By: Apache Maven Bundle Plugin Export-Package: com.io7m.service0.provider_declarative;uses:="com.io7m.s ervice0.api";version="0.1.0",com.io7m.service0.api;version="0.1.0" Import-Package: com.io7m.service0.api;version="[0.1,0.2)" Provide-Capability: osgi.service;objectClass:List="com.io7m.serv ice0.api.SpeakerType" Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Service-Component: OSGI-INF/com.io7m.service0.provider_declarative.Speak er.xml Tool: Bnd-3.2.0.201605172007 -->8-- The OSGI-INF/com.io7m.service0.provider_declarative.Speaker.xml descriptor inserted into the jar by the Maven plugin looks correct to me: --8<-- http://www.osgi.org/xmlns/scr/v1.1.0; name="com.io7m.service0.provider_declarative.Speaker" activate="onActivate"> -->8-- However, when installing and starting the bundle, I get nothing: g! install service0-provider-declarative/target/service0-provider-declarative-0.1.0.jar Bundle ID: 5 g! start 5 DEBUG: WIRE: [com.io7m.experimental.service0-provider-declarative [5](R 5.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=1.8)) -> [org.apache.felix.framework [0](R 0)] g! lb START LEVEL 1 ID|State |Level|Name 0|Active |0|System Bundle (5.4.0)|5.4.0 1|Active |1|Apache Felix Bundle Repository (2.0.6)|2.0.6 2|Active |1|Apache Felix Gogo Command (0.16.0)|0.16.0 3|Active |1|Apache Felix Gogo Runtime (0.16.2)|0.16.2 4|Active |1|Apache Felix Gogo Shell (0.10.0)|0.10.0 5|Active |1|service0-provider-declarative (0.1.0)|0.1.0 Am I missing something here? Why are none of the Speaker methods called? M pgpmEviCvPidb.pgp Description: OpenPGP digital signature