tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ray Pitmon ...@digitalcyclone.com>
Subject Re: two servlets sharing the same properties? (scope issue?)
Date Thu, 17 Apr 2003 22:27:25 GMT

I figured it out.  The static keyword is EVIL!!  Stay away from static 
and you'll be fine.


On Tue, 2003-04-15 at 18:41, Ray Pitmon wrote:
> Hi,
> 
> I am running TC3.3.
> 
> I have two servlets, that both use the same class, and both read in
> properties files that are similar.
> 
> What's happening is that when the second servlet initializes, reading
> the properties from a file, it changes the configuration of the first
> servlet.
> 
> Basically, here's what my two similar servlet defs in my web.xml file
> look like:
> 
> <servlet>
>  <servlet-name>
>    ServletNumberOneIndex
>  </servlet-name>
>  <servlet-class>
>    com.digcy.server.WhatEver
>  </servlet-class>
>  <init-param>
>    <param-name>properties</param-name>
>      <param-value>/home/httpd/html/WEB-INF/lib/one.prop</param-value>
>  </init-param>
> </servlet>
> 
> <servlet>
>  <servlet-name>
>    ServletNumberTwoIndex
>  </servlet-name>
>  <servlet-class>
>    com.digcy.server.WhatEver
>  </servlet-class>
>  <init-param>
>    <param-name>properties</param-name>
>      <param-value>/home/httpd/html/WEB-INF/lib/two.prop</param-value>
>  </init-param>
> </servlet>
> 
> It seems like some sort of scope issue.  Is this normal? Someone
> suggested I look for things as static in the class, and there's nothing
> near where the properties files are read in.  Do I have to specify that
> each servlet needs to not share with the others..?  These servlets are
> in the same context, and they have different values for the same keys in
> the properties files, but they are different servlets..
> 
> thanks for any help,
> 
> -Ray
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message