RE: Help, why is my servlet calling init twice?

2004-08-11 Thread Shapira, Yoav
Hi,
Also, if you have two servlet tags in web.xml, two instances are
guaranteed to be created and initialized by Tomcat.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: QM [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 10, 2004 8:29 PM
To: Tomcat Users List
Subject: Re: Help, why is my servlet calling init twice?

On Tue, Aug 10, 2004 at 05:16:24PM -0500, Randy Paries wrote:
: If I remove the load-on-startup tag from the web.xml, then the
first
time
: I call the servlet the init gets only called once

What's your evidence that init() is being called twice? I'm after log
messages, etc.  Are you sure the entire context (webapp) isn't being
loaded twice due to autoDeploy or loadOnStartup?

btw, the servlet spec gives containers leeway to create as many
instances of a given servlet as they see fit; so your servlet may very
well be init()'d multiple times within a context's runtime.

If you're using a servlet+load-on-startup to perform some one-time
context initialization, look into ServletContextListener instead.  It
was designed with that in mind.

-QM

--

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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


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



Help, why is my servlet calling init twice?

2004-08-10 Thread Randy Paries
Hello,

I am hoping someone can shed some light on this 

I am using Tomcat jakarta-tomcat-5.0.24 on RH9

When I have load-on-startup1/load-on-startup set in  my web.xml

My init in the servlet that I have this set for gets called twice. It is so
bizarre.

But, in my devel env it does not (XP, tomcat 5, intellij)

If I remove the load-on-startup tag from the web.xml, then the first time
I call the servlet the init gets only called once

Any ideas?

Randy



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



RE: Help, why is my servlet calling init twice?

2004-08-10 Thread Benjamin Armintor
This just means that Tomcat has instantiated your servlet class twice.
The load-on-startup tag only indicates the order that the servlets
should be started in.

Benjamin J. Armintor
Operations Systems Specialist
ITS-Systems: Mainframe Group
University of Texas - Austin
tele: (512) 232-6562
email: [EMAIL PROTECTED]
 


-Original Message-
From: Randy Paries [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 10, 2004 5:16 PM
To: 'Tomcat Users List'
Subject: Help, why is my servlet calling init twice?


Hello,

I am hoping someone can shed some light on this 

I am using Tomcat jakarta-tomcat-5.0.24 on RH9

When I have load-on-startup1/load-on-startup set in  my web.xml

My init in the servlet that I have this set for gets called twice. It is
so bizarre.

But, in my devel env it does not (XP, tomcat 5, intellij)

If I remove the load-on-startup tag from the web.xml, then the first
time I call the servlet the init gets only called once

Any ideas?

Randy



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


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



Re: Help, why is my servlet calling init twice?

2004-08-10 Thread QM
On Tue, Aug 10, 2004 at 05:16:24PM -0500, Randy Paries wrote:
: If I remove the load-on-startup tag from the web.xml, then the first time
: I call the servlet the init gets only called once

What's your evidence that init() is being called twice? I'm after log
messages, etc.  Are you sure the entire context (webapp) isn't being
loaded twice due to autoDeploy or loadOnStartup?

btw, the servlet spec gives containers leeway to create as many
instances of a given servlet as they see fit; so your servlet may very
well be init()'d multiple times within a context's runtime.

If you're using a servlet+load-on-startup to perform some one-time
context initialization, look into ServletContextListener instead.  It
was designed with that in mind.

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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