gpt4 book ai didi

tomcat - java.lang.IllegalArgumentException : Servlet mapping specifies an unknown servlet name 异常

转载 作者:行者123 更新时间:2023-11-28 22:28:49 24 4
gpt4 key购买 nike

当我尝试运行我的项目时出现错误

Caused by: java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name dispatcher
at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3156)
at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3135)
at org.apache.catalina.startup.ContextConfig.configureContext(ContextConfig.java:1372)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1176)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:771)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:305)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 6 more

我的web.xml:

<servlet>
<servlet-name>DispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

最佳答案

<servlet-name><servlet-mapping>条目必须与 <servlet-name> 完全相同的 <servlet>条目。

因此,根据您的具体情况,更改 <servlet-mapping> 中的这一行入口

<servlet-name>dispatcher</servlet-name>

<servlet-name>DispatcherServlet</servlet-name>

关于tomcat - java.lang.IllegalArgumentException : Servlet mapping specifies an unknown servlet name 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30915210/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com