JavaEE web apps (Tomcat) and nested context paths
Is it allowed to use n开发者_如何学编程ested context paths like:
- "/" for webapp X
- "/y" for webapp Y?
I have never used that layout before myself, but I need to help someone deploy an existing system, where this layout is used. It has actually worked so far, but suddenly, it doesn't anymore:
- Webapp X still works.
- The static pages for webapp Y still work - but the servlets from webapp Y don't work anymore.
If we deploy webapp X under "/x" instead of "/", then both webapps work perfectly!
The first thing I wonder is: Is the above mentioned layout even allowed at all, or is this really a very shaky setup that depends on some amount of luck? (Where would tomcat look, if I call www.example.com/y/someServlet
? I fear, that it might look in webappX's web.xml?)
The problem was caused by the fact, that webapp X was deployed twice: Once by the specified <context>
element (which set the context path to "/"), and a second time by autoDeploy.
Moving webapp X out of the autodeploy (appBase) folder, into a different folder solved the problem. See also http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Naming
精彩评论