Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

getResource returns null but getResourceAsStream work.. pls help.

807589Sep 3 2008 — edited Sep 3 2008
Hi,

I have a web application deployed on a web logic server. I need to read a custom xml file from the public_html\WEB-INF folder.

input = ctx.getResourceAsStream("WEB-INF/myfile.xml"); // works fine
try {
URL u = ctx.getResource("WEB-INF/myfile.xml"); // return null.

Any idea why the url is not working?

2) Is there any way I can read the file outside the servlet context? I mean, in a utility class rather than in a servlet?

Thanks for the help.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 1 2008
Added on Sep 3 2008
1 comment
909 views