• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getResourceAsStream returning null

 
Sat Nar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am reading a config file from a java program. Below is the code.

str = loader.getResourceAsStream(filename);

It is returning a null. I have placed the file under WEB-INF and also tried placing it under WEB-INF classes. But still its returning a null. Kindly help me out.

Thanks
 
Santosh Raveendran
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you make your requirement clear,why You need to read it as byte stream?
do You need to send this file to some location or response or You need to read the data from the file

-------------
Santhosh
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps it might be useful for you to let us know what filename is set to?

And if you are placing the file under WEB-INF rather than in the classpath, you should be using the ServletContext rather than the class loader.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic