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



 

Reply via email to