How to get the karaf rest example to work?

Chuba :

I am stuck in getting the apache karaf rest example to work.

I successfully managed to install karaf on my laptop and get a hello world example application on the console to run. I also managed to compile the example applications in the C:\karaf\examples using mvn install.

As a next step I tried to "install" the rest-example as discussed in the README.md by executing the command

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

This resulted in the following error message:

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

See here for a screen shot of the error message Screen Shot

Question: how can I get a simple rest service to start in apache karaf?

(does not have to be the example exactly, I would be happy to have some hello world example which is accessible via http.)

Thank you very much for your support!

Update1: I tried to install the bundles by directly adding them to my deploy directory. I am getting the following errors when trying to start up the bundles. What exactly am i missing here?

enter image description here

Update2: I have installed all the missing requirements but i still get the following error. I am very sorry for these tedious questions, but why is the org.osgi.service.blueprint requirement still missing even though the bundle is clearly installed and running (id 177)?

enter image description here

Ruslan :

So to see some info why a bundle isn't active you can use bundle:diag command. As can be seen from screenshot your bundle has missing requirement com.fasterxml.jackson.jaxrs.json.

You can add missing libraries to <Import-Package> section of your maven-bundle-plugin or install these to apache karaf. This command will install dependency directly from maven repo:

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

Also you can download a bundle file from here and install it manually by putting jar to deploy dir

see this link for more info

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=70542&siteId=1