6

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

Chuba
  • 125
  • 6
  • 2
    you should build the bundle of your rest app and then just install in karaf container by adding this bundle to deploy directory. Does it make sense? – Ruslan Dec 04 '18 at 12:22

1 Answers1

3

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

Ruslan
  • 6,090
  • 1
  • 21
  • 36
  • 1
    Ok, i can use the bundle:diag command and i can see that the com.fasterxml.jackson.jaxrs.json requirement is missing. My problem is that i do not understand how to install or include the missing requirement. I read the link you posted for the details but i still have no idea how to import whats missing. – Chuba Dec 04 '18 at 15:16
  • 2
    @Felix Try to download bundle file from [here](https://mvnrepository.com/artifact/com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/2.9.7) and put it to deploy directory. Btw there is a command to install bundles directly from maven like `install -s mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/2.9.7` – Ruslan Dec 04 '18 at 15:26