Well when you call getResourceAsStream, the path is resolved relative to
the package the class is in, so if the servlet and the support class are
in different packages, this would be expected.

What if you call it on the servlet class from the support class?

e.g.,

InputStream is = WhateverTheServletIsCalled.class.getResourceAsStream(
parmPassedFromServlet )

or even better, instead of passing the file name from the servlet to the
support class, why not have the servlet just load the properties and
pass the properties object to the support class?

-- 
Tim Moore / Blackboard Inc. / Software Engineer
1899 L Street, NW / 5th Floor / Washington, DC 20036
Phone 202-463-4860 ext. 258 / Fax 202-463-4863


> -----Original Message-----
> From: aps olute [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, December 19, 2002 1:45 PM
> To: Tomcat Users List
> Subject: Re: How to start a standalone app from a servlet and 
> problems with reading properties file
> 
> 
> 
>  Tim,
>     Thanks for responding. Partial success was I was able to 
> read the properties file using code snippet below in the 
> servlet init() method:
> 
>   Properties p = new Properties();
>   InputStream is = getClass().getResourceAsStream(configFileName);
> //configFileName is test.properties
>   p.load(is)
> 
> This property file is loaded and parsed for a property needed 
> by a support class. The parameter read is passed to the 
> support class. When doing exact same InputStream is = 
> getClass().getResourceAsStream(parmPassedFromservlet); in the 
> support class, Tomcat does not start. I posted this earlier 
> last week on: 
> http://marc.theaimsgroup.com/?l=tomcat-user&m=103982860916736&;
w=2

Basically, I am facing two issues, 1) dependent on where I start Tomcat
from and  2) Using getResourceAsStream() fails in the support class. Any
tips would be appreciated. Thanks.

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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


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

Reply via email to