tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edward W. Rouse" <ero...@vei.net>
Subject Re: Please help: Loading...
Date Fri, 21 Jul 2000 12:04:00 GMT
This is not a direct answer to your question, but...
I never did like loading properties using the getResourceAsStream method. It
gave me problems under JRun. Instead try:

prop.load(new FileInputStream("/app.prop"));

you might need to play with the path to the prop file. I set the path using
servlet contexts, getPath, etc...
Bottom line is, if you can do something without using getClass(), do it.
getClass seems to be one of those methods that doesn't always work exactly the
same way in all situations.
Ed.

Johan Dahlström wrote:

> Hi,
>
> I'm going nuts over Tomcat here... Do any of you with experience with
> Tomcat know why I cannot use getClass().getResourceAsStream() like:
>
> InputStream is=getClass().getResourceAsStream("/app.prop")
> Properties prop =new Properties();
> try
> {
> prop.load(is);
> }
>
> to load propertyfiles from the classpath.
> This works 100% when using LiteWebServer (using the exact same
> JVM/servlet/classpath etc), but when moving to Tomcat, it seems
> to find the file, but it doesn't load... (Tomcat's FAQ-o-matic
> (http://jakarta.apache.org/jyve-faq/Turbine/screen/DisplayTopics/action/SetA
> ll/project_id/2/faq_id/12)
> gives no clue on this.)
>
> Has it anything to do with Tomcat's classloader, or am I barking up the
> wrong tree by assuming that?
>
> Please help!
>
> Any ideas?
>
> TIA
> Regards
> Johan D


Mime
View raw message