Webapp in Jetty can't find properties file after running a couple days
- by Cuga
I have a webapp running in Jetty on Mac OS 10.6.
After a few days of it running and without the server losing power or rebooting, it seems to stop working saying it can't find a properties file.
This properties file is included inside the .war file deployed to the /webapps directory.
If I restart Jetty as the superuser the web service works again just fine.
Can anyone lend any advice to what's going on and how I can fix it? The error being shown when it isn't working is:
Problem accessing /my-web-service. Reason:
INTERNAL_SERVER_ERROR
Caused by:
java.lang.NullPointerException
at com.company.service.Dao.readFromPropertiesFile(BwDao.java:35)
at com.company.service.ServletHandler.doGet(ProxyClass.java:66)
...
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Here's where the properties files exist that it's trying to read from the .war file:
And this is how the properties are being read from the classpath:
Properties properties = new Properties();
properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream(
"app.properties"));
Again, this does work just fine if I have just restarted the server, but it seems to fail after running a few days.