Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup a proxy for Apache Karaf

Simple one but unable to find anything solid on google. I am running Karaf and I am behind a proxy. I need to add some features to the container by executing the following command:

features:addurl mvn:org.apache.camel.karaf/apache-camel/2.9.0/xml/features

When I do this I get the following exception:

Could not add Feature Repository:
java.lang.RuntimeException: URL [mvn:org.apache.camel.karaf/apache-camel/2.9.0/xml/features] could not be resolved.

This appears to be a proxy authentication issue. Please note I have added proxy information to Maven and I can download dependencies in Maven. I suspect I need to add some information like http.proxyName or http.Proxyxxx to one of the files in the etc directory of the Karaf installation.

Any ideas out there?

UPDATE: I have found a setting in the org.ops4j.pax.url.mvn.cfg which is

org.ops4j.pax.url.mvn.proxySupport=true 

I have uncommented this but I still cant authenticate. So I suspect I need to set my maven home folder somewhere.

UPDATE 2: Ok very simple thing to do:

In your Apache karaf folder there is a etc folder. Edit the org.ops4j.pax.url.mvn.cfg file. You need to perform two steps for it to work.

  • Point karaf to your maven installation: find the following string in your cfg file org.ops4j.pax.url.mvn.settings uncomment it and add your maven home path i.e. org.ops4j.pax.url.mvn.settings= /maven/conf/settings.xml
  • Tell karaf to use the maven proxy settings: find the following string in your cfg file org.ops4j.pax.url.mvn.proxySupport uncomment it and set it to true if needs be i.e. org.ops4j.pax.url.mvn.proxySupport=true

I restarted Karaf and I can now download/install features. I hope this helps someone someday.

like image 730
Namphibian Avatar asked Mar 29 '12 09:03

Namphibian


People also ask

How do you deploy bundles in Karaf?

To add it to the deploy directory run mvn clean package from the root folder of your project (Where the pom. xml resides). This will generate a jar file in the target folder. Drag and drop it to the deploy from there.

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.

What is Karaf shell?

Overview. Karaf provides a powerful console and a set of commands that can be used to perform various tasks. Commands can be located in the root shell or in a sub-shell. A sub-shell is a group of related commands, like commands related to the OSGi framework or the log system.


Video Answer


2 Answers

So if you follow my post above you will see the two main steps in getting Karaf to work via a proxy. I am not sure if there is anything more to it so I am willing to listen to other answers. But in short edit the org.ops4j.pax.url.mvn.cfg file to point to your maven install and maven proxy settings.

like image 71
Namphibian Avatar answered Sep 19 '22 08:09

Namphibian


If a local maven instance is not available the below configurations will help :

Java proxy settings will resolve this issue:

-Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=80

In my case, i am using Karaf-Wrapper(http://karaf.apache.org/manual/latest-2.3.x/users-guide/wrapper.html) and adding the below settings in etc/KARAF-wrapper.conf worked!!

wrapper.java.additional.10=-Dhttp.proxyHost=127.0.0.1

wrapper.java.additional.11=-Dhttp.proxyPort=80

Note: With this option the web services are also exposed via proxy, so if you want to avoid it, once the purpose is achieved you will have to turn off the proxy.

like image 26
Sanvijaya Avatar answered Sep 20 '22 08:09

Sanvijaya