如何让 karaf rest 示例工作?

How to get the karaf rest example to work?

我无法让 apache karaf rest 示例正常工作。

我成功地在我的笔记本电脑上安装了 karaf,并在控制台上获得 hello world example application 到 运行。我还设法使用 mvn install.

在 C:\karaf\examples 中编译示例应用程序

作为下一步,我尝试 "install" 通过执行命令 README.md 中讨论的其余示例

feature:repo-add mvn:org.apache.karaf.examples/karaf-rest-example-features/4.2.1-SNAPSHOT/xml

这导致了以下错误消息:

karaf@root()> feature:repo-add mvn:org.apache.karaf.examples/karaf-rest-example-features/4.2.1-SNAPSHOT/xml

Adding feature url mvn:org.apache.karaf.examples/karaf-rest-example-features/4.2.1-SNAPSHOT/xml

Error executing command: Error resolving artifact org.apache.karaf.examples:karaf-rest-example-features:xml:4.2.1-SNAPSHOT: [Could not find artifact org.apache.karaf.examples:karaf-rest-example-features:xml:4.2.1-SNAPSHOT in apache (http://repository.apache.org/content/groups/snapshots-group/), Could not find artifact org.apache.karaf.examples:karaf-rest-example-features:xml:4.2.1-SNAPSHOT in ops4j.sonatype.snapshots.deploy (https://oss.sonatype.org/content/repositories/ops4j-snapshots/)] : mvn:org.apache.karaf.examples/karaf-rest-example-features/4.2.1-SNAPSHOT/xml

请在此处查看错误消息的屏幕截图

问题:如何在 apache karaf 中启动一个简单的休息服务?

(不必完全是示例,我很乐意提供一些可通过 http 访问的 hello world 示例。)

非常感谢您的支持!

Update1:我试图通过直接将它们添加到我的部署目录来安装这些包。尝试启动捆绑包时出现以下错误。我到底错过了什么?

Update2: 我已经安装了所有缺少的要求,但我仍然收到以下错误。对于这些乏味的问题,我感到非常抱歉,但是为什么 org.osgi.service.blueprint 要求仍然缺失,即使捆绑包已明确安装并且 运行ning (id 177)?

因此,要查看捆绑未激活的原因的一些信息,您可以使用 bundle:diag 命令。 从屏幕截图可以看出,您的捆绑包缺少要求 com.fasterxml.jackson.jaxrs.json.

您可以将缺少的库添加到 maven-bundle-plugin<Import-Package> 部分,或者将它们安装到 apache karaf。此命令将直接从 maven repo 安装依赖项:

install -s mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/2.9.7

你也可以从here下载一个bundle文件并手动安装它,把jar放到部署目录

有关详细信息,请参阅 link