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