You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Alex Soto <al...@envieta.com> on 2016/09/09 13:42:38 UTC

features.xml and classpath URL handler

Hello,  

I am trying to deploy a config file which is a resource of one of the deployed bundles.  I write the features.xml

<configfile finalname="${karaf.etc}/my.config.cfg">
	classpath://my :: bundle/my.config.cfg
</configfile>


When I run integration tests (PAX-EXAM) I get this error:

Error installing boot features
java.net.MalformedURLException: Unknown protocol: classpath
	at java.net.URL.<init>(URL.java:620)[:1.8.0_45]
	at java.net.URL.<init>(URL.java:483)[:1.8.0_45]
	at java.net.URL.<init>(URL.java:432)[:1.8.0_45]
	at org.apache.karaf.features.internal.service.FeatureConfigInstaller.installConfigurationFile(FeatureConfigInstaller.java:210)[9:org.apache.karaf.features.core:4.0.3]
	at org.apache.karaf.features.internal.service.FeatureConfigInstaller.installFeatureConfigs(FeatureConfigInstaller.java:120)[9:org.apache.karaf.features.core:4.0.3]
	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:1156)[9:org.apache.karaf.features.core:4.0.3]
	at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:769)[9:org.apache.karaf.features.core:4.0.3]
	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1079)[9:org.apache.karaf.features.core:4.0.3]
	at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:975)[9:org.apache.karaf.features.core:4.0.3]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_45]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_45]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_45]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_45]
Caused by: java.lang.IllegalStateException: Unknown protocol: classpath
	at org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:373)[org.apache.felix.framework-5.4.0.jar:]
	at java.net.URL.<init>(URL.java:615)[:1.8.0_45]
	... 12 more

Looks it does not recognize the classpath URL handler.  How can make this work?   I would like the cfg files to be in the bundle that uses it. 

Best regards,
Alex soto





Re: features.xml and classpath URL handler

Posted by Alex Soto <al...@envieta.com>.
Added Jira ticket:

https://issues.apache.org/jira/browse/KARAF-4707 <https://issues.apache.org/jira/browse/KARAF-4707>


Thanks,
Alex soto



> On Sep 11, 2016, at 1:23 AM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> 
> Good idea.
> 
> Can you create a Jira about that ?
> 
> Thanks,
> Regards
> JB
> 
> On 09/10/2016 08:43 PM, Oliver Lietz wrote:
>> On Friday 09 September 2016 15:04:16 Alex Soto wrote:
>>> Thank you!  This worked now:
>>> 
>>> 	<feature name="pax-url-handler">
>>> 		<bundle>mvn:org.ops4j.base/ops4j-base-util-property/1.5.0</bundle>
>>>        	<bundle>mvn:org.ops4j.base/ops4j-base-lang/1.5.0</bundle>
>>> 	
>>> 	<bundle>mvn:org.ops4j.pax.swissbox/pax-swissbox-property/1.8.2</bundle>
>>> <bundle>mvn:org.ops4j.pax.url/pax-url-commons/2.4.7</bundle>
>>> <bundle>mvn:org.ops4j.pax.url/pax-url-classpath/2.4.7</bundle> </feature>
>>> 
>>>    	<feature name=‘my-feature' version='${project.version}'>
>>> 
>>>    		<feature prerequisite="true">pax-url-handler</feature>
>>> 
>>> 		<configfile finalname="${karaf.etc}/my.config.cfg">
>>> 			classpath:my.config.cfg
>>> 		</configfile>
>>> 
>>> 
>>> So the config file is now correctly read from the class path.  I think it
>>> can be argued that deploying config files from the class path is the most
>>> common scenario, so it may be useful to have the classpath URL handler
>>> already preloaded as part of standard Karaf, otherwise the ability to
>>> deploy from a resource becomes very obscure.  Even more obscure, given that
>>> there are not examples on how to do this.
>> 
>> At least having a feature in Karaf for pax-url-classpath (like we have for
>> wrap) would be nice.
>> 
>> Regards,
>> O.
>> 
>>> Thanks and best regards,
>>> Alex soto
>> [...]
>> 
> 
> -- 
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com


Re: features.xml and classpath URL handler

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Good idea.

Can you create a Jira about that ?

Thanks,
Regards
JB

On 09/10/2016 08:43 PM, Oliver Lietz wrote:
> On Friday 09 September 2016 15:04:16 Alex Soto wrote:
>> Thank you!  This worked now:
>>
>> 	<feature name="pax-url-handler">
>> 		<bundle>mvn:org.ops4j.base/ops4j-base-util-property/1.5.0</bundle>
>>         	<bundle>mvn:org.ops4j.base/ops4j-base-lang/1.5.0</bundle>
>> 	
>> 	<bundle>mvn:org.ops4j.pax.swissbox/pax-swissbox-property/1.8.2</bundle>
>> <bundle>mvn:org.ops4j.pax.url/pax-url-commons/2.4.7</bundle>
>> <bundle>mvn:org.ops4j.pax.url/pax-url-classpath/2.4.7</bundle> </feature>
>>
>>     	<feature name=\u2018my-feature' version='${project.version}'>
>>
>>     		<feature prerequisite="true">pax-url-handler</feature>
>>
>>  		<configfile finalname="${karaf.etc}/my.config.cfg">
>> 			classpath:my.config.cfg
>> 		</configfile>
>>
>>
>> So the config file is now correctly read from the class path.  I think it
>> can be argued that deploying config files from the class path is the most
>> common scenario, so it may be useful to have the classpath URL handler
>> already preloaded as part of standard Karaf, otherwise the ability to
>> deploy from a resource becomes very obscure.  Even more obscure, given that
>> there are not examples on how to do this.
>
> At least having a feature in Karaf for pax-url-classpath (like we have for
> wrap) would be nice.
>
> Regards,
> O.
>
>> Thanks and best regards,
>> Alex soto
> [...]
>

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

Re: features.xml and classpath URL handler

Posted by Guillaume Nodet <gn...@apache.org>.
2016-09-10 20:43 GMT+02:00 Oliver Lietz <ap...@oliverlietz.de>:

> On Friday 09 September 2016 15:04:16 Alex Soto wrote:
> > Thank you!  This worked now:
> >
> >       <feature name="pax-url-handler">
> >               <bundle>mvn:org.ops4j.base/ops4j-base-util-property/1.5.
> 0</bundle>
> >               <bundle>mvn:org.ops4j.base/ops4j-base-lang/1.5.0</bundle>
> >
> >       <bundle>mvn:org.ops4j.pax.swissbox/pax-swissbox-
> property/1.8.2</bundle>
> > <bundle>mvn:org.ops4j.pax.url/pax-url-commons/2.4.7</bundle>
> > <bundle>mvn:org.ops4j.pax.url/pax-url-classpath/2.4.7</bundle>
> </feature>
> >
> >       <feature name=‘my-feature' version='${project.version}'>
> >
> >               <feature prerequisite="true">pax-url-handler</feature>
> >
> >               <configfile finalname="${karaf.etc}/my.config.cfg">
> >                       classpath:my.config.cfg
> >               </configfile>
> >
> >
> > So the config file is now correctly read from the class path.  I think it
> > can be argued that deploying config files from the class path is the most
> > common scenario, so it may be useful to have the classpath URL handler
> > already preloaded as part of standard Karaf, otherwise the ability to
> > deploy from a resource becomes very obscure.  Even more obscure, given
> that
> > there are not examples on how to do this.
>
> At least having a feature in Karaf for pax-url-classpath (like we have for
> wrap) would be nice.
>

Agreed.  Maybe raise a JIRA and attach a patch ?


>
> Regards,
> O.
>
> > Thanks and best regards,
> > Alex soto
> [...]
>
>


-- 
------------------------
Guillaume Nodet
------------------------
Red Hat, Open Source Integration

Email: gnodet@redhat.com
Web: http://fusesource.com
Blog: http://gnodet.blogspot.com/

Re: features.xml and classpath URL handler

Posted by Oliver Lietz <ap...@oliverlietz.de>.
On Friday 09 September 2016 15:04:16 Alex Soto wrote:
> Thank you!  This worked now:
> 
> 	<feature name="pax-url-handler">
> 		<bundle>mvn:org.ops4j.base/ops4j-base-util-property/1.5.0</bundle>
>         	<bundle>mvn:org.ops4j.base/ops4j-base-lang/1.5.0</bundle>
> 	   
> 	<bundle>mvn:org.ops4j.pax.swissbox/pax-swissbox-property/1.8.2</bundle>
> <bundle>mvn:org.ops4j.pax.url/pax-url-commons/2.4.7</bundle>
> <bundle>mvn:org.ops4j.pax.url/pax-url-classpath/2.4.7</bundle> </feature>
> 
>     	<feature name=‘my-feature' version='${project.version}'>
> 
>     		<feature prerequisite="true">pax-url-handler</feature>
> 
>  		<configfile finalname="${karaf.etc}/my.config.cfg">
> 			classpath:my.config.cfg
> 		</configfile>
> 
> 
> So the config file is now correctly read from the class path.  I think it
> can be argued that deploying config files from the class path is the most
> common scenario, so it may be useful to have the classpath URL handler
> already preloaded as part of standard Karaf, otherwise the ability to
> deploy from a resource becomes very obscure.  Even more obscure, given that
> there are not examples on how to do this.

At least having a feature in Karaf for pax-url-classpath (like we have for 
wrap) would be nice.

Regards,
O.

> Thanks and best regards,
> Alex soto
[...]


Re: features.xml and classpath URL handler

Posted by Alex Soto <al...@envieta.com>.
Thank you!  This worked now:

	<feature name="pax-url-handler">
		<bundle>mvn:org.ops4j.base/ops4j-base-util-property/1.5.0</bundle>
        	<bundle>mvn:org.ops4j.base/ops4j-base-lang/1.5.0</bundle>
	    	<bundle>mvn:org.ops4j.pax.swissbox/pax-swissbox-property/1.8.2</bundle>
        	<bundle>mvn:org.ops4j.pax.url/pax-url-commons/2.4.7</bundle>
        	<bundle>mvn:org.ops4j.pax.url/pax-url-classpath/2.4.7</bundle>
	</feature>

    	<feature name=‘my-feature' version='${project.version}'>
    	
    		<feature prerequisite="true">pax-url-handler</feature>

 		<configfile finalname="${karaf.etc}/my.config.cfg">
			classpath:my.config.cfg
		</configfile>


So the config file is now correctly read from the class path.  I think it can be argued that deploying config files from the class path is the most common scenario, so it may be useful to have the classpath URL handler already preloaded as part of standard Karaf, otherwise the ability to deploy from a resource becomes very obscure.  Even more obscure, given that there are not examples on how to do this. 

Thanks and best regards,
Alex soto


> On Sep 9, 2016, at 2:24 PM, Guillaume Nodet <gn...@apache.org> wrote:
> 
> You need to use a prerequisite feature in order to make sure the feature containing the class path url handler is fully handled and started before installing the remaining stuff that actually need to use this url handler.
> 
> <feature name="pax-url-handler">
>   ...
>   <bundle>mvn:org.ops4j.pax.url/pax-url-classpath/2.4.3</bundle>
> </feature>
> 
> <feature name="mlfeature">
>   <feature prerequisite="true">pax-url-handler</feature>
>   ...
>   <configfile finalname="${karaf.etc}/my.config.cfg">
>     classpath:my.config.cfg
>   </configfile>
> </feature>
> 
> 2016-09-09 19:28 GMT+02:00 Alex Soto <alex.soto@envieta.com <ma...@envieta.com>>:
> Ok, I tried, but still failed.
> 
> 	<bundle>mvn:org.ops4j.pax.swissbox/pax-swissbox-property/1.8.2</bundle>
>         <bundle>mvn:org.ops4j.pax.url/pax-url-commons/2.4.3</bundle>
>         <bundle>mvn:org.ops4j.pax.url/pax-url-classpath/2.4.3</bundle>
>  	<configfile finalname="${karaf.etc}/my.config.cfg">
> 		classpath:my.config.cfg
> 	</configfile>
> 
> Here is what the  logs shows (reduced):
> 
>  Installing bundles:   
>    ...
>    mvn:org.ops4j.base/ops4j-base-io/1.5.0
>    mvn:org.ops4j.base/ops4j-base-lang/1.5.0
>    mvn:org.ops4j.base/ops4j-base-monitors/1.5.0
>    mvn:org.ops4j.base/ops4j-base-net/1.5.0
>    mvn:org.ops4j.base/ops4j-base-spi/1.5.0
>    mvn:org.ops4j.base/ops4j-base-store/1.5.0
>    mvn:org.ops4j.base/ops4j-base-util-property/1.5.0
>    mvn:org.ops4j.pax.swissbox/pax-swissbox-core/1.8.2
>    mvn:org.ops4j.pax.swissbox/pax-swissbox-extender/1.8.2
>    mvn:org.ops4j.pax.swissbox/pax-swissbox-framework/1.8.2
>    mvn:org.ops4j.pax.swissbox/pax-swissbox-lifecycle/1.8.2
>    mvn:org.ops4j.pax.swissbox/pax-swissbox-property/1.8.2
>    mvn:org.ops4j.pax.swissbox/pax-swissbox-tracker/1.8.2
>    mvn:org.ops4j.pax.tipi/org.ops4j.pax.tipi.hamcrest.core/1.3.0.1 <http://1.3.0.1/>
>    mvn:org.ops4j.pax.tipi/org.ops4j.pax.tipi.junit/4.12.0.1 <http://4.12.0.1/>
>    mvn:org.ops4j.pax.url/pax-url-classpath/2.4.3
>    mvn:org.ops4j.pax.url/pax-url-commons/2.4.3
>    ...
> 	
>  Creating configuration file ...  target/exam/9ccc2e04-a3d4-49ca-b704-ec0b11c00c29/etc/my.config.cfg
>  Unknown protocol: classpath
>  Error installing boot features
> java.net <http://java.net/>.MalformedURLException: Unknown protocol: classpath
> 	at java.net.URL.<init>(URL.java:620)[:1.8.0_45]
> 	at java.net.URL.<init>(URL.java:483)[:1.8.0_45]
> 	at java.net.URL.<init>(URL.java:432)[:1.8.0_45]
> 	at org.apache.karaf.features.internal.service.FeatureConfigInstaller.installConfigurationFile(FeatureConfigInstaller.java:210)[9:org.apache.karaf.features.core:4.0.3]
> 	at org.apache.karaf.features.internal.service.FeatureConfigInstaller.installFeatureConfigs(FeatureConfigInstaller.java:120)[9:org.apache.karaf.features.core:4.0.3]
> 	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:1156)[9:org.apache.karaf.features.core:4.0.3]
> 	at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:769)[9:org.apache.karaf.features.core:4.0.3]
> 	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1079)[9:org.apache.karaf.features.core:4.0.3]
> 	at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:975)[9:org.apache.karaf.features.core:4.0.3]
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_45]
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_45]
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_45]
> 	at java.lang.Thread.run(Thread.java:745)[:1.8.0_45]
> Caused by: java.lang.IllegalStateException: Unknown protocol: classpath
> 	at org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:373)[org.apache.felix.framework-5.4.0.jar:]
> 	at java.net.URL.<init>(URL.java:615)[:1.8.0_45]
> 	... 12 more
> 
> 
> From the above, the mvn:org.ops4j.pax.url/pax-url-classpath/2.4.3 is being installed before the classpath protocol  is used.  Any ideas?
> 
> Best regards,
> Alex soto
> 
> 
> 
>> On Sep 9, 2016, at 12:16 PM, Jean-Baptiste Onofré <jb@nanthrax.net <ma...@nanthrax.net>> wrote:
>> 
>> Hi Alex,
>> 
>> You have to install pax-url-classpath bundle to have the classpath URL handler.
>> 
>> On the other hand, now (since Karaf 4.0.5), both <config/> and <configfile/> creates a cfg file in the etc folder.
>> 
>> Regards
>> JB
>> 
>> On 09/09/2016 06:04 PM, Alex Soto wrote:
>>> I guess it is not loaded by default.  Added this to my features.xml:
>>> 
>>> <bundle>classpath:mylib.jar</bundle>
>>> 
>>> produced  error: "Unknown protocol: classpath".   Also tried
>>> /bundle:install/ in the interactive console, which produced the same error.
>>> Is this something that can be easily solved by deploying an extra
>>> bundle? If so, which one?
>>> 
>>> More generally, what is the best practice to automatically deploy a
>>> default cfg file in the etc directory when using the <configFile> tag of
>>> features.xml?
>>> 
>>> 
>>> Best regards,
>>> Alex soto
>>> 
>>> 
>>> 
>>>> On Sep 9, 2016, at 10:33 AM, Jean-Baptiste Onofré <jb@nanthrax.net <ma...@nanthrax.net>
>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>> 
>>>> I'm not sure the classpath URL handler is loaded.
>>>> 
>>>> If you do bundle:install classpath:....
>>>> 
>>>> do you have any issue ?
>>>> 
>>>> Regards
>>>> JB
>>>> 
>>>> On 09/09/2016 04:27 PM, Alex Soto wrote:
>>>>> No, I am not using blueprint (at least in this context), this is a URL
>>>>> in the features.xml file.  I am trying to deploy a default config file
>>>>> as part of my feature.  Karaf documentation does not mention all
>>>>> possible URLs it supports.  It says:
>>>>> 
>>>>>   "The file URL is any URL supported by Apache Karaf (see the
>>>>>   [Artifacts repositories and URLs|urls] of the user guide for
>>>>> details)."
>>>>> 
>>>>> 
>>>>> and then:
>>>>> 
>>>>>   "However, Karaf provides several URL handlers, in addition to the
>>>>>   usual ones (file, http, etc…​). One of these is the Maven URL
>>>>>   handler, which allow reusing maven repositories to point to
>>>>>   the bundles.”
>>>>> 
>>>>> 
>>>>> 
>>>>> So, I thought that "the usual ones" included any of the OPS4J Pax URLs
>>>>> described here:
>>>>> 
>>>>> https://ops4j1.jira.com/wiki/display/paxurl/Classpath+Protocol <https://ops4j1.jira.com/wiki/display/paxurl/Classpath+Protocol>
>>>>> 
>>>>> Aren’t OPS4J Pax URL handlers included in the default Karaf distribution?
>>>>> 
>>>>> Best regards,
>>>>> Alex soto
>>>>> 
>>>>> 
>>>>> 
>>>>>> On Sep 9, 2016, at 10:16 AM, Jean-Baptiste Onofré <jb@nanthrax.net <ma...@nanthrax.net>
>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> classpath is not a regular URL: AFAIK, classpath: is a specific Spring
>>>>>> URL (not a blueprint regular URL).
>>>>>> 
>>>>>> Do you use the blueprint spring extender ?
>>>>>> 
>>>>>> Regards
>>>>>> JB
>>>>>> 
>>>>>> On 09/09/2016 03:42 PM, Alex Soto wrote:
>>>>>>> Hello,
>>>>>>> 
>>>>>>> I am trying to deploy a config file which is a resource of one of the
>>>>>>> deployed bundles.  I write the features.xml
>>>>>>> 
>>>>>>>  <configfile finalname="${karaf.etc}/my.config.cfg">
>>>>>>>  classpath://my <> :: bundle/my.config.cfg
>>>>>>>  </configfile>
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> When I run integration tests (PAX-EXAM) I get this error:
>>>>>>> 
>>>>>>>  Error installing boot features
>>>>>>>  java.net <http://java.net/>.MalformedURLException: Unknown protocol: classpath
>>>>>>>  at java.net.URL.<init>(URL.java:620)[:1.8.0_45]
>>>>>>>  at java.net.URL.<init>(URL.java:483)[:1.8.0_45]
>>>>>>>  at java.net.URL.<init>(URL.java:432)[:1.8.0_45]
>>>>>>>  at
>>>>>>> org.apache.karaf.features.internal.service.FeatureConfigInstaller.installConfigurationFile(FeatureConfigInstaller.java:210)[9:org.apache.karaf.features.core:4.0.3]
>>>>>>>  at
>>>>>>> org.apache.karaf.features.internal.service.FeatureConfigInstaller.installFeatureConfigs(FeatureConfigInstaller.java:120)[9:org.apache.karaf.features.core:4.0.3]
>>>>>>>  at
>>>>>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:1156)[9:org.apache.karaf.features.core:4.0.3]
>>>>>>>  at
>>>>>>> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:769)[9:org.apache.karaf.features.core:4.0.3]
>>>>>>>  at
>>>>>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1079)[9:org.apache.karaf.features.core:4.0.3]
>>>>>>>  at
>>>>>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:975)[9:org.apache.karaf.features.core:4.0.3]
>>>>>>>  at
>>>>>>> java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_45]
>>>>>>>  at
>>>>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_45]
>>>>>>>  at
>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_45]
>>>>>>>  at java.lang.Thread.run(Thread.java:745)[:1.8.0_45]
>>>>>>>  Caused by: java.lang.IllegalStateException: Unknown protocol:
>>>>>>> classpath
>>>>>>>  at
>>>>>>> org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:373)[org.apache.felix.framework-5.4.0.jar:]
>>>>>>>  at java.net.URL.<init>(URL.java:615)[:1.8.0_45]
>>>>>>>  ... 12 more
>>>>>>> 
>>>>>>> 
>>>>>>> Looks it does not recognize the /classpath/ URL handler.  How can make
>>>>>>> this work?   I would like the cfg files to be in the bundle that
>>>>>>> uses it.
>>>>>>> 
>>>>>>> Best regards,
>>>>>>> Alex soto
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> Jean-Baptiste Onofré
>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>> <mailto:jbonofre@apache.org <ma...@apache.org>> <mailto:jbonofre@apache.org <ma...@apache.org>>
>>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/> <http://blog.nanthrax.net/ <http://blog.nanthrax.net/>>
>>>>>> Talend - http://www.talend.com <http://www.talend.com/> <http://www.talend.com/ <http://www.talend.com/>>
>>>>> 
>>>> 
>>>> --
>>>> Jean-Baptiste Onofré
>>>> jbonofre@apache.org <ma...@apache.org> <mailto:jbonofre@apache.org <ma...@apache.org>>
>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/> <http://blog.nanthrax.net/ <http://blog.nanthrax.net/>>
>>>> Talend - http://www.talend.com <http://www.talend.com/> <http://www.talend.com/ <http://www.talend.com/>>
>>> 
>> 
>> -- 
>> Jean-Baptiste Onofré
>> jbonofre@apache.org <ma...@apache.org>
>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>> Talend - http://www.talend.com <http://www.talend.com/>
> 
> 
> 
> -- 
> ------------------------
> Guillaume Nodet
> ------------------------
> Red Hat, Open Source Integration
> 
> Email: gnodet@redhat.com <ma...@redhat.com>
> Web: http://fusesource.com <http://fusesource.com/>
> Blog: http://gnodet.blogspot.com/ <http://gnodet.blogspot.com/>
> 


Re: features.xml and classpath URL handler

Posted by Guillaume Nodet <gn...@apache.org>.
You need to use a prerequisite feature in order to make sure the feature
containing the class path url handler is fully handled and started before
installing the remaining stuff that actually need to use this url handler.

<feature name="pax-url-handler">
  ...
  <bundle>mvn:org.ops4j.pax.url/pax-url-classpath/2.4.3</bundle>
</feature>

<feature name="mlfeature">
  <feature prerequisite="true">pax-url-handler</feature>
  ...
  <configfile finalname="${karaf.etc}/my.config.cfg">
  classpath:my.config.cfg
  </configfile>
</feature>

2016-09-09 19:28 GMT+02:00 Alex Soto <al...@envieta.com>:

> Ok, I tried, but still failed.
>
> <bundle>mvn:org.ops4j.pax.swissbox/pax-swissbox-property/1.8.2</bundle>
>         <bundle>mvn:org.ops4j.pax.url/pax-url-commons/2.4.3</bundle>
>         <bundle>mvn:org.ops4j.pax.url/pax-url-classpath/2.4.3</bundle>
>   <configfile finalname="${karaf.etc}/my.config.cfg">
> classpath:my.config.cfg
> </configfile>
>
> Here is what the  logs shows (reduced):
>
>  Installing bundles:
>    ...
>    mvn:org.ops4j.base/ops4j-base-io/1.5.0
>    mvn:org.ops4j.base/ops4j-base-lang/1.5.0
>    mvn:org.ops4j.base/ops4j-base-monitors/1.5.0
>    mvn:org.ops4j.base/ops4j-base-net/1.5.0
>    mvn:org.ops4j.base/ops4j-base-spi/1.5.0
>    mvn:org.ops4j.base/ops4j-base-store/1.5.0
>    mvn:org.ops4j.base/ops4j-base-util-property/1.5.0
>    mvn:org.ops4j.pax.swissbox/pax-swissbox-core/1.8.2
>    mvn:org.ops4j.pax.swissbox/pax-swissbox-extender/1.8.2
>    mvn:org.ops4j.pax.swissbox/pax-swissbox-framework/1.8.2
>    mvn:org.ops4j.pax.swissbox/pax-swissbox-lifecycle/1.8.2
>    mvn:org.ops4j.pax.swissbox/pax-swissbox-property/1.8.2
>    mvn:org.ops4j.pax.swissbox/pax-swissbox-tracker/1.8.2
>    mvn:org.ops4j.pax.tipi/org.ops4j.pax.tipi.hamcrest.core/1.3.0.1
>    mvn:org.ops4j.pax.tipi/org.ops4j.pax.tipi.junit/4.12.0.1
> *   mvn:org.ops4j.pax.url/pax-url-classpath/2.4.3*
>    mvn:org.ops4j.pax.url/pax-url-commons/2.4.3
>    ...
>  Creating configuration file ...  target/exam/9ccc2e04-a3d4-
> 49ca-b704-ec0b11c00c29/etc/my.config.cfg
>  Unknown protocol: classpath
>  Error installing boot features
> java.net.MalformedURLException: Unknown protocol: classpath
> at java.net.URL.<init>(URL.java:620)[:1.8.0_45]
> at java.net.URL.<init>(URL.java:483)[:1.8.0_45]
> at java.net.URL.<init>(URL.java:432)[:1.8.0_45]
> at org.apache.karaf.features.internal.service.FeatureConfigInstaller.
> installConfigurationFile(FeatureConfigInstaller.java:
> 210)[9:org.apache.karaf.features.core:4.0.3]
> at org.apache.karaf.features.internal.service.FeatureConfigInstaller.
> installFeatureConfigs(FeatureConfigInstaller.java:120)[9:org.apache.karaf.
> features.core:4.0.3]
> at org.apache.karaf.features.internal.service.FeaturesServiceImpl.
> installFeature(FeaturesServiceImpl.java:1156)[9:org.apache.karaf.features.
> core:4.0.3]
> at org.apache.karaf.features.internal.service.Deployer.
> deploy(Deployer.java:769)[9:org.apache.karaf.features.core:4.0.3]
> at org.apache.karaf.features.internal.service.FeaturesServiceImpl.
> doProvision(FeaturesServiceImpl.java:1079)[9:org.apache.karaf.features.
> core:4.0.3]
> at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(
> FeaturesServiceImpl.java:975)[9:org.apache.karaf.features.core:4.0.3]
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_45]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1142)[:1.8.0_45]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:617)[:1.8.0_45]
> at java.lang.Thread.run(Thread.java:745)[:1.8.0_45]
> Caused by: java.lang.IllegalStateException: Unknown protocol: classpath
> at org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(
> URLHandlersStreamHandlerProxy.java:373)[org.apache.felix.
> framework-5.4.0.jar:]
> at java.net.URL.<init>(URL.java:615)[:1.8.0_45]
> ... 12 more
>
>
>
> From the above, the mvn:org.ops4j.pax.url/pax-url-classpath/2.4.3 is
> being installed before the classpath protocol  is used.  Any ideas?
>
> Best regards,
> Alex soto
>
>
>
> On Sep 9, 2016, at 12:16 PM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
>
> Hi Alex,
>
> You have to install pax-url-classpath bundle to have the classpath URL
> handler.
>
> On the other hand, now (since Karaf 4.0.5), both <config/> and
> <configfile/> creates a cfg file in the etc folder.
>
> Regards
> JB
>
> On 09/09/2016 06:04 PM, Alex Soto wrote:
>
> I guess it is not loaded by default.  Added this to my features.xml:
>
> <bundle>classpath:mylib.jar</bundle>
>
> produced  error: "Unknown protocol: classpath".   Also tried
> /bundle:install/ in the interactive console, which produced the same error.
> Is this something that can be easily solved by deploying an extra
> bundle? If so, which one?
>
> More generally, what is the best practice to automatically deploy a
> default cfg file in the etc directory when using the <configFile> tag of
> features.xml?
>
>
> Best regards,
> Alex soto
>
>
>
> On Sep 9, 2016, at 10:33 AM, Jean-Baptiste Onofré <jb@nanthrax.net
> <mailto:jb@nanthrax.net <jb...@nanthrax.net>>> wrote:
>
> I'm not sure the classpath URL handler is loaded.
>
> If you do bundle:install classpath:....
>
> do you have any issue ?
>
> Regards
> JB
>
> On 09/09/2016 04:27 PM, Alex Soto wrote:
>
> No, I am not using blueprint (at least in this context), this is a URL
> in the features.xml file.  I am trying to deploy a default config file
> as part of my feature.  Karaf documentation does not mention all
> possible URLs it supports.  It says:
>
>   "The file URL is any URL supported by Apache Karaf (see the
>   [Artifacts repositories and URLs|urls] of the user guide for
> details)."
>
>
> and then:
>
>   "However, Karaf provides several URL handlers, in addition to the
>   usual ones (file, http, etc…​). One of these is the Maven URL
>   handler, which allow reusing maven repositories to point to
>   the bundles.”
>
>
>
> So, I thought that "the usual ones" included any of the OPS4J Pax URLs
> described here:
>
> https://ops4j1.jira.com/wiki/display/paxurl/Classpath+Protocol
>
> Aren’t OPS4J Pax URL handlers included in the default Karaf distribution?
>
> Best regards,
> Alex soto
>
>
>
> On Sep 9, 2016, at 10:16 AM, Jean-Baptiste Onofré <jb@nanthrax.net
> <mailto:jb@nanthrax.net <jb...@nanthrax.net>>> wrote:
>
> Hi,
>
> classpath is not a regular URL: AFAIK, classpath: is a specific Spring
> URL (not a blueprint regular URL).
>
> Do you use the blueprint spring extender ?
>
> Regards
> JB
>
> On 09/09/2016 03:42 PM, Alex Soto wrote:
>
> Hello,
>
> I am trying to deploy a config file which is a resource of one of the
> deployed bundles.  I write the features.xml
>
>  <configfile finalname="${karaf.etc}/my.config.cfg">
>  classpath://my :: bundle/my.config.cfg
>  </configfile>
>
>
>
> When I run integration tests (PAX-EXAM) I get this error:
>
>  Error installing boot features
>  java.net.MalformedURLException: Unknown protocol: classpath
>  at java.net.URL.<init>(URL.java:620)[:1.8.0_45]
>  at java.net.URL.<init>(URL.java:483)[:1.8.0_45]
>  at java.net.URL.<init>(URL.java:432)[:1.8.0_45]
>  at
> org.apache.karaf.features.internal.service.FeatureConfigInstaller.
> installConfigurationFile(FeatureConfigInstaller.java:
> 210)[9:org.apache.karaf.features.core:4.0.3]
>  at
> org.apache.karaf.features.internal.service.FeatureConfigInstaller.
> installFeatureConfigs(FeatureConfigInstaller.java:120)[9:org.apache.karaf.
> features.core:4.0.3]
>  at
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.
> installFeature(FeaturesServiceImpl.java:1156)[9:org.apache.karaf.features.
> core:4.0.3]
>  at
> org.apache.karaf.features.internal.service.Deployer.
> deploy(Deployer.java:769)[9:org.apache.karaf.features.core:4.0.3]
>  at
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.
> doProvision(FeaturesServiceImpl.java:1079)[9:org.apache.karaf.features.
> core:4.0.3]
>  at
> org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(
> FeaturesServiceImpl.java:975)[9:org.apache.karaf.features.core:4.0.3]
>  at
> java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_45]
>  at
> java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1142)[:1.8.0_45]
>  at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:617)[:1.8.0_45]
>  at java.lang.Thread.run(Thread.java:745)[:1.8.0_45]
>  Caused by: java.lang.IllegalStateException: Unknown protocol:
> classpath
>  at
> org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(
> URLHandlersStreamHandlerProxy.java:373)[org.apache.felix.
> framework-5.4.0.jar:]
>  at java.net.URL.<init>(URL.java:615)[:1.8.0_45]
>  ... 12 more
>
>
> Looks it does not recognize the /classpath/ URL handler.  How can make
> this work?   I would like the cfg files to be in the bundle that
> uses it.
>
> Best regards,
> Alex soto
>
>
>
>
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> <mailto:jbonofre@apache.org <jb...@apache.org>> <
> mailto:jbonofre@apache.org <jb...@apache.org>>
> http://blog.nanthrax.net <http://blog.nanthrax.net/>
> Talend - http://www.talend.com <http://www.talend.com/>
>
>
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org <mailto:jbonofre@apache.org <jb...@apache.org>>
> http://blog.nanthrax.net <http://blog.nanthrax.net/>
> Talend - http://www.talend.com <http://www.talend.com/>
>
>
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>
>
>


-- 
------------------------
Guillaume Nodet
------------------------
Red Hat, Open Source Integration

Email: gnodet@redhat.com
Web: http://fusesource.com
Blog: http://gnodet.blogspot.com/

Re: features.xml and classpath URL handler

Posted by Alex Soto <al...@envieta.com>.
Ok, I tried, but still failed.

	<bundle>mvn:org.ops4j.pax.swissbox/pax-swissbox-property/1.8.2</bundle>
        <bundle>mvn:org.ops4j.pax.url/pax-url-commons/2.4.3</bundle>
        <bundle>mvn:org.ops4j.pax.url/pax-url-classpath/2.4.3</bundle>
 	<configfile finalname="${karaf.etc}/my.config.cfg">
		classpath:my.config.cfg
	</configfile>

Here is what the  logs shows (reduced):

 Installing bundles:   
   ...
   mvn:org.ops4j.base/ops4j-base-io/1.5.0
   mvn:org.ops4j.base/ops4j-base-lang/1.5.0
   mvn:org.ops4j.base/ops4j-base-monitors/1.5.0
   mvn:org.ops4j.base/ops4j-base-net/1.5.0
   mvn:org.ops4j.base/ops4j-base-spi/1.5.0
   mvn:org.ops4j.base/ops4j-base-store/1.5.0
   mvn:org.ops4j.base/ops4j-base-util-property/1.5.0
   mvn:org.ops4j.pax.swissbox/pax-swissbox-core/1.8.2
   mvn:org.ops4j.pax.swissbox/pax-swissbox-extender/1.8.2
   mvn:org.ops4j.pax.swissbox/pax-swissbox-framework/1.8.2
   mvn:org.ops4j.pax.swissbox/pax-swissbox-lifecycle/1.8.2
   mvn:org.ops4j.pax.swissbox/pax-swissbox-property/1.8.2
   mvn:org.ops4j.pax.swissbox/pax-swissbox-tracker/1.8.2
   mvn:org.ops4j.pax.tipi/org.ops4j.pax.tipi.hamcrest.core/1.3.0.1
   mvn:org.ops4j.pax.tipi/org.ops4j.pax.tipi.junit/4.12.0.1
   mvn:org.ops4j.pax.url/pax-url-classpath/2.4.3
   mvn:org.ops4j.pax.url/pax-url-commons/2.4.3
   ...
	
 Creating configuration file ...  target/exam/9ccc2e04-a3d4-49ca-b704-ec0b11c00c29/etc/my.config.cfg
 Unknown protocol: classpath
 Error installing boot features
java.net.MalformedURLException: Unknown protocol: classpath
	at java.net.URL.<init>(URL.java:620)[:1.8.0_45]
	at java.net.URL.<init>(URL.java:483)[:1.8.0_45]
	at java.net.URL.<init>(URL.java:432)[:1.8.0_45]
	at org.apache.karaf.features.internal.service.FeatureConfigInstaller.installConfigurationFile(FeatureConfigInstaller.java:210)[9:org.apache.karaf.features.core:4.0.3]
	at org.apache.karaf.features.internal.service.FeatureConfigInstaller.installFeatureConfigs(FeatureConfigInstaller.java:120)[9:org.apache.karaf.features.core:4.0.3]
	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:1156)[9:org.apache.karaf.features.core:4.0.3]
	at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:769)[9:org.apache.karaf.features.core:4.0.3]
	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1079)[9:org.apache.karaf.features.core:4.0.3]
	at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:975)[9:org.apache.karaf.features.core:4.0.3]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_45]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_45]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_45]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_45]
Caused by: java.lang.IllegalStateException: Unknown protocol: classpath
	at org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:373)[org.apache.felix.framework-5.4.0.jar:]
	at java.net.URL.<init>(URL.java:615)[:1.8.0_45]
	... 12 more


From the above, the mvn:org.ops4j.pax.url/pax-url-classpath/2.4.3 is being installed before the classpath protocol  is used.  Any ideas?

Best regards,
Alex soto



> On Sep 9, 2016, at 12:16 PM, Jean-Baptiste Onofré <jb@nanthrax.net <ma...@nanthrax.net>> wrote:
> 
> Hi Alex,
> 
> You have to install pax-url-classpath bundle to have the classpath URL handler.
> 
> On the other hand, now (since Karaf 4.0.5), both <config/> and <configfile/> creates a cfg file in the etc folder.
> 
> Regards
> JB
> 
> On 09/09/2016 06:04 PM, Alex Soto wrote:
>> I guess it is not loaded by default.  Added this to my features.xml:
>> 
>> <bundle>classpath:mylib.jar</bundle>
>> 
>> produced  error: "Unknown protocol: classpath".   Also tried
>> /bundle:install/ in the interactive console, which produced the same error.
>> Is this something that can be easily solved by deploying an extra
>> bundle? If so, which one?
>> 
>> More generally, what is the best practice to automatically deploy a
>> default cfg file in the etc directory when using the <configFile> tag of
>> features.xml?
>> 
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>>> On Sep 9, 2016, at 10:33 AM, Jean-Baptiste Onofré <jb@nanthrax.net <ma...@nanthrax.net>
>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>> 
>>> I'm not sure the classpath URL handler is loaded.
>>> 
>>> If you do bundle:install classpath:....
>>> 
>>> do you have any issue ?
>>> 
>>> Regards
>>> JB
>>> 
>>> On 09/09/2016 04:27 PM, Alex Soto wrote:
>>>> No, I am not using blueprint (at least in this context), this is a URL
>>>> in the features.xml file.  I am trying to deploy a default config file
>>>> as part of my feature.  Karaf documentation does not mention all
>>>> possible URLs it supports.  It says:
>>>> 
>>>>   "The file URL is any URL supported by Apache Karaf (see the
>>>>   [Artifacts repositories and URLs|urls] of the user guide for
>>>> details)."
>>>> 
>>>> 
>>>> and then:
>>>> 
>>>>   "However, Karaf provides several URL handlers, in addition to the
>>>>   usual ones (file, http, etc…​). One of these is the Maven URL
>>>>   handler, which allow reusing maven repositories to point to
>>>>   the bundles.”
>>>> 
>>>> 
>>>> 
>>>> So, I thought that "the usual ones" included any of the OPS4J Pax URLs
>>>> described here:
>>>> 
>>>> https://ops4j1.jira.com/wiki/display/paxurl/Classpath+Protocol <https://ops4j1.jira.com/wiki/display/paxurl/Classpath+Protocol>
>>>> 
>>>> Aren’t OPS4J Pax URL handlers included in the default Karaf distribution?
>>>> 
>>>> Best regards,
>>>> Alex soto
>>>> 
>>>> 
>>>> 
>>>>> On Sep 9, 2016, at 10:16 AM, Jean-Baptiste Onofré <jb@nanthrax.net <ma...@nanthrax.net>
>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> classpath is not a regular URL: AFAIK, classpath: is a specific Spring
>>>>> URL (not a blueprint regular URL).
>>>>> 
>>>>> Do you use the blueprint spring extender ?
>>>>> 
>>>>> Regards
>>>>> JB
>>>>> 
>>>>> On 09/09/2016 03:42 PM, Alex Soto wrote:
>>>>>> Hello,
>>>>>> 
>>>>>> I am trying to deploy a config file which is a resource of one of the
>>>>>> deployed bundles.  I write the features.xml
>>>>>> 
>>>>>>  <configfile finalname="${karaf.etc}/my.config.cfg">
>>>>>>  classpath://my <classpath://my> :: bundle/my.config.cfg
>>>>>>  </configfile>
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> When I run integration tests (PAX-EXAM) I get this error:
>>>>>> 
>>>>>>  Error installing boot features
>>>>>>  java.net.MalformedURLException: Unknown protocol: classpath
>>>>>>  at java.net.URL.<init>(URL.java:620)[:1.8.0_45]
>>>>>>  at java.net.URL.<init>(URL.java:483)[:1.8.0_45]
>>>>>>  at java.net.URL.<init>(URL.java:432)[:1.8.0_45]
>>>>>>  at
>>>>>> org.apache.karaf.features.internal.service.FeatureConfigInstaller.installConfigurationFile(FeatureConfigInstaller.java:210)[9:org.apache.karaf.features.core:4.0.3]
>>>>>>  at
>>>>>> org.apache.karaf.features.internal.service.FeatureConfigInstaller.installFeatureConfigs(FeatureConfigInstaller.java:120)[9:org.apache.karaf.features.core:4.0.3]
>>>>>>  at
>>>>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:1156)[9:org.apache.karaf.features.core:4.0.3]
>>>>>>  at
>>>>>> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:769)[9:org.apache.karaf.features.core:4.0.3]
>>>>>>  at
>>>>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1079)[9:org.apache.karaf.features.core:4.0.3]
>>>>>>  at
>>>>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:975)[9:org.apache.karaf.features.core:4.0.3]
>>>>>>  at
>>>>>> java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_45]
>>>>>>  at
>>>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_45]
>>>>>>  at
>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_45]
>>>>>>  at java.lang.Thread.run(Thread.java:745)[:1.8.0_45]
>>>>>>  Caused by: java.lang.IllegalStateException: Unknown protocol:
>>>>>> classpath
>>>>>>  at
>>>>>> org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:373)[org.apache.felix.framework-5.4.0.jar:]
>>>>>>  at java.net.URL.<init>(URL.java:615)[:1.8.0_45]
>>>>>>  ... 12 more
>>>>>> 
>>>>>> 
>>>>>> Looks it does not recognize the /classpath/ URL handler.  How can make
>>>>>> this work?   I would like the cfg files to be in the bundle that
>>>>>> uses it.
>>>>>> 
>>>>>> Best regards,
>>>>>> Alex soto
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> --
>>>>> Jean-Baptiste Onofré
>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>> <mailto:jbonofre@apache.org <ma...@apache.org>> <mailto:jbonofre@apache.org <ma...@apache.org>>
>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/> <http://blog.nanthrax.net/ <http://blog.nanthrax.net/>>
>>>>> Talend - http://www.talend.com <http://www.talend.com/> <http://www.talend.com/ <http://www.talend.com/>>
>>>> 
>>> 
>>> --
>>> Jean-Baptiste Onofré
>>> jbonofre@apache.org <ma...@apache.org> <mailto:jbonofre@apache.org <ma...@apache.org>>
>>> http://blog.nanthrax.net <http://blog.nanthrax.net/> <http://blog.nanthrax.net/ <http://blog.nanthrax.net/>>
>>> Talend - http://www.talend.com <http://www.talend.com/> <http://www.talend.com/ <http://www.talend.com/>>
>> 
> 
> -- 
> Jean-Baptiste Onofré
> jbonofre@apache.org <ma...@apache.org>
> http://blog.nanthrax.net <http://blog.nanthrax.net/>
> Talend - http://www.talend.com <http://www.talend.com/>

Re: features.xml and classpath URL handler

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Alex,

You have to install pax-url-classpath bundle to have the classpath URL 
handler.

On the other hand, now (since Karaf 4.0.5), both <config/> and 
<configfile/> creates a cfg file in the etc folder.

Regards
JB

On 09/09/2016 06:04 PM, Alex Soto wrote:
> I guess it is not loaded by default.  Added this to my features.xml:
>
> <bundle>classpath:mylib.jar</bundle>
>
> produced  error: "Unknown protocol: classpath".   Also tried
> /bundle:install/ in the interactive console, which produced the same error.
> Is this something that can be easily solved by deploying an extra
> bundle? If so, which one?
>
> More generally, what is the best practice to automatically deploy a
> default cfg file in the etc directory when using the <configFile> tag of
> features.xml?
>
>
> Best regards,
> Alex soto
>
>
>
>> On Sep 9, 2016, at 10:33 AM, Jean-Baptiste Onofr� <jb@nanthrax.net
>> <ma...@nanthrax.net>> wrote:
>>
>> I'm not sure the classpath URL handler is loaded.
>>
>> If you do bundle:install classpath:....
>>
>> do you have any issue ?
>>
>> Regards
>> JB
>>
>> On 09/09/2016 04:27 PM, Alex Soto wrote:
>>> No, I am not using blueprint (at least in this context), this is a URL
>>> in the features.xml file.  I am trying to deploy a default config file
>>> as part of my feature.  Karaf documentation does not mention all
>>> possible URLs it supports.  It says:
>>>
>>>    "The file URL is any URL supported by Apache Karaf (see the
>>>    [Artifacts repositories and URLs|urls] of the user guide for
>>> details)."
>>>
>>>
>>> and then:
>>>
>>>    "However, Karaf provides several URL handlers, in addition to the
>>>    usual ones (file, http, etc\u2026\u200b). One of these is the Maven URL
>>>    handler, which allow reusing maven repositories to point to
>>>    the bundles.\u201d
>>>
>>>
>>>
>>> So, I thought that "the usual ones" included any of the OPS4J Pax URLs
>>> described here:
>>>
>>> https://ops4j1.jira.com/wiki/display/paxurl/Classpath+Protocol
>>>
>>> Aren\u2019t OPS4J Pax URL handlers included in the default Karaf distribution?
>>>
>>> Best regards,
>>> Alex soto
>>>
>>>
>>>
>>>> On Sep 9, 2016, at 10:16 AM, Jean-Baptiste Onofr� <jb@nanthrax.net
>>>> <ma...@nanthrax.net>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> classpath is not a regular URL: AFAIK, classpath: is a specific Spring
>>>> URL (not a blueprint regular URL).
>>>>
>>>> Do you use the blueprint spring extender ?
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 09/09/2016 03:42 PM, Alex Soto wrote:
>>>>> Hello,
>>>>>
>>>>> I am trying to deploy a config file which is a resource of one of the
>>>>> deployed bundles.  I write the features.xml
>>>>>
>>>>>   <configfile finalname="${karaf.etc}/my.config.cfg">
>>>>>   classpath://my :: bundle/my.config.cfg
>>>>>   </configfile>
>>>>>
>>>>>
>>>>>
>>>>> When I run integration tests (PAX-EXAM) I get this error:
>>>>>
>>>>>   Error installing boot features
>>>>>   java.net.MalformedURLException: Unknown protocol: classpath
>>>>>   at java.net.URL.<init>(URL.java:620)[:1.8.0_45]
>>>>>   at java.net.URL.<init>(URL.java:483)[:1.8.0_45]
>>>>>   at java.net.URL.<init>(URL.java:432)[:1.8.0_45]
>>>>>   at
>>>>> org.apache.karaf.features.internal.service.FeatureConfigInstaller.installConfigurationFile(FeatureConfigInstaller.java:210)[9:org.apache.karaf.features.core:4.0.3]
>>>>>   at
>>>>> org.apache.karaf.features.internal.service.FeatureConfigInstaller.installFeatureConfigs(FeatureConfigInstaller.java:120)[9:org.apache.karaf.features.core:4.0.3]
>>>>>   at
>>>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:1156)[9:org.apache.karaf.features.core:4.0.3]
>>>>>   at
>>>>> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:769)[9:org.apache.karaf.features.core:4.0.3]
>>>>>   at
>>>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1079)[9:org.apache.karaf.features.core:4.0.3]
>>>>>   at
>>>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:975)[9:org.apache.karaf.features.core:4.0.3]
>>>>>   at
>>>>> java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_45]
>>>>>   at
>>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_45]
>>>>>   at
>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_45]
>>>>>   at java.lang.Thread.run(Thread.java:745)[:1.8.0_45]
>>>>>   Caused by: java.lang.IllegalStateException: Unknown protocol:
>>>>> classpath
>>>>>   at
>>>>> org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:373)[org.apache.felix.framework-5.4.0.jar:]
>>>>>   at java.net.URL.<init>(URL.java:615)[:1.8.0_45]
>>>>>   ... 12 more
>>>>>
>>>>>
>>>>> Looks it does not recognize the /classpath/ URL handler.  How can make
>>>>> this work?   I would like the cfg files to be in the bundle that
>>>>> uses it.
>>>>>
>>>>> Best regards,
>>>>> Alex soto
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> Jean-Baptiste Onofr�
>>>> jbonofre@apache.org
>>>> <ma...@apache.org> <ma...@apache.org>
>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>
>>
>> --
>> Jean-Baptiste Onofr�
>> jbonofre@apache.org <ma...@apache.org>
>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>> Talend - http://www.talend.com <http://www.talend.com/>
>

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

Re: features.xml and classpath URL handler

Posted by Alex Soto <al...@envieta.com>.
I guess it is not loaded by default.  Added this to my features.xml:

	<bundle>classpath:mylib.jar</bundle>

produced  error: "Unknown protocol: classpath".   Also tried bundle:install in the interactive console, which produced the same error.
Is this something that can be easily solved by deploying an extra bundle? If so, which one?

More generally, what is the best practice to automatically deploy a default cfg file in the etc directory when using the <configFile> tag of features.xml?


Best regards,
Alex soto



> On Sep 9, 2016, at 10:33 AM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> 
> I'm not sure the classpath URL handler is loaded.
> 
> If you do bundle:install classpath:....
> 
> do you have any issue ?
> 
> Regards
> JB
> 
> On 09/09/2016 04:27 PM, Alex Soto wrote:
>> No, I am not using blueprint (at least in this context), this is a URL
>> in the features.xml file.  I am trying to deploy a default config file
>> as part of my feature.  Karaf documentation does not mention all
>> possible URLs it supports.  It says:
>> 
>>    "The file URL is any URL supported by Apache Karaf (see the
>>    [Artifacts repositories and URLs|urls] of the user guide for details)."
>> 
>> 
>> and then:
>> 
>>    "However, Karaf provides several URL handlers, in addition to the
>>    usual ones (file, http, etc…​). One of these is the Maven URL
>>    handler, which allow reusing maven repositories to point to
>>    the bundles.”
>> 
>> 
>> 
>> So, I thought that "the usual ones" included any of the OPS4J Pax URLs
>> described here:
>> 
>> https://ops4j1.jira.com/wiki/display/paxurl/Classpath+Protocol
>> 
>> Aren’t OPS4J Pax URL handlers included in the default Karaf distribution?
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>>> On Sep 9, 2016, at 10:16 AM, Jean-Baptiste Onofré <jb@nanthrax.net
>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>> 
>>> Hi,
>>> 
>>> classpath is not a regular URL: AFAIK, classpath: is a specific Spring
>>> URL (not a blueprint regular URL).
>>> 
>>> Do you use the blueprint spring extender ?
>>> 
>>> Regards
>>> JB
>>> 
>>> On 09/09/2016 03:42 PM, Alex Soto wrote:
>>>> Hello,
>>>> 
>>>> I am trying to deploy a config file which is a resource of one of the
>>>> deployed bundles.  I write the features.xml
>>>> 
>>>>   <configfile finalname="${karaf.etc}/my.config.cfg">
>>>>   classpath://my :: bundle/my.config.cfg
>>>>   </configfile>
>>>> 
>>>> 
>>>> 
>>>> When I run integration tests (PAX-EXAM) I get this error:
>>>> 
>>>>   Error installing boot features
>>>>   java.net.MalformedURLException: Unknown protocol: classpath
>>>>   at java.net.URL.<init>(URL.java:620)[:1.8.0_45]
>>>>   at java.net.URL.<init>(URL.java:483)[:1.8.0_45]
>>>>   at java.net.URL.<init>(URL.java:432)[:1.8.0_45]
>>>>   at
>>>> org.apache.karaf.features.internal.service.FeatureConfigInstaller.installConfigurationFile(FeatureConfigInstaller.java:210)[9:org.apache.karaf.features.core:4.0.3]
>>>>   at
>>>> org.apache.karaf.features.internal.service.FeatureConfigInstaller.installFeatureConfigs(FeatureConfigInstaller.java:120)[9:org.apache.karaf.features.core:4.0.3]
>>>>   at
>>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:1156)[9:org.apache.karaf.features.core:4.0.3]
>>>>   at
>>>> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:769)[9:org.apache.karaf.features.core:4.0.3]
>>>>   at
>>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1079)[9:org.apache.karaf.features.core:4.0.3]
>>>>   at
>>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:975)[9:org.apache.karaf.features.core:4.0.3]
>>>>   at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_45]
>>>>   at
>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_45]
>>>>   at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_45]
>>>>   at java.lang.Thread.run(Thread.java:745)[:1.8.0_45]
>>>>   Caused by: java.lang.IllegalStateException: Unknown protocol:
>>>> classpath
>>>>   at
>>>> org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:373)[org.apache.felix.framework-5.4.0.jar:]
>>>>   at java.net.URL.<init>(URL.java:615)[:1.8.0_45]
>>>>   ... 12 more
>>>> 
>>>> 
>>>> Looks it does not recognize the /classpath/ URL handler.  How can make
>>>> this work?   I would like the cfg files to be in the bundle that uses it.
>>>> 
>>>> Best regards,
>>>> Alex soto
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> --
>>> Jean-Baptiste Onofré
>>> jbonofre@apache.org <ma...@apache.org> <mailto:jbonofre@apache.org <ma...@apache.org>>
>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>> Talend - http://www.talend.com <http://www.talend.com/>
>> 
> 
> -- 
> Jean-Baptiste Onofré
> jbonofre@apache.org <ma...@apache.org>
> http://blog.nanthrax.net <http://blog.nanthrax.net/>
> Talend - http://www.talend.com <http://www.talend.com/>

Re: features.xml and classpath URL handler

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
I'm not sure the classpath URL handler is loaded.

If you do bundle:install classpath:....

do you have any issue ?

Regards
JB

On 09/09/2016 04:27 PM, Alex Soto wrote:
> No, I am not using blueprint (at least in this context), this is a URL
> in the features.xml file.  I am trying to deploy a default config file
> as part of my feature.  Karaf documentation does not mention all
> possible URLs it supports.  It says:
>
>     "The file URL is any URL supported by Apache Karaf (see the
>     [Artifacts repositories and URLs|urls] of the user guide for details)."
>
>
> and then:
>
>     "However, Karaf provides several URL handlers, in addition to the
>     usual ones (file, http, etc\u2026\u200b). One of these is the Maven URL
>     handler, which allow reusing maven repositories to point to
>     the bundles.\u201d
>
>
>
> So, I thought that "the usual ones" included any of the OPS4J Pax URLs
> described here:
>
> https://ops4j1.jira.com/wiki/display/paxurl/Classpath+Protocol
>
> Aren\u2019t OPS4J Pax URL handlers included in the default Karaf distribution?
>
> Best regards,
> Alex soto
>
>
>
>> On Sep 9, 2016, at 10:16 AM, Jean-Baptiste Onofr� <jb@nanthrax.net
>> <ma...@nanthrax.net>> wrote:
>>
>> Hi,
>>
>> classpath is not a regular URL: AFAIK, classpath: is a specific Spring
>> URL (not a blueprint regular URL).
>>
>> Do you use the blueprint spring extender ?
>>
>> Regards
>> JB
>>
>> On 09/09/2016 03:42 PM, Alex Soto wrote:
>>> Hello,
>>>
>>> I am trying to deploy a config file which is a resource of one of the
>>> deployed bundles.  I write the features.xml
>>>
>>>    <configfile finalname="${karaf.etc}/my.config.cfg">
>>>    classpath://my :: bundle/my.config.cfg
>>>    </configfile>
>>>
>>>
>>>
>>> When I run integration tests (PAX-EXAM) I get this error:
>>>
>>>    Error installing boot features
>>>    java.net.MalformedURLException: Unknown protocol: classpath
>>>    at java.net.URL.<init>(URL.java:620)[:1.8.0_45]
>>>    at java.net.URL.<init>(URL.java:483)[:1.8.0_45]
>>>    at java.net.URL.<init>(URL.java:432)[:1.8.0_45]
>>>    at
>>> org.apache.karaf.features.internal.service.FeatureConfigInstaller.installConfigurationFile(FeatureConfigInstaller.java:210)[9:org.apache.karaf.features.core:4.0.3]
>>>    at
>>> org.apache.karaf.features.internal.service.FeatureConfigInstaller.installFeatureConfigs(FeatureConfigInstaller.java:120)[9:org.apache.karaf.features.core:4.0.3]
>>>    at
>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:1156)[9:org.apache.karaf.features.core:4.0.3]
>>>    at
>>> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:769)[9:org.apache.karaf.features.core:4.0.3]
>>>    at
>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1079)[9:org.apache.karaf.features.core:4.0.3]
>>>    at
>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:975)[9:org.apache.karaf.features.core:4.0.3]
>>>    at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_45]
>>>    at
>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_45]
>>>    at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_45]
>>>    at java.lang.Thread.run(Thread.java:745)[:1.8.0_45]
>>>    Caused by: java.lang.IllegalStateException: Unknown protocol:
>>> classpath
>>>    at
>>> org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:373)[org.apache.felix.framework-5.4.0.jar:]
>>>    at java.net.URL.<init>(URL.java:615)[:1.8.0_45]
>>>    ... 12 more
>>>
>>>
>>> Looks it does not recognize the /classpath/ URL handler.  How can make
>>> this work?   I would like the cfg files to be in the bundle that uses it.
>>>
>>> Best regards,
>>> Alex soto
>>>
>>>
>>>
>>>
>>
>> --
>> Jean-Baptiste Onofr�
>> jbonofre@apache.org <ma...@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

Re: features.xml and classpath URL handler

Posted by Alex Soto <al...@envieta.com>.
No, I am not using blueprint (at least in this context), this is a URL in the features.xml file.  I am trying to deploy a default config file as part of my feature.  Karaf documentation does not mention all possible URLs it supports.  It says:

"The file URL is any URL supported by Apache Karaf (see the [Artifacts repositories and URLs|urls] of the user guide for details)."

and then:

"However, Karaf provides several URL handlers, in addition to the usual ones (file, http, etc…​). One of these is the Maven URL handler, which allow reusing maven repositories to point to the bundles.”


So, I thought that "the usual ones" included any of the OPS4J Pax URLs described here:

	https://ops4j1.jira.com/wiki/display/paxurl/Classpath+Protocol <https://ops4j1.jira.com/wiki/display/paxurl/Classpath+Protocol>

Aren’t OPS4J Pax URL handlers included in the default Karaf distribution?

Best regards,
Alex soto



> On Sep 9, 2016, at 10:16 AM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> 
> Hi,
> 
> classpath is not a regular URL: AFAIK, classpath: is a specific Spring URL (not a blueprint regular URL).
> 
> Do you use the blueprint spring extender ?
> 
> Regards
> JB
> 
> On 09/09/2016 03:42 PM, Alex Soto wrote:
>> Hello,
>> 
>> I am trying to deploy a config file which is a resource of one of the
>> deployed bundles.  I write the features.xml
>> 
>>    <configfile finalname="${karaf.etc}/my.config.cfg">
>>    classpath://my :: bundle/my.config.cfg
>>    </configfile>
>> 
>> 
>> 
>> When I run integration tests (PAX-EXAM) I get this error:
>> 
>>    Error installing boot features
>>    java.net.MalformedURLException: Unknown protocol: classpath
>>    at java.net.URL.<init>(URL.java:620)[:1.8.0_45]
>>    at java.net.URL.<init>(URL.java:483)[:1.8.0_45]
>>    at java.net.URL.<init>(URL.java:432)[:1.8.0_45]
>>    at org.apache.karaf.features.internal.service.FeatureConfigInstaller.installConfigurationFile(FeatureConfigInstaller.java:210)[9:org.apache.karaf.features.core:4.0.3]
>>    at org.apache.karaf.features.internal.service.FeatureConfigInstaller.installFeatureConfigs(FeatureConfigInstaller.java:120)[9:org.apache.karaf.features.core:4.0.3]
>>    at org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:1156)[9:org.apache.karaf.features.core:4.0.3]
>>    at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:769)[9:org.apache.karaf.features.core:4.0.3]
>>    at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1079)[9:org.apache.karaf.features.core:4.0.3]
>>    at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:975)[9:org.apache.karaf.features.core:4.0.3]
>>    at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_45]
>>    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_45]
>>    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_45]
>>    at java.lang.Thread.run(Thread.java:745)[:1.8.0_45]
>>    Caused by: java.lang.IllegalStateException: Unknown protocol: classpath
>>    at org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:373)[org.apache.felix.framework-5.4.0.jar:]
>>    at java.net.URL.<init>(URL.java:615)[:1.8.0_45]
>>    ... 12 more
>> 
>> 
>> Looks it does not recognize the /classpath/ URL handler.  How can make
>> this work?   I would like the cfg files to be in the bundle that uses it.
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
> 
> -- 
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com


Re: features.xml and classpath URL handler

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

classpath is not a regular URL: AFAIK, classpath: is a specific Spring 
URL (not a blueprint regular URL).

Do you use the blueprint spring extender ?

Regards
JB

On 09/09/2016 03:42 PM, Alex Soto wrote:
> Hello,
>
> I am trying to deploy a config file which is a resource of one of the
> deployed bundles.  I write the features.xml
>
>     <configfile finalname="${karaf.etc}/my.config.cfg">
>     classpath://my :: bundle/my.config.cfg
>     </configfile>
>
>
>
> When I run integration tests (PAX-EXAM) I get this error:
>
>     Error installing boot features
>     java.net.MalformedURLException: Unknown protocol: classpath
>     at java.net.URL.<init>(URL.java:620)[:1.8.0_45]
>     at java.net.URL.<init>(URL.java:483)[:1.8.0_45]
>     at java.net.URL.<init>(URL.java:432)[:1.8.0_45]
>     at org.apache.karaf.features.internal.service.FeatureConfigInstaller.installConfigurationFile(FeatureConfigInstaller.java:210)[9:org.apache.karaf.features.core:4.0.3]
>     at org.apache.karaf.features.internal.service.FeatureConfigInstaller.installFeatureConfigs(FeatureConfigInstaller.java:120)[9:org.apache.karaf.features.core:4.0.3]
>     at org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:1156)[9:org.apache.karaf.features.core:4.0.3]
>     at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:769)[9:org.apache.karaf.features.core:4.0.3]
>     at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1079)[9:org.apache.karaf.features.core:4.0.3]
>     at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:975)[9:org.apache.karaf.features.core:4.0.3]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_45]
>     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_45]
>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_45]
>     at java.lang.Thread.run(Thread.java:745)[:1.8.0_45]
>     Caused by: java.lang.IllegalStateException: Unknown protocol: classpath
>     at org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:373)[org.apache.felix.framework-5.4.0.jar:]
>     at java.net.URL.<init>(URL.java:615)[:1.8.0_45]
>     ... 12 more
>
>
> Looks it does not recognize the /classpath/ URL handler.  How can make
> this work?   I would like the cfg files to be in the bundle that uses it.
>
> Best regards,
> Alex soto
>
>
>
>

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