Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the karaf rest example to work?

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

like image 451
Chuba Avatar asked Dec 04 '18 12:12

Chuba


People also ask

How does Apache Karaf work?

Remote: Apache Karaf embeds an SSHd server allowing you to use the console remotely. The management layer is also accessible remotely. Security: Apache Karaf provides a complete security framework (based on JAAS), and provides a RBAC (Role-Based Access Control) mechanism for console and JMX access.

How do I install Karaf bundles?

Installing a bundle As displayed in picture below, by issuing the 'bundle:install' command, Apache Karaf tries to install the bundle in its underlying OSGi container and displays its bundle ID in output (your value probably is different from mine).

Is Karaf a OSGi?

Karaf is not an OSGi framework. It's a OSGi runtime environment.


1 Answers

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

like image 74
Ruslan Avatar answered Oct 08 '22 02:10

Ruslan