Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 51426 invoked from network); 13 Aug 2002 14:29:46 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 13 Aug 2002 14:29:46 -0000 Received: (qmail 10999 invoked by uid 97); 13 Aug 2002 14:29:50 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 10983 invoked by uid 97); 13 Aug 2002 14:29:50 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 10971 invoked by uid 98); 13 Aug 2002 14:29:49 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Content-return: prohibited Date: Tue, 13 Aug 2002 09:29:19 -0500 From: TOMITA_ALEX_NONLILLY@LILLY.COM Subject: RE: Quick Question To: Tomcat Users List Message-id: MIME-version: 1.0 X-Mailer: Lotus Notes Release 5.07a May 14, 2001 Content-type: MULTIPART/ALTERNATIVE; BOUNDARY="Boundary_(ID_zWmDlvfnSkXNXfX+HYy1Og)" Importance: High X-Priority: 1 (High) X-MIMETrack: Serialize by Router on USMAIL29/AM/LLY(Release 5.0.10 |March 22, 2002) at 08/13/2002 09:29:22 AM, Serialize complete at 08/13/2002 09:29:22 AM X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N --Boundary_(ID_zWmDlvfnSkXNXfX+HYy1Og) Content-type: text/plain; charset=us-ascii Hi all, I'm trying to resolve this problem with all the solutions that you gave me, but it doesn't work... This is what I did: in my java bean (not a servlet), I have this code: public class DbBean { public int Connect() { InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("config.txt"); if (is == null) { return 0; } else { return 1; } } then in my jsp, I called this method, and then I write the value (0 or 1).. The txt file is in "WEB-INF/classes/beans...", because "DbBean" is in a package called "beans", and I start tomcat from TOMCAT_HOME/bin.. When I load the jsp, the method Connect of the DbBean (java bean) returned 0, which means the InputStream is null, but if I put the txt file in TOMCAT_HOME/bin, I had no problem...., the method returned 1.... why is that??.. I'm using Tomcat 3.2 Do I need to set something else in Tomcat??.... thanks again Alex Tomita "Drinkwater, GJ (Glen)" 13/08/2002 08:11 a.m. Please respond to Tomcat Users List To: Tomcat Users List cc: Subject: RE: Quick Question tomcats default directory is where ever you called the startup.sh/bat file. So if you dont use another script to call the startup.sh/bat file tomcats default will be the bin directory. Use this code to find the directory where WEB-INF is. Then you can traverse your directory structure from there. //get context path ServletConfig scon = null ; String workingDir = null; public void init(ServletConfig config) { scon = config ; } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //get working dir ServletContext sc = scon.getServletContext(); workingDir = sc.getRealPath(""); -- To unsubscribe, e-mail: For additional commands, e-mail: --Boundary_(ID_zWmDlvfnSkXNXfX+HYy1Og)--