File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes servlets init method runs twice in WAS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlets init method runs twice in WAS" Watch "servlets init method runs twice in WAS" New topic

servlets init method runs twice in WAS

dean tomlinson
Ranch Hand

Joined: Jan 31, 2002
Posts: 94
does anyone know why / or can confirm that servlets initialise twice in websphere 3.5 advanced.
is this a known bug ? is htere a fix pack for it ? is this supposed to happen (i think not).
also has anyone experienced the fact that you cannot control the jsp page output buffer in the same app server. the jsp directives, and response.flushBuffer() do nothing . is this becsaue websphere isn't a full implementation of a J2EE appserver ?

Joined: May 13, 2002
Posts: 3
Declaring servlet tag in web.xml more than once could cause the container to create new instances also check your calling servlet if it is doing something to create new instance of your servlet because init method being called twice means that there are instances of your servlet
Amir Kamran
Ranch Hand

Joined: Apr 21, 2002
Posts: 48
If u specify a different name of servlet from its class name in web.xml like this
this cause the container to create two instances of the servlet and init() method is called on each instantiation.
I agree. Here's the link:
subject: servlets init method runs twice in WAS
It's not a secret anymore!