Priority issues for AppBase and Docbase in Tomcat configuration

Source: Internet
Author: User
Tags tomcat

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 &quot;%r&quot; %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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.