How do I register a service in OSGi (Apache Felix)?

I have successfully managed to start Apache Felix from code and register an own Bundle. Following relation between OSGI-projects is needed: `[OsgiInterface]` -- provides interfaces. `[OsgiModuleA]` -- (bundle) provides an implementation of those interfaces. *knows `[OsgiInterface]`* `[OsgiUsage]` -- makes use of one or more bundle. *knows `[OsgiInterface]` and `[OsgiModuleA]`* Now I have problems registering a service which implements an interface. I would guess that my entries in `manifest.mf` files are wrong. ##Additional information## It would be very kind, if someone could look at the code in my **[previous question][1]** Let me refer to this question: I tried to create a *third* project **OsgiInterfaces**, which provides an interface `SomeInterface` in the package `interfaces`. This project is known by both **OsgiModuleA** and **OsgiUsage**. **OsgiModuleA:** `manifest.mf` has now an additional value `interfaces` for the entry `Import-Package:`. Furthermore, there is an instance of `SomeInterface` provided to the activator. When the bundle is started, an **`NoClassDefFoundError`** occurs: the interface `SomeInterface` is not known. [1]: https://stackoverflow.com/questions/1887809/how-to-start-and-use-apache-felix-from-code/1891487#1891487 ##EDIT:## Now, that the error is fixed, I can tell, that the most important part was: map.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, "my.interfaces; version=1.0.0"); Without this, I got `ClassCastException`.

以上就是How do I register a service in OSGi (Apache Felix)?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏