This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm running Tomcat 5.5.9 and I'm trying to load a properties file, "sql.properties" from within my application. I searched the previous threads and tried those suggestions, but it's just not working for me. Here is the code that I am trying to run.
It is finding that inStream is null. I tried putting sql.properties in the WEB-INF/classes directory as well as the directory that this class is in and it's still not finding it. Any ideas? Thanks.
Look at the third item on this list for instructions on loading properties files using ServletContext.getResourceAsStream. Tomcat uses custom classloaders and may not work the way your expecting it to.
The link also shows how to load the properties file as a resourceBundle.