I have a properties file: hibernate.properties inside default package. I am trying to read it from a class inside another package: com.somepackage.SomeClass.
In a normal desktop application, the following input stream is working:
InputStream is = getClass().getResourceAsStream("/hibernate.properties");
But with my web app (A maven web application created using Netbeans with JSF 2.2 as dependency)
I tried these alternatives:
Using class:
getClass().getResourceAsStream("/hibernate.properties");
Using external context:
FacesContext.getCurrentInstance().getExternalContext().getResourceAsStream("/hibernate.properties");
Using context class loader:
Thread.currentThread().getContextClassLoader().getResourceAsStream("/hibernate.properties");
Each of these return null. How do I read the properties file inside the default package?