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