karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste Onofré ...@nanthrax.net>
Subject Re: Problem using drop-in deploy feature
Date Tue, 04 Jul 2017 06:31:17 GMT
Thanks,

let me take a look.

Regards
JB

On 07/04/2017 08:03 AM, David Leangen wrote:
> 
> Hi JB,
> 
>> The json/xml prefix is when you use resource repository in etc/org.apache.karaf.features.cfg
file.
> 
> 
> Ok, thanks! I guess I don’t need it, then...
> 
> 
>> You mean your Bundle Repository is authenticated, right ?
> 
> Yes, that is correct. I was just able to confirm that this is indeed my problem. I need
to authenticate to the (Nexus) repository that hosts the bundles. (It is/may be different
from where the OBR index is located.)
> 
> Here is more information just in case. :-)
> 
> 
> Here is the feature file:
> 
> <features
>    name="Test"
>    xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
>      <resource-repository>https://username:password@repo.example.org/repository/obr/test/index-1.0.1.xml</resource-repository>
>      <feature name="Test" install="auto">
>          <requirement>my.feature</requirement>
>      </feature>
> </features>
> 
> (Using my patch, I am now able to download and parse this file. I will submit the patch
later.)
> 
> 
> The OBR index file looks like this [edited]:
> 
> 
> <?xml version="1.0" encoding="utf-8"?>
> 	<repository increment="1499036490827" name="bnd" xmlns="http://www.osgi.org/xmlns/repository/v1.0.0">
> 	<resource>
> 		<capability namespace="osgi.identity">
> 			<attribute name="osgi.identity" value="org.example.application.provider"/>
> 			<attribute name="type" value="osgi.bundle"/>
> 			<attribute name="version" type="Version" value="1.0.1"/>
> 		</capability>
> 		<capability namespace="osgi.content">
> 			<attribute name="osgi.content" value="e2e171ffa2a84daab2826d592a2e4ef1d32e5dadc618770ddd34273366cffcd9"/>
> 			<attribute name="url" value="http://repo.example.org/repository/test/org/example/org.example.application.provider/1.0.1/org.example.application.provider-1.0.1.jar"/>
> 			<attribute name="size" type="Long" value="5574"/>
> 			<attribute name="mime" value="application/vnd.osgi.bundle"/>
> 		</capability>
> 		<capability namespace="osgi.wiring.bundle”>
> 			...
> 		</capability>
> 		<capability namespace="osgi.wiring.host”>
> 			...
> 		</capability>
> 		<capability namespace="osgi.wiring.package”>
> 			...
> 		</capability>
> 		<capability namespace=“my.feature">
> 			<attribute name="version" type="Version" value="1.0.1"/>
> 			<attribute name=“my.feature" value="Test"/>
> 		</capability>
> 
> 		…
> 
> 	</resource>
> </repository>
> 
> 
>  From what I gather, it looks like the XML is parsed, and during the resolving process,
but the installation of the feature fails because of this:
> 
> 
> java.io.IOException: Server returned HTTP response code: 401 for URL: http://repo.example.org/repository/test/org/example/org.example.application.provider/1.0.1/org.example.application.provider-1.0.1.jar
>          at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1876)
~[?:?]
>          at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
~[?:?]
>          at java.net.URL.openStream(URL.java:1045) ~[?:?]
>          at org.apache.karaf.features.internal.service.Deployer.getBundleInputStream(Deployer.java:1436)
~[?:?]
>          at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:754)
~[?:?]
>          at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1048)
~[?:?]
>          at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$10(FeaturesServiceImpl.java:976)
~[?:?]
>          at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
>          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[?:?]
>          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[?:?]
>          at java.lang.Thread.run(Thread.java:748) [?:?]
> 
> 
> How can I authenticate to this (Nexus) repository server where the bundle is stored?
> 
> 
> Cheers,
> =David
> 
> 
> 
>> On Jul 4, 2017, at 2:47 PM, Jean-Baptiste Onofré <jb@nanthrax.net> wrote:
>>
>> Hi David,
>>
>> You mean your Bundle Repository is authenticated, right ?
>>
>> The json/xml prefix is when you use resource repository in etc/org.apache.karaf.features.cfg
file.
>>
>> Regards
>> JB
>>
>> On 07/04/2017 07:28 AM, David Leangen wrote:
>>> Hi!
>>> I worked through the code and noticed that it was just a simple matter of the
connection not handing the authentication. I will submit a patch.
>>> However…
>>> More troubling is that the OBR directs to resources that also require authentication…
and I have no idea how to authenticate those! I think that is why my resolution is failing.
>>> Any advice as to how to implement authentication for my repository??
>>> Thanks!
>>> =David
>>>> On Jul 4, 2017, at 5:08 AM, David Leangen <apache@leangen.net> wrote:
>>>>
>>>>
>>>> Hi JB,
>>>>
>>>> I tried prefixing with “xml:”, but that did not help.
>>>>
>>>> Could it be that the “user:pass@“ part of the URL is being ignored?
>>>>
>>>> Today, I will try to step through the code to see what is happening.
>>>>
>>>>
>>>> Cheers,
>>>> =David
>>>>
>>>>
>>>>> On Jul 3, 2017, at 8:35 PM, Jean-Baptiste Onofré <jb@nanthrax.net>
wrote:
>>>>>
>>>>> The resource repository has to be prefixed by json or xml in the URL.
>>>>>
>>>>> Let me find an example.
>>>>>
>>>>> Regards
>>>>> JB
>>>>>
>>>>> On 07/03/2017 12:14 PM, David Leangen wrote:
>>>>>> Hi!
>>>>>> I am trying to follow Guillaume’s advice from this thread:
>>>>>>     http://karaf.922171.n3.nabble.com/Karaf-Feature-vs-OBR-tp4050720p4050762.html
>>>>>> I added a file to the deploy directory with this format:
>>>>>> <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
>>>>>>     <resource-repository>[url to the OBR repo]</resource-repository>
>>>>>>     <feature name="[feature name]" install="auto">
>>>>>>         <requirement>[the requirement]</requirement>
>>>>>>     </feature>
>>>>>> </features>
>>>>>> However, I keep getting a 401 from the repository server for the
resource-repository.
>>>>>> When I curl using exactly the same URL, I get the contents of the
OBR index file with no problem whatsoever.
>>>>>> Any idea what this may be so? I see nothing in the logs other than
this (URL edited):
>>>>>>> 2017-07-03T04:56:09,062 | ERROR | FelixDispatchQueue | FeatureDeploymentListener
       | 24 - org.apache.karaf.deployer.features - 4.1.1 | Unable to install features
>>>>>>> java.lang.RuntimeException: java.io.IOException: Unexpected http
response loading https://user:pass@example.com/obr/index.xml : 401 Unauthorized
>>>>>>> 	at org.apache.karaf.features.internal.repository.UrlLoader.checkAndLoadCache(UrlLoader.java:101)
~[?:?]
>>>>>>> 	at org.apache.karaf.features.internal.repository.XmlRepository.checkAndLoadReferrals(XmlRepository.java:156)
~[?:?]
>>>>>>> 	at org.apache.karaf.features.internal.repository.XmlRepository.checkAndLoadCache(XmlRepository.java:118)
~[?:?]
>>>>>>> 	at org.apache.karaf.features.internal.repository.XmlRepository.getResources(XmlRepository.java:62)
~[?:?]
>>>>>>> 	at org.apache.karaf.features.internal.region.Subsystem.downloadBundles(Subsystem.java:482)
~[?:?]
>>>>>>> 	at org.apache.karaf.features.internal.region.Subsystem.downloadBundles(Subsystem.java:372)
~[?:?]
>>>>>>> 	at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:187)
~[?:?]
>>>>>>> 	at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:285)
~[?:?]
>>>>>>> 	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1170)
~[?:?]
>>>>>>> 	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$0(FeaturesServiceImpl.java:1069)
~[?:?]
>>>>>>> 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[?:?]
>>>>>>> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[?:?]
>>>>>>> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[?:?]
>>>>>>> 	at java.lang.Thread.run(Thread.java:748) [?:?]
>>>>>>> Caused by: java.io.IOException: Unexpected http response loading
https://user:pass@example.com/obr/index.xml : 401 Unauthorized
>>>>>>> 	at org.apache.karaf.features.internal.repository.UrlLoader.checkAndLoadCache(UrlLoader.java:71)
~[?:?]
>>>>>>> 	... 13 more
>>>>>> Cheers,
>>>>>> =David
>>>>>
>>>>> -- 
>>>>> Jean-Baptiste Onofré
>>>>> jbonofre@apache.org
>>>>> http://blog.nanthrax.net
>>>>> Talend - http://www.talend.com
>>>>
>>
>> -- 
>> Jean-Baptiste Onofré
>> jbonofre@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Mime
View raw message