在tomcat9中运行Spring MVC时与404错误相关的问题
我正在用部署在tomcat9.0中的Intellij IDEA开发一个Spring MVC web应用程序。 将war文件复制到tomcat的webapps文件夹。 可以成功访问localhost:8080和manager webapps。 但是当尝试访问我部署的应用程序时,我遇到了404错误。 所有jsp页面都位于WEB-INF/pages文件夹下。 web.xml文件如下所示在tomcat9中运行Spring MVC时与404错误相关的问题,tomcat,intellij-idea,http-status-code-404,Tomcat,Intellij Idea,Http Status Code 404,我正在用部署在tomcat9.0中的Intellij IDEA开发一个Spring MVC web应用程序。 将war文件复制到tomcat的webapps文件夹。 可以成功访问localhost:8080和manager webapps。 但是当尝试访问我部署的应用程序时,我遇到了404错误。 所有jsp页面都位于WEB-INF/pages文件夹下。 web.xml文件如下所示 <context-param> <param-name>contextConfigL
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring/root-context.xml
</param-value>
</context-param>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.properties</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.css</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.gif</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.js</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
上下文配置位置
/WEB-INF/spring/root-context.xml
log4jConfigLocation
/WEB-INF/log4j.properties
org.springframework.web.util.Log4jConfigListener
org.springframework.web.context.ContextLoaderListener
appServlet
org.springframework.web.servlet.DispatcherServlet
上下文配置位置
/WEB-INF/spring/appServlet/servlet-context.xml
1.
springSecurityFilterChain
org.springframework.web.filter.DelegatingFilterProxy
springSecurityFilterChain
/*
appServlet
/
违约
*.css
违约
*.gif
违约
*.js
index.jsp
我挖了几天,但没有成功。
这有什么不对或遗漏的吗
现在修好了。
URL中缺少应用程序名称作为localhost:8080/app/resource。 在tomcat的管理页面中单击应用程序名称时,url为localhost:8080/resource。 为什么缺少应用程序名称
谢谢。已经解决了。URL中缺少应用程序名称。localhost:8080/app/resource