I have a very annoying problem with tomcat 6:
ServletContext.getContext() always returns null if I call the method from the
"root" context, i.e. the context I have defined with path="/" in my server.xml.
I also tried setting path="" (I read that this could fix problems in tomcat 5 -
I'm using tomcat6 but a thought it might help).
Here are the context definitions of my server.xml:
<Context path="/context2" docBase="/absolute/path/to/a/folder/"
/>
<Context path="/ " docBase="..." crossContext="true"
reloadable="true"/>
I also tried defining both contexts with crossContext="true". If a change the
path from the second context to something else than "/" or "" everything works
fine. Is this a tomcat bug?
My workaround now is to use apache's mod_rewrite to handle requests on "/".
Regards
Jan