Hi

I'm trying to read resource files in one of my bolts.
The resource files reside under '/profiles' within my JAR (verified).

I'm using com.google.common.io.Resources like this:
URL profilesUrl = Resources.getResource("profiles");
The returned URL (.toString) equals 
:jar:file:/Users/.../storm/target/storm-1.0-SNAPSHOT.jar!/profiles

Same result with:
URL profilesPath = 
Thread.currentThread().getContextClassLoader().getResource("profiles");

Note the exclamation point (!) after '.jar'.
This is of course a malformed URL, which results in a MalformedUrlException 
when I try to use this URL to open a file (a folder in my case).

Searching through stackOverflow, I've seen cases where people recommended using 
.getResourceAsStream for a file within a jar, but unfortunately the library 
that I'm using requires the path string of the resource, and not a stream.

Obviously people are reading resource files while using Storm, so I must be 
doing something wrong.

Thank you
(Y)

Reply via email to