Hello there, I trying to test a simple servlet to connect to Oracle DB (8.1.7) and Jboss (3.0.6). I have .properties file (Connection.properties) which contains url, userid and password to be used to connect to DB. I have placed this file into the WEB-INF/classes directory since this directory is automatically on the CLASSPATH. Here is the exact location: C:\java\jboss-3.0.6_tomcat-4.1.18\server\default\deploy\jmx-console.war\WEB-INF\classes (I am using default config of JBoss). Here is what I do to load the connection properties file: ResBundle = ResourceBundle.getBundle("Connection"); But here is what I get: ERROR [STDERR] java.util.MissingResourceException: Can't find bundle for base name Connection, locale en_US How can I narrow down and figure out why my servlet is unable to locate this file? TIA! Amer
Hi Lesse, Thanks for your time. I have a jsp page where I input some values. I want to store these values into a table in the DB. JSP calls the "servlet" (action=contextParh+"/servlet" method="post")that tries to load the "Connection.properties" file as I mentioned in my previous post. Right at this point, I get the exception. This servlet is not part of any application.
Please pardon me for not explaining my issue properly. OK, let me put it this way. All of my stuff I am trying to test is part of a small app. I am using ant to build it and deploy. Everything was going OK until I hit the MissingResourceException. Then I copied my "Connection.properties" file into the WEB-INF/classes folder so that it becomes visible to my servlet (in other words, it is in a directory that is on the CLASSPATH). But my servlet is not able to see it and I am getting this exception. Hope this clears any confusions I might have caused.
Thanks for your time Lasse! I have solved the problem. All I needed to do was place the "Connection.properties" file into "WEB-INF/classes" directory of my app in the development hierarchy. But I wonder is this how we should be doing in real life? Cheers!
Saeed, We do that (put properties files in the classes directory) for struts config files. For other config files (like the db properties), we use a separate /config folder and put this folder in the classpath.