on 04-03-2008 2:44 PM
I have a problem with a small web-app that I try to use on a SAP J2EE server.
The app was developed and tested on JBoss and there it was no problem to read the properties file with the following code:
...
URL resource = getClass().getResource("/WEB-INF/my.properties");
propertyStream = resource.openStream();
Properties properties = new Properties();
properties.load(propertyStream);
...
The properties file is deployed in the WEB-INF directory of the WAR. Seems the class loader can't find that file.
Could anybody explain what's wrong with the above code?
By default, the directory WEB-INF is not part of a web application's classpath.
Put the properties file into WEB-INF/classes and use
URL resource = getClass().getResource("/my.properties");
to load it.
Best regards,
Jens
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
10 | |
8 | |
8 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.