• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet being Called Twice

 
Dan Lee
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
This is my first post...I'm been having this problem for a while. My application is html/jsp and Servlets. When we hit a button on the jsp to kick off the servlet, it will run correctly and everything looks good. But after 5 minutes of processing, for some reason the servlet kicks off again??? I created a simple program and sure enough it does the same thing:

public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException {
// set action equal to which button was clicked

try {
System.out.println("*******************************");
System.out.println("*Start of Timeout Test Program*");
System.out.println("*******************************");
System.out.println("");

for(int i = 0; i< 20;i++) {
Thread.sleep(60000);
System.out.println("Timeout Test Program: " + i);
}

System.out.println("End of Timeout Test Program");
}
catch (Exception e) {}
}
}

This is running on a Windows NT Server and Websphere 4.0.3.

What makes me believe it's a setting issue is that when I run the same program on different Servers(we have 3 server, development, testing, and Production) the servlet kicks off at different intervals. On our Development Server the servlet kicks off twice after 16 minutes and for our testing and production servers it kicks off twice after 5 minutes.

Any help will be appreciated.
 
Scott Dunbar
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I feel that WebSphere thinks that your servlet is dead and kicks off another one to try to serve the request. Five minutes is a gigantic amount of time for a browser to wait for a response - most won't wait that long.

I'd guess that there is some sort of dead servlet/thread timeout happening and that the configurations between your servers are different.

I'd really encourage a different architecture. Perhaps the servlet can initiate processing and then whatever is doing the real work could put some sort of periodic status in the session. A JSP page could display the status. You could include something like:



in your JSP to have it periodically refresh the status.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic