I used the following code but it gave me error.
Properties properties = new Properties();
properties.load(getClass().getClassLoader().getResourceAsStream("rcs.properties"));
Error:
java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Properties.java:418)
at java.util.Properties.load0(Properties.java:337)
at java.util.Properties.load(Properties.java:325)
at com.project.rcs.controller.CommonTransaction.home(CommonTransaction.java:244)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
Solution
Properties properties = new Properties();
properties.load(servletContext.getResourceAsStream("/WEB-INF/rcs.properties"));
/*load the property that is inside your file*/
properties.getProperty("urls")
Also if still doesn't work, you need to add a configuration in your weblogic. Include the following script in your weblogic.xml
<container-descriptor>
<show-archived-real-path-enabled>true</show-archived-real-path-enabled>
</container-descriptor>
No comments:
Post a Comment