错误解决:Caused by: java.lang.IllegalArgumentException: The servlets named [loginServlet] and [login] ar

简介: 错误解决:Caused by: java.lang.IllegalArgumentException: The servlets named [loginServlet] and [login] ar

org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
...
...
Caused by: java.lang.IllegalArgumentException: The servlets named [loginServlet] and [login] are both mapped to the url-pattern [/login] which is not permitted


原因:是你写了两个 URL 到了同一个 Servlet 了,意思就是你配置了两个 URL 了,你需要删掉一个。比如你在 web.xml 里配置了一次,又用注解配置了一次,那就是两次了。

解决:只需要取其中一种就可以了。

提示


比如你的 web.xml 里已经配置过了,你又用注解配了下面这种方式:

@WebServlet("/login")


其实是会报错的,我感觉你是想配置成这样:

@WebServlet(name = "/login")


哈哈哈!

相关文章
|
8月前
|
网络安全
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://xxxx.svc.cluster.local:8080/xxxx": Connection reset; nested exception is java.net.SocketException: Connection reset 什么原因导致得
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "xxxx.svc.cluster.local:8080/xxxx ": Connection reset; nested exception is java.net.SocketException: Connection reset 什么原因导致得
981 0
|
7月前
|
Java API Maven
【异常】Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlType
【异常】Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlType
61 0
|
7天前
|
JavaScript Serverless API
Serverless 应用引擎操作报错合集之在Serverless 应用引擎中,FC3.0读取response body的时候出现错误提示"Caused by: java.io.IOException: closed"如何解决
Serverless 应用引擎(SAE)是阿里云提供的Serverless PaaS平台,支持Spring Cloud、Dubbo、HSF等主流微服务框架,简化应用的部署、运维和弹性伸缩。在使用SAE过程中,可能会遇到各种操作报错。以下是一些常见的报错情况及其可能的原因和解决方法。
31 3
|
7天前
|
Java 应用服务中间件 Linux
Caused by: java.lang.UnsatisfiedLinkError: /root/jdk1.7.0_45/jre/lib/amd64/xawt/libmawt.so: libXrend
Caused by: java.lang.UnsatisfiedLinkError: /root/jdk1.7.0_45/jre/lib/amd64/xawt/libmawt.so: libXrend
|
7天前
Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘quanZiController‘ method
Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘quanZiController‘ method
17 0
|
7天前
|
Java 开发工具 计算机视觉
Caused by: java.lang.UnsatisfiedLinkError: Can‘t load AMD 64-bit .dll on a IA 32-bit platform【已解决】
Caused by: java.lang.UnsatisfiedLinkError: Can‘t load AMD 64-bit .dll on a IA 32-bit platform【已解决】
6 0
|
7天前
Caused by: java.lang.RuntimeException: java.sql.SQLException: The server time zone value ‘Öйú±ê׼ʱ
Caused by: java.lang.RuntimeException: java.sql.SQLException: The server time zone value ‘Öйú±ê׼ʱ
14 0
|
7天前
|
监控 NoSQL Java
Spring Boot集成Redis启动失败【Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool2.impl.G】
Spring Boot集成Redis启动失败【Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool2.impl.G】
|
7天前
|
SpringCloudAlibaba Java Maven
【问题篇】Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/
【问题篇】Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/
14 2
|
7天前
|
开发工具
933.【开发工具】解决idea:Caused by: java.net.BindException: Add
933.【开发工具】解决idea:Caused by: java.net.BindException: Add
31 2