getResourceAsStream returning null

Hi,
I have a pure Java class that is used by both Java webapps and a JRuby
on
Rails webapp. Within the class, we call:

this.getClass().getClassLoader().getResourceAsStream(propFilePath);

This returns a valid input stream for all the pure Java webapps.
Unfortunately, under JRuby it always returns null. I’ve tried variations
such as:

ClassLoader loader

Class.forName(“org.springframework.context.support.ClassPathXmlApplicationContext”).getClassLoader();
loader.getResourceAsStream(propFilePath);

Sadly, that also returns null.

Are there any known issues or special “gotchas” I should be aware of
when
using getResourceAsStream() from a JRuby on Rails app?

-Sean

maybe you have more luck with
Thread.currentThread().getContextClassLoader().getResourceAsStream(propFilePath);

  • Kristian

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs