如何在 Karaf 4 中部署 Osgi Compendium Services? [英] How to deploy Osgi Compendium Services in Karaf 4?

查看:28
本文介绍了如何在 Karaf 4 中部署 Osgi Compendium Services?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试部署使用 Compendium 服务的包时出现此错误:

I got this error when I tried to deploy a bundle that uses Compendium service:

Error executing command: Unable to resolve root: missing requirement [root]
...
osgi.wiring.package; filter:="(&(osgi.wiring.package=org.osgi.service.component)(version>=1.1.0)
(!(version>=2.0.0)))"]]

我的包被配置为使用:

<dependency>
    <groupId>org.osgi</groupId>
    <artifactId>org.osgi.compendium</artifactId>
    <version>5.0.0</version>
</dependency>

根据 karaf 4 部门文档.Osgi Compendium 版本是 5.0.0.这是否意味着我需要手动配置 karaf 纲要 jar?是否有任何 karaf 功能包含 Compendium Services?

And acording to karaf 4 depts documenation. Osgi Compendium version is 5.0.0. Does this means that I need to provision to karaf compendium jar manually? is there any karaf feature contain Compendium Services?

推荐答案

纲要和核心 jar 包含 OSGi API.它们只能在构建时使用.不要将这些安装到 OSGi 中.核心 API 均由 OSGi 框架包实现.纲要以及企业 API 包包含太多不同的 API,无法在运行时使用.如果您安装它们,它们可能会因与安装的其他 API 版本发生冲突而导致麻烦.

The compendium and core jars contain the OSGi APIs. They are only to be used at build time. Do not install these into OSGi. The core APIs are all implemented by the OSGi framework bundle. The compendium as well as the enterprise API bundles contain too many different APIs to be useful at runtime. If you install them they can cause trouble by conflicting with other API versions installed.

相反,您需要提供一个实现 API 的包.这个包要么嵌入它实现的 API 包,要么你另外需要安装一个只包含这个 API 包的 API 包.

Instead you need to provide a bundle that implements the API. This bundle then either embeds the API package it implements or you additionally need to install an API bundle that contains only this API package.

如果您需要安装实现声明式服务规范的scr"功能.

In you case you need to install the "scr" feature which implements the declarative services spec.

这篇关于如何在 Karaf 4 中部署 Osgi Compendium Services?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆