Hi, Recently encountered one funny scenario, where servlet is being called morethan once. The flow something looks like,
POST JSP ---> Servlet ---> Business Object (BO) Actually JSP passes necessary parameters (about 5) to the Servlet and this Servlet calls BO with request parameters, BO queries the Database and gets about 1000 Emails and calls some utility program to send parameters to all the 1000 Emails. Since this sending of content to recipients taking around 15-20 mins including establishing and closing SMTP connection for every 10 emails, in this process the user in the front-end sees the processing until job finishes (ie., after 15-20 mins). So far is fine except sometimes observed Servlet being loaded multiple times which enables the BO to send Emails morethan once to the recipient which is ERROR. The log file shows Servlet.init() being called morethan once but user in front-end submitted the request only once. This problem is intermittent bcoz sometime is okay it submits only once. Dont quite understand the problem. And also there's no clustering environment it just uses one instance of WLS. Any ideas about this behaviour ?? Thanks.
One known cause of servlet init() being called more than once has to do with the servlet being addressed multiple ways. For example - using the "servlet/" URL nomenclature that goes through the "invoker" servlet while also having a direct URL defined in web.xml. Bill
Joined: Oct 31, 2000
Thanks Brogden. What could be other reason as only one instance of Servlet is addressed inside properties file, we're using WLS5.1 Cheers, Anil