The servlets named [LogRecord] and [com.action.service.imp.LogServiceImp] are both mapped to the url
来源:互联网 发布:python web 开发 编辑:程序博客网 时间:2024/04/30 11:19
Caused by: java.lang.IllegalArgumentException: The servlets named [LogRecord] and [com.action.service.imp.LogServiceImp] are both mapped to the url-pattern [/LogRecord] which is not permitted
I am new to sevlets and have no idea what most of the errors mean. What am I doing wrong? I have search for other questions like this on SO but the answers I found didn’t work.
This is my web.xml file:
<servlet> <servlet-name>LogRecord</servlet-name> <servlet-class>com.action.servlet.LogRecord</servlet-class> </servlet> <servlet-mapping> <servlet-name>LogRecord</servlet-name> <url-pattern>/LogRecord</url-pattern> </servlet-mapping>
@WebServlet(urlPatterns="/LogRecord")public class LogServiceImp implements LogDao{ @Override public void delete(log logi) { // TODO Auto-generated method stub } @Override public void update(log logi) { // TODO Auto-generated method stub }
answers:
It could be because"` "you're mixing the web.xml servlets configuration with the annotation based configuration"`", so check that you don't declare the same servlet in the web.xml.Based in your xml you have two options because you are configuring your servlet with annotations you can delete de tags from your web.xml. Or if you want to fix your web.xml you need to delete the start / from the servlet-name tag, it need to match with the before servlet name so:<servlet-mapping> <servlet-name>HelloServlet</servlet-name> <url-pattern>/HelloServlet</url-pattern> </servlet-mapping>原因是因为我同时在注解里面和web.xml里面同时定义了url-pattern,所以导致出错。具体注解怎么影响以及为什么会出现冲突,下来再看看资料。。。
0 0
- The servlets named [LogRecord] and [com.action.service.imp.LogServiceImp] are both mapped to the url
- The servlets named [xxx] and [com.web.xxx] are both mapped to the url-pattern
- The servlets named [UserExit] and [com.fxh.control.UserExit] are both mapped to the url-pattern [/Us
- The servlets named [] and [] are both mapped to the url-pattern [/] which is not permitted
- tomcat报"The servlets named [x] and [y] are both mapped to the url-pattern[z] which is not permitted"
- The servlets named [X] and [Y] are both mapped to the url-pattern [/Z] which is not permitted
- The servlets named [x] and [y] are both mapped to the url-pattern [/JServlet] which is not permitted
- The servlets named [A] and [B] are both mapped to the url-pattern [/servlet/]which is not permitted
- maven创建Web项目启动错误The servlets named [X] and [Y] are both mapped to the url-pattern [/DemoServlet]
- J2EE的TOMCAT服务器报The servlets named [x] and [y] are both mapped to the url-pattern[z] which is not per
- The servlets .. are both mapped to the url-pattern [/ControllerServlet] which is not permitted
- MyEclispe启动Tomcat7时出现错误The servlets named [LoginServlet] and [com.liu.control.LoginServlet] are both
- Error:Application and test application id cannot be the same: both are 'com.xxxxxxx' for debugAndroi
- The source files "*\A.cpp " and "*\A.cpp " are both configured to produce the output file "*\A.obj "
- The source files "*\A.cpp " and "*\A.cpp " are both configured to produce the output file "*\A.obj "
- VC编译错误:The source files "*\A.cpp " and "*\A.cpp " are both configured to produce the output file "*\
- are both configured to produce the output file
- 从AS导入Eclipse项目,报Error:Application and test application id cannot be the same: both are 'com.
- 301重定向
- jquery easyui window 不居中有关问题解决方案 (注意红色字体部分)
- 手机自适应设计代码以及案例
- 圆
- java实现二维码生成,使用Google zxing
- The servlets named [LogRecord] and [com.action.service.imp.LogServiceImp] are both mapped to the url
- ural 2065 - Different Sums
- 快排
- comparator接口与Comparable接口的区别
- 网格
- Java概述
- 凸包
- #155 Minimum Depth of Binary Tree
- 使用光线投射实现相机跟随