L.S.,

Issue https://issues.apache.org/jira/browse/SMX4-862 created to track
your request for adding this to the default installation of
ServiceMix.
FWIW, I don't think the import is really necessary, just adding the
bundle should be enough to make the URL handler available.

Regards,

Gert Vanthienen
------------------------
FuseSource
Web: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



On Wed, Jun 15, 2011 at 3:55 PM, Scott Came <[email protected]> wrote:
> Thanks, JB (and Gert)...importing it in my bundle and then installing pax-url 
> worked.
>
> Since reading resources from the classpath is such a common thing, I'd like 
> to suggest that the next version include pax-url by default.
>
> Thanks again...
> --Scott
>
> -----Original Message-----
> From: Jean-Baptiste Onofré [mailto:[email protected]]
> Sent: Tuesday, June 14, 2011 10:57 PM
> To: [email protected]
> Subject: Re: Classpath protocol in servicemix
>
> Hi Scott,
>
> classpath: is part of Pax URL:
>
> http://ops4j1.jira.com/wiki/display/paxurl/Classpath+Protocol
>
> To be able to use this protocol, you need to import Pax URL in your bundle.
>
> Warning, ServiceMix doesn't include pax-url-classpath by default (it only 
> includes pax-url-mvn, pax-url-war and pax-url-wrap).
> So it means that you need to install the pax-url-classpath bundle which will 
> export the org.ops4j.pax.url.classpath package.
>
> Regards
> JB
>
> On 06/15/2011 07:17 AM, Scott Came wrote:
>> I am using Camel inside servicemix (4.3.0), and have written a Processor 
>> that needs to read a static file.
>>
>> I have placed the file in src/main/resources/static-files/myfile.xml and 
>> verified that it makes it into the bundle jar.
>>
>> In my Processor class, I have the following code:
>>
>> String filePath = "static-files/myfile.xml"; URL staticFileURL = new
>> URL("classpath:/" + filePath); BufferedReader reader = new
>> BufferedReader(new InputStreamReader(staticFileURL.openStream()));
>>
>> Then in my code I'd like to read from this reader and do what I need to do 
>> with the file.
>>
>> Problem is, on the first line above, I get this exception:
>>
>> java.net.MalformedURLException: Unknown protocol: classpath
>>
>> My understanding is that the Pax Classpath Protocol is available in 
>> smx...shouldn't that handle this?
>>
>> BTW I have tried changing the URL to classpath://static-files/myfile.xml and 
>> classpath:static-files/myfile.xml, and always get the same exception.
>>
>> Do I need to install a particular feature/bundle in smx, or declare a 
>> particular dependency in my pom?
>>
>> Thanks for the help.
>> --Scott
>
>
>

Reply via email to