Yesterday when the application was developed, it was found that http://www.xxx.com/hospital/list reported 404 errors, while the other paths were correct.
Breakpoint tracking, found/hospital/list did not come in, testing the next/hospital/hospital/list can be accessed.
There is nothing wrong with checking the code, it's weird.
finally suspected of the configuration of Tomcat, check server.xml, found that there is no problem
code is as follows |
copy code |
unpackwars= "true" autodeploy= "true" <context path= "" docbase= "Hospital"/> <valve classname= " Org.apache.catalina.valves.AccessLogValve "directory=" Logs " prefix= "Localhost_access_log." suffix= ". txt" pattern= "%h%l%u%t "%r" %s%b "/> |
My configuration is that all Web projects are under D:\htdocs, and hospital is one of the Web projects.
= =, seems wrong, but the path is hospital, here's the context of Docbase is also hospital, is there any problem?
The only possible reason for this is probably this:
AppBase's directory has a subdirectory called hospital, and when Tomcat makes path parsing, it first analyzes the host's appbase path, finds hospital, Give the request to the servlet under this path.
if the corresponding path is not found under AppBase, the path configured in the context is mapped.
According to this possibility, modify hospital directory name and Docbase configuration, problem Resolution!
This shows: Tomcat's handling of path, the subdirectory of AppBase in host takes precedence over path
in the context