Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Servlet init() called twice on startup

843841Feb 1 2006 — edited Jul 10 2008
Hi,

SunOne6.1 sp 5 is running my servlet's init() method twice when I put load-on-startup in the web-xml file. Is this a known problem and is there a work around as no amount of synchronising seems to work.

I'm running 2.3.dtd for the default_web.xml file and my entries look like this :-

<servlet>
<servlet-name>RelatisLogin</servlet-name>
<servlet-class>com.MyServlet</servlet-class>
<load-on-startup>7</load-on-startup>
</servlet>

This init method only contains a basic check at the moment :-

public void init()
{
System.out.println("init.....");
}

If I take <load-on-startup> away and run the server then call the servlet via the url it only runs init once.

Thanks in advance for any help.
Chris.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 7 2008
Added on Feb 1 2006
11 comments
3,232 views