You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ray Pitmon <rp...@digitalcyclone.com> on 2003/04/16 01:41:20 UTC

two servlets sharing the same properties? (scope issue?)

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


need old jserv1.1 with EAPI?

Posted by "Horace A. Vallas, Jr." <ha...@hav.com>.
Does anbyone know the location of binaries?

tried a quick build from 1.1.2 source but fails with...

make[5]: Entering directory `/usr/local/src/ApacheJServ-1.1.2/src/java/org/apache/jserv'
Compiling JServServletManager.java ...
JServServletManager.java:304: cannot resolve symbol
symbol  : constructor AdaptiveClassLoader  (java.util.Vector,java.lang.ClassLoader)
location: class org.apache.java.lang.AdaptiveClassLoader
             loader = new AdaptiveClassLoader(repository,
                      ^
1 error


-- 
Horace                            ...once known as "Kicker" :-)
================================================================
...drop by and chat if I'm online       http://www.hav.com/chat/
================================================================
Horace Vallas   hav.Software                 http://www.hav.com/
                 P.O. Box 354                         hav@hav.com
                 Richmond, Tx. 77406-0354     voice: 281-341-5035
                 USA                            fax: 281-341-5087

Thawte Web Of Trust Notary in SW Houston, Tx.
http://www.hav.com/?content=/thawteWOTnotary.htm
================================================================
What is a Vet? ... He is the barroom loudmouth, dumber than five
wooden planks, whose overgrown frat-boy behavior is outweighed a
hundred times in the cosmic scales by four hours of exquisite
bravery near the 38th parallel. ...   - Unknown
================================================================

Re: two servlets sharing the same properties? (scope issue?)

Posted by Ray Pitmon <rp...@digitalcyclone.com>.
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