This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlets init method runs twice in WAS" Watch "servlets init method runs twice in WAS" New topic
Author

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 ?
FARRUKH ISMAIL
Greenhorn

Joined: May 13, 2002
Posts: 3
Hallo
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
Hello!
If u specify a different name of servlet from its class name in web.xml like this
<servlet>
<servlet-name>
abc
</servlet-name>
<servlet-class>
xyz
</servlet-class>
</servlet>
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: http://aspose.com/file-tools
 
subject: servlets init method runs twice in WAS