I configure connection to database with class DAOProperties.java:
public class DAOProperties {
private static final String PROPERTIES_FILE = "web/WEB-INF/dao.properties";
private static final Properties PROPERTIES = new Properties();
static {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
InputStream propertiesFile = classLoader.getResourceAsStream(PROPERTIES_FILE);
if(propertiesFile == null) {
throw new DAOConfigurationException("Properties file '" + PROPERTIES_FILE + "' is missing in classpath.");
}
try {
PROPERTIES.load(propertiesFile);
} catch (IOException e) {
throw new DAOConfigurationException(
"Cannot load properties file '" + PROPERTIES_FILE + "'.", e);
}
}
But when I run my app on localhost tomcat show me error HTTP Status 500 with root cause:
dao.DAOConfigurationException: Properties file 'web/WEB-INF/classes/dao.properties' is missing in classpath.
...
I tried to change location of my properties file but it didn't help. How to solve this problem?