apache-felix

Dynamically setting target property in OSGi Reference annotatation

拜拜、爱过 提交于 2020-01-06 02:32:05
问题 After reading an article on Reference target (and corresponding properties), I still don't understand how to retrieve a service, when target is set at runtime (typically target and properties are set at compile time and evaluated by SCR at runtime). Let's say there are three service implementations defining @Property(name="type", value="csv") , @Property(name="type", value="xls") and @Property(name="type", value="pdf") , respectively. And one consumer with: //@Reference(target="(type=%runtime

How can single instance of an OSGI factory configuration be read from Java in CQ

☆樱花仙子☆ 提交于 2020-01-05 10:25:44
问题 I need to read the specific child instance of an OSGi factory configuration. I believe it can't be accessed with the Service PID of the factory configuration so there should be a way to reference the child configuration via Java. Can anyone please help in providing a sample code or a way to do this? 回答1: Below is an example. "WSConnection" is an OSGI config where we can configure multiple configs. and the Helper class will help you pick the one you wanted. "configuration.id" is one of the

error when deploying jersey/helloworld-osgi-webapp on glassfish 3.1.2.2

偶尔善良 提交于 2020-01-05 07:49:09
问题 When trying to deploy the sample jersey war bundle code (helloworld-osgi-webapp on git: https://github.com/jersey/jersey-1.x/tree/master/jersey/samples/helloworld-osgi-webapp) on Glassfish 3.1.2.2, I am getting the following osgi error: remote failure: Error occurred during deployment: Exception while loading the app: org.osgi.framework.BundleException: Unresolved constraint in bundle war-bundle [344]: Unable to resolve 344.0: missing requirement [344.0] osgi.wiring.package; (&(osgi.wiring

Activating an OSGI LogListener before other services?

▼魔方 西西 提交于 2020-01-04 11:41:40
问题 I am writing a OSGI-based desktop application, using Apache Felix, Declarative Services and Maven. It's going to use JavaFX, so I'm using Drombler FX too. In the bundles I develop, I'd like to use an appropriate logging mechanism, and I'm currently trying to make Apache Felix Log work. I have no problem getting a LogService but this is not sufficient to make output appear on the console. The word on the net is that Everit's osgi-loglistener-slf4j will do the job and – sure enough – after osgi

Activating an OSGI LogListener before other services?

回眸只為那壹抹淺笑 提交于 2020-01-04 11:40:05
问题 I am writing a OSGI-based desktop application, using Apache Felix, Declarative Services and Maven. It's going to use JavaFX, so I'm using Drombler FX too. In the bundles I develop, I'd like to use an appropriate logging mechanism, and I'm currently trying to make Apache Felix Log work. I have no problem getting a LogService but this is not sufficient to make output appear on the console. The word on the net is that Everit's osgi-loglistener-slf4j will do the job and – sure enough – after osgi

OSGI bundle dependencies

谁说我不能喝 提交于 2020-01-03 19:43:52
问题 I have created an bundle which relies on SLF4J and as such am using Logback for the OSGI implementation. This all bundles up and installs OK but when I come to start the bundle I get the following exception: org.osgi.framework.BundleException: Unable to resolve com.felix.test [20](R 20.0): missing requirement [com.felix.test [20](R 20.0)] osgi.wiring.package; (osgi.wiring.package=groovy.lang) Unresolved requirements: [[com.felix.test [20](R 20.0)] osgi.wiring.package; (osgi.wiring.package

OSGI bundle dependencies

被刻印的时光 ゝ 提交于 2020-01-03 19:42:10
问题 I have created an bundle which relies on SLF4J and as such am using Logback for the OSGI implementation. This all bundles up and installs OK but when I come to start the bundle I get the following exception: org.osgi.framework.BundleException: Unable to resolve com.felix.test [20](R 20.0): missing requirement [com.felix.test [20](R 20.0)] osgi.wiring.package; (osgi.wiring.package=groovy.lang) Unresolved requirements: [[com.felix.test [20](R 20.0)] osgi.wiring.package; (osgi.wiring.package

OSGi/Felix Declarative Services: How to filter the services to be bound?

依然范特西╮ 提交于 2020-01-03 15:32:17
问题 I am using Apache Felix and its Declarative Services (SCR) to wire the service dependencies between bundles. For example, if I need access to a java.util.Dictionary I can say the following to have SCR provide one: /** * @scr.reference name=properties interface=java.util.Dictionary */ protected void bindProperties(Dictionary d) { } protected void unbindProperties(Dictionary d) { } Now, I have more than one Dictionary service available, and I want to filter them using the "name" service

Classloading issue with OSGi

旧时模样 提交于 2020-01-02 15:13:40
问题 I have use log4j-1.2.17 bundle from Maven repo. I try to do this code in the bundle (my bundle calls to the log4j-1.2.17 bundle) PropertyConfigurator.configure(props()); private static Properties props() { Properties props = new Properties(); props.put("log4j.rootLogger", "INFO, R"); props.put("log4j.appender.R", "org.apache.log4j.DailyRollingFileAppender"); props.put("log4j.appender.R.File", "logs/IhtikaClient.log"); props.put("log4j.appender.R.Append", "true"); props.put("log4j.appender.R

Where to place module-info.java using Java 9?

情到浓时终转凉″ 提交于 2020-01-01 08:38:50
问题 I have an OSGI application and I have around 30 bundles (jar files). Today I decided to see how it works/if it works with Java 9. So I started my application and got WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.apache.felix.framework.util.SecureAction (file:/home/.../jar/org.apache.felix.framework-5.4.0.jar) to method java.net.URLClassLoader.addURL(java.net.URL) WARNING: Please consider reporting this to the maintainers of org.apache