hi,
i also had this problem.
i really dont know why its loaded twice
but my suggestion is to put the code in the service method of the servlet
which is really called only 1 time per session.
this is what i did.
cheers
hype
----- Original Message -----
From: Mike Erickson <[EMAIL PROTECTED]>
To: Tomcat-User (E-mail) <[EMAIL PROTECTED]>
Sent: Friday, June 15, 2001 9:49 PM
Subject: root context
> hi, I have a servlet that I want to map to the root context, I removed
> ROOT.war and copied my war file (foo.war) to the webapps folder and
> added the following to server.xml:
>
> <Context path=""
> docBase="webapps/foo"
> crossContext="false"
> debug="0"
> reloadable="false" >
> </Context>
>
> I can now access the servlet by hitting localhost/servlet/servletname
> but I can also still access the server by hitting
> localhost/foo/servlet/servletname, since the war is still in the webapps
> folder, tomcat still automatically loads the context.. this is what I
> expected, but I've noticed in servlet.log that the servlet init occurs
> twice, once for the root context and once for the "foo" context, this is
> not good.. so I thought that if I disable autoloading the foo context
> would not init unless someone hit it (which is fine with me) so I set
> <load-on-startup> to 0 within the web.xml file inside my war file,
> restarted and I still see both context's running the init, even though I
> expected to see none..
>
> so is this the way to use the root context? and how can I not have 2
> instances of the servlet running?
> have I missed any other tricks when using the root context?
>
> thanks
> Mike Erickson
>
>
>
>
>