刚开始尝试写Servlet代码,第一天就碰到这个错误,在网上找了很多资料才找到解决办法,在此记录一下。

org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/FirstServlet]]

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)

at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1247)

at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1897)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at java.lang.Thread.run(Thread.java:745)

Caused by: java.lang.IllegalArgumentException: The servlets named [LoginServlet] and [com.liu.control.LoginServlet] are both mapped to the url-pattern [/LoginServlet] which is not permitted

at org.apache.catalina.deploy.WebXml.addServletMapping(WebXml.java:293)

at org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:2410)

at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2085)

at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2046)

at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2039)

at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2039)

at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2039)

at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1304)

at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:889)

at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386)

at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)

at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5380)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

... 10 more

五月 10, 2017 6:59:01 下午 org.apache.catalina.startup.HostConfig deployDirectory

严重: Error deploying web application directory E:\MyEclipse2016文件\.metadata\.me_tcat7\webapps\FirstServlet

java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/FirstServlet]]

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)

at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1247)

at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1897)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at java.lang.Thread.run(Thread.java:745)

在网上找到的答案大部分是说web.xml配置错误,最后在一个博客中找到了最终解决办法。原来是因为/LoginServlet一个请求映射了

[LoginServlet] and [com.liu.control.LoginServlet] 两个Servlet。

就是这个servlet已经在下面定义过了,

@WebServlet("/LoginServlet")//在这里自动定义了

public class LoginServlet extends HttpServlet {
private static final long serialVersionUID = 1L;

所以在web.xml文件中就不需要再重复定义了,将servlet-mapping属性删除即可。

MyEclispe启动Tomcat7时出现错误The servlets named [LoginServlet] and [com.liu.control.LoginServlet] are both的更多相关文章

  1. kvm 启动libvirtd时出现错误

    kvm 启动libvirtd市出现错误: /etc/init.d/libvirtd start启动 libvirtd 守护进程:libvirtd: relocation error: libvirtd ...

  2. 启动servlet报错:The servlets named [DemoServlet] and [main.java.com.wlf.demo.servlet.DemoServlet] are both mapped to the url-pattern [/hello] which is not permitted

    先看具体错误日志: [2019-04-26 09:29:25,484] Artifact demo-servlet:war: Artifact is being deployed, please wa ...

  3. VMware启动Centos时出现错误Cannot open the disk 'xxxxxxx.vmdk' or one of the snapshot disks it depends on. .

    今天拔装虚拟机的硬盘的时候,没有关掉虚拟机,导致虚拟打开的时候出现:Cannot open the disk 'xxxxxxx.vmdk' or one of the snapshot disks i ...

  4. Windows 安装启动apache时出现错误的解决方法

    配置安装Apache主服务发生错误:(OS 5)拒绝访问.  : AH00369: Failed to open the Windows service manager, perhaps you fo ...

  5. 变色龙启动MAC时,错误信息“ntfs_fixup: magic doesn't match:”的解决办法

    如下是变色龙启动的bdmesg,解决办法就是用mac的磁盘管理器,对ntfs分区进行检验修复.需要安装ntfs的驱动支持. 实在不行,就删除调整过大小的分区,重新用Windows的磁盘管理器重新分区. ...

  6. Anaconda中启动Python时的错误:UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 553

    今天,在Anaconda prompt启动python遇到了如下错误: UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xaf in positi ...

  7. Celery 在Windows下启动worker时出现错误:ValueError: not enough values to unpack (expected 3, got 0)

    在公司Linux环境下没有出现问题,在回到家后直接在Windows10下运行出现错误: ValueError: not enough values to unpack (expected 3, got ...

  8. 启动Tensorboard时发生错误:class BeholderHook(tf.estimator.SessionRunHook): AttributeError: module 'tensorflow.python.estimator.estimator_lib' has no attribute 'SessionRunHook'

    报错:class BeholderHook(tf.estimator.SessionRunHook):AttributeError: module 'tensorflow.python.estimat ...

  9. eclipse启动时报告错误:Java was started but returned exit code=-805306369

    这两天也没改过eclipse和java的配置,但eclipse启动时报告错误:Java was started but returned exit code=-805306369 后来在eclipse ...

随机推荐

  1. 微服务SpringCloud之GateWay服务化和过滤器

    Spring Cloud Gateway 提供了一种默认转发的能力,只要将 Spring Cloud Gateway 注册到服务中心,Spring Cloud Gateway 默认就会代理服务中心的所 ...

  2. CSPS模拟 94

    以后干脆不要在准备提交的代码里放调试信息. 再也不忘删printf可是memset还是看不见... T1 玄学错误,不想研究.skyh帮我研究出来了.HACKDATA:1 1 T2 傻逼做法. 发现一 ...

  3. Css3动画-@keyframes与animation

    一.@keyframe 定义和用法 @keyframes是用来创建帧动画的,我们通过这个属性可以用纯css来实现一些动画效果. 一般格式是: @keyframes 动画名称{ 0%{ 动画开始时的样式 ...

  4. Python实现发送邮件代码

    代码如下: # -*- coding: utf-8 -*- #!/usr/bin/env python # @Time : 2017/12/22 17:50 # @Desc : # @File : m ...

  5. Spring源码解析之@Configuration

    @Configuration简介 用于标识一个类为配置类,与xml配置效果类似 用法简介 public class TestApplication { public static void main( ...

  6. Non-local Neural Networks 原理详解及自注意力机制思考

    Paper:https://arxiv.org/abs/1711.07971v1 Author:Xiaolong Wang, Ross Girshick, Abhinav Gupta, Kaiming ...

  7. 浅谈Node中的模块化

    关于这篇文章早在去年年初的时候我就想写一片关于模块化的文章,但是推到现在才来完成也有很多好处,巩固之前对Node的理解.毕竟在我目前的项目中还没有一款项目是用到了Node开发,所以导致我对Node的一 ...

  8. 领扣(LeetCode)删除链表的倒数第N个节点 个人题解

    给定一个链表,删除链表的倒数第 n 个节点,并且返回链表的头结点. 示例: 给定一个链表: 1->2->3->4->5, 和 n = 2. 当删除了倒数第二个节点后,链表变为 ...

  9. vuejs学习之项目结构解读

    转载:https://www.cnblogs.com/chenleideblog/p/10484554.html 关于Vue中main.js.APP.vue和index.html之间关系 在初始化vu ...

  10. 更改input标签的placeholder的样式

    主要是要区别不同浏览器的不同css类 在input框中有时想将输入的字和placeholder设为不同的颜色或其它效果,这时就可以用以下代码来对placeholder进行样式设置了. input::- ...