I tried this, but the getResourceAsStream method always returns null. In
fact, this doesn't work even if I call

<[EMAIL PROTECTED] language="java" import="java.util.*,java.io.*"%>
<%
ClassLoader cl = Thread.currentThread().getContextClassLoader();

InputStream istream =
cl.getResourceAsStream("/usr/local/hthk_tomcat/webapps/test/WEB-INF/classes/
Test.properties");
System.out.println("input stream from context class loader ... :" +
istream );
istream = cl.getResourceAsStream("Test.properties");
System.out.println("input stream from context class loader ... :" +
istream );
istream = cl.getResourceAsStream("Test");
System.out.println("input stream from context class loader ... :" +
istream );
%>
----- Original Message -----
From: "Jacob Kjome" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Sunday, June 27, 2004 9:58 PM
Subject: Re: problem with classpath


You can achieve this by using the thread context class loader..

Thread.currentThread().getContextClassLoader().getResourceAsStream("client1.
properties");

Or, just pass the classloader to the classes that need to load the
properties files and you will get the same effect.

Jake

At 11:44 AM 6/26/2004 +0530, you wrote:
>I wanted some info on using single instance of tomcat for managing multiple
>web applications. I am repeating my question below, please help me out with
>the same ...
>
>I am running an application for multiple clients and the setup is like the
>set of classes being used are common and the property files are different
>for each client. The structure looks as below :
>/usr/local/common_application_classes/ - this folder contains all classes
>/usr/local/properties/client1/ - this folder contains properties of client1
>/usr/local/properties/client2/ - this folder contains properties of client2
>...... etc for all the different clients.
>
>Now, this is a web based application and the classes in the
>/usr/local/common_application_classes/ are being used from the web
>application (servlet, jsp files). The properties files are being used from
>the classes contained in the /usr/local/common_application_classes/ folder.
>
>I want to setup a common tomcat (preferabbly tomcat3, or tomcat4) for all
>these clients, but how should I setup the classpath?
>/usr/local/common_application_classes/ should be in tomcat's classpath.
But,
>properties files are different for different classes, so thought of
creating
>single tomcat and under that, multiple contexts, one for each client and
the
>properties files goes in the respective client's context/WEB-INF/classes.
>But, since the classes accessing the properties files are outside tomcat
>(not in context/WEB-INF/classes), are not being able to access properties
>files - gives MissingResourceException.
>
>Let say, I have a test.jsp file in context /test, which calls a
>TestClass.class file and this TestClass.class file is looking up some
>property file through ResourceBundle. The property file is in
>/test/WEB-INF/classes/ directory. Now, if the TestClass.class is in
>/test/WEB-INF/classes, then it works perfectly fine, but if the
>TestClass.class is outside tomcat (included in tomcat's classpath), then it
>gives MissingResourceException while looking up property file.
>
>Please give me some direction to prceed further
>
>----- Original Message -----
>From: <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Tuesday, June 22, 2004 11:45 AM
>Subject: Re: problem with classpath
>
>
>i am sorry you got a wrong address here  i don't know who you are and what
>you are talking about
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to