I agree with you. But little starnge thing is if there are two seperate JVMs I should see them runing in my UNIX box right? I use 'ps -ef | grep java' to check this, only one java process is runing. Is this means only one JVM? Let me print out the log file as follows and see if you can have more idea about the problem.

When I start Tomcat:
Starting service Tomcat-Standalone
Apache Tomcat/4.0.3
##### p2_test Connection pool start on pronettest!!!!
##### count = 1
Starting service Tomcat-Apach
Apache Tomcat/4.0.3

When I start Apache:
##### p2_test Connection pool start on pronettest!!!!
##### count = 1

Thanks!

Ching-yu


Dodd Gatsos wrote:

Well, my problem was with the servlet's init method being called every time
the servlet was called. Old WebSphere 2.0 problem.

If your static counters are not being incremented then that suggests that
your "two" servlets are being instantiated in two seperate JVMs.

It almost sounds as if you are starting Tomcat through Apache and also
starting Tomcat as stand-alone as well.

----- Original Message -----
From: "Ching-yu Hsueh" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 3:41 PM
Subject: Re: Why web.xml in my application runs twice when use Apache as Web
Server?



Dood idea! Dodd.

I tried as you mentioned, but still starts the pool twice. The servlet
to start the pool in the Init() method. I had a static boolean variable
to check if the pool is already exists and another static counter to
check how many times my Init() method get called. It looks like that the
servelet get called twice, so the Init() method get called once in each
servlet call. The static boolean varaiable are in the same status and
the static count has the same number in two servlet calls. I really
don't understand why? Will you please tell me in more detail how you
solve this problem in your environment? Your great help is highly
appreciated.

Thanks!

Ching-yu

Dodd Gatsos wrote:


The servlet is starting the ConnectionPool in the Init() method?

It may be calling the Init method twice. Don't know why this might be
happening, but you may try to set a static boolean condition around the
creation of the ConnectionPool and set it to false inside. That way if

it

gets called twice it won't re-run. I've had to do this inside Init()
methods in WebSphere.


Dodd

----- Original Message -----
From: "Ching-yu Hsueh" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 9:58 AM
Subject: Why web.xml in my application runs twice when use Apache as Web
Server?





Hi,

I have a servlet to start the ConnectionPool, which I wrote and
registered it in web.xml of my application. I set the <load-on-startup>.
So, the ConnectionPool should be started when Tomcat starts.

My question is when Tomcat used as stand-alone, the ConnectionPool
started once. But when Apache was used as Web Server, the ConnectionPool
starts twice: once at the time to start Tomcat, the other one at the
time to start Apache. Therefore, the number of Connections doubled. I
doubt may be two web servers were used: Tomcat mini Web server and
Apache Web server. So, I comment out the port 8080 connector in
server.xml. But ConnectionPool still started twice. It looks like that
web.xml run twice. Is any one can tell me when use Apache as Web Server
how can run web.xml only once?

Any help to this question shall be highly appreciated.

Ching-yu Hsueh




--
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]>







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






Reply via email to