Scenario is the following:
- Developing a jsp application with jdeveloper
- Deploying to Oracle Weblogic
- All files are in the same project
- Source files are inside packages that are inside the
src
folder - Inside the
Resources
folder are two files:menu.json
andTestWS.properties
So, I made a java class that should read menu.json
and return a menu (in html) based on its structure.
When, inside the class, I do this
InputStream i =
Thread.currentThread().getContextClassLoader().
getResourceAsStream("Resources/menu.json");
BufferedReader r = new BufferedReader(new InputStreamReader(i));
The InputStreamReader
constructor throws a NullPointerException
, I suppose because it can't find the file.
Funny thing is, if I try to load TestWS.properties
instead, it loads it just well.
I tried checking the project's properties, manually added both files under Project Source Path -> Resources
, adding the .json
extension to Compiler -> Copy file types to output directory
, renamed, deleted, recreated, changed extension to the json file, deployed to WAR and loaded the project on another machine running weblogic, but to no avail.
Is there anything else I'm missing?