Ask Your Question
0

unable to download maven repo from within karaf, possible proxy issue

asked 2014-10-10 10:04:20 -0700

twbowman gravatar image

The following error occurs when I attempt to install odl-mdsal-apidocs:

feature:install odl-mdsal-apidocs Error executing command: Error resolving artifact org.json:json:jar:20080701: Could not transfer artifact org.json:json:jar:20080701 from/to central ( http://repo1.maven.org/maven2/ ): Access denied to: http://repo1.maven.org/maven2/org/json/json/20080701/json-20080701.jar

This is most likely a proxy issue. I can access this file from a browser that has the proxy configured. I have the shell variables "httpproxy" and "httpsproxy" configured when I start ./bin/karaf.
Is there another method to configure proxy while in karaf?

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
1

answered 2014-10-14 04:02:37 -0700

jackryan gravatar image

Hi twbowman,

You are correct. If you want to get karat to work behind proxy. Please see below.

  1. Install maven - On ubuntu/linux it is apt-get install maven
  2. Next, go to your Opendaylight install path

cd /home/user/distribution-karaf-0.2.0-Helium/etc 3. edit the file vi org.ops4j.pax.url.mvn.cfg and add the following org.ops4j.pax.url.mvn.settings=/usr/share/maven/conf/settings.xml (On ubuntu, it is different for other OS) org.ops4j.pax.url.mvn.proxySupport=true     4. Next is to configured maven at /etc/maven/settings.xml to enable proxy <proxy>       <id>optional</id>       <active>true</active>       <protocol>http</protocol>       <username>proxyuser</username>       <password>proxypass</password>       <host>proxyserver.server.com.au</host>       <port>8080</port>       <nonproxyhosts>localhost|127.0.0.1</nonproxyhosts>     </proxy>

save/exit

  1. Now try again to run karat, it should work. Good luck and let me know if this solved your problem. I got DL (helium) running but there extra steps than the above.
edit flag offensive delete publish link more

Comments

Jackryan, Thanks for the reply. This did not work though. I installed maven, changed the config files. Restarted karaf and re-issued the "feature:install" command. Using tcpdump the host is trying to talk directly to the server, not the proxy host. Here is the output from the karaf.log file after the install command. 2014-10-15 16:02:58,085 | WARN | Local user karaf | AetherBasedResolver | 5 - org.ops4j.pax.url.mvn - 1.6.0 | Error resolving artifactorg.json:json:jar:20080701:Could not transfer artifact org.json:json:jar:20080701 from/to central (http://repo1.maven.org/maven2/): Access denied to: http://repo1.maven.org/maven2/org/json/json/20080701/json-20080701.jar org.sonatype.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.json:json:jar:20080701 from/to central (http://repo1.maven.org/maven2/): Access denied to: http://repo1.maven.org/maven2/org/json/json/20080701/json-20080701.jar at org.sonatype.aether.impl.internal.DefaultArtifa

twbowman ( 2014-10-15 13:11:16 -0700 )edit

Hi, Please ensure you have edit org.ops4j.pax.url.mvn.cfg and have these two lines a. org.ops4j.pax.url.mvn.settings=/usr/share/maven/conf/settings.xml b. org.ops4j.pax.url.mvn.proxySupport=true If it still doesn't work, it mean your setting in "a" step is not correct, to find out maven default path run mvn -X or mvn -x Please sure the file settings.xml file permission allow write+read access. Try again.

jackryan ( 2014-10-17 04:33:47 -0700 )edit

I was missing one step. Removing the comment brackets around the proxy statement in the settings.xml file.

twbowman ( 2014-10-28 08:57:24 -0700 )edit
0

answered 2014-10-29 09:30:41 -0700

twbowman gravatar image

JackRyan's solution works, but I found a way that involves less steps and you don't have to install maven. Nor do you need to edit the karaf files.

1) create the file ~/.m2/sessions.xml. This needs to be the home directory that will run karaf. 2) Add these lines:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <proxies> <proxy> <id>optional</id> <active>true</active> <protocol>http</protocol> <host>ip of proxy</host> <port>8080</port> <nonproxyhosts>localhost|127.0.0.1</nonproxyhosts> </proxy> </proxies> </settings>

edit flag offensive delete publish link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Follow
1 follower

Stats

Asked: 2014-10-10 10:04:20 -0700

Seen: 2,723 times

Last updated: Oct 29 '14