0

我正在尝试添加

<context-param>
    <param-name>parentContextKey</param-name>
    <param-value>common.context</param-value>
</context-param>

到我的 web.xml 以允许我从公司的数据库中检索数据但是,在我添加它之后,tomcat 找不到我的应用程序,我不知道为什么会发生这种情况这是我的 web.xml

<web-app id="WebApp_ID" version="2.4" 
xmlns="http://java.sun.com/xml/ns/j2ee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>...</display-name>

    <welcome-file-list>
  <welcome-file>...</welcome-file>
  <welcome-file>...</welcome-file>
    </welcome-file-list>

    <!-- <servlet>
  <servlet-name>mvc-dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>    
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet> -->

<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
      <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
      <url-pattern>*.html</url-pattern>
</servlet-mapping>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
</context-param>    

<!-- <context-param>
    <param-name>parentContextKey</param-name>
    <param-value>common.context</param-value>
</context-param> -->

<listener>
    <listener-class>
       org.springframework.web.context.ContextLoaderListener
    </listener-class>
</listener>


</web-app>

添加 parentContextKey 的 contaxt-param 后,tomcat 找不到我的应用程序,它只显示状态 404 错误,并且没有显示任何消息。

4

0 回答 0