Hello Anton,

>> Can anybody tell me why the init method can be called twice in a
>> servlet. I
>> am loading the servlet on startup and init is first called there.
>> 
>> The first request to the servlet then calls the same init method again?
>> Please help. I cannot init twice.
>> 

AB> This topic was discussed about a week ago, and Craig gave perfect and clear
AB> answer (as always). Try mail archives.
AB> As far as I remember init() can be called multiple times if:
AB> 1. TC4 and servlet implements SingleThreadModel
AB> 2. servlet is called by invoker (something like http://myhost/servlets/myServlet)
AB> 3. init() throws exception (that I don't remember exactly)

Oh, yes. Craig answered to me as denoted above, but I still didn't solved
this problem. Partially I did not returned to my problem yet, but I
think that no any of 3 described reasons match my case.

2: I've checked many times before I've asked that question. My init
servlet is called _once_. There's only one reference to the init
servlet class in _one_ of my web.xml files.

3: init doesn't throws exceptions : log files is clear. Also there's
a thread that starts from init(), and the thread remains alive (I
think in case of exception this child thread must die).

1: My init servlet is extended from the Struts init servlet,
so it doesn't implements SingleThreadModel, as Craig said.

Moreover, I said, I declared a static variable in my init servlet
class, and affected this variable, and traced this variable state into
log file.
And I certainly know: I have several instances of this variable !!!
Each thread of init servlet has own static variable !!!

Again:
OS: RHL
JDK: sun, 1.3

I'll show my configs and code if anybody will be so greatful to deep
into.


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to