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é <[email protected]> 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é <[email protected]
>>> <mailto:[email protected] <mailto:[email protected]>>> 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é
>>> [email protected] <mailto:[email protected]>
>>> <mailto:[email protected] <mailto:[email protected]>>
>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>> Talend - http://www.talend.com <http://www.talend.com/>
>>
>
> --
> Jean-Baptiste Onofré
> [email protected] <mailto:[email protected]>
> http://blog.nanthrax.net <http://blog.nanthrax.net/>
> Talend - http://www.talend.com <http://www.talend.com/>