Scott,

As far as I know, the Pax URL Classpath handler is not available by
default in ServiceMix.  You can install it with osgi:install -s
mvn:org.ops4j.pax.url/pax-url-classpath/1.2.4

Regards,

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



On Wed, Jun 15, 2011 at 7:17 AM, Scott Came <[email protected]> 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