刚开始尝试写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. springboot集成log4j2 + logstash 异步输出日志

    一. spring boot 集成log4j2 1.maven引入jar包 <dependency> <groupId>org.springframework.boot< ...

  2. 通过Value获取Map中的键值Key的四种方法

    1 简介 我们都知道Map是存放键值对<Key,Value>的容器,知道了Key值,使用方法Map.get(key)能快速获取Value值.然而,有的时候我们需要反过来获取,知道Value ...

  3. Oracle“ORA-00979:不是GROUP BY 表达式”解决方式

    今天在工作中碰到一个问题,用group by 语句进行分组时出现ORA-00979错误. 代码如下: select R.ORDER_NO, R.PRODUCT_CODE, R.REGION_NO, R ...

  4. Python文字转换语音,让你的文字会「说话」,抠脚大汉秒变撒娇萌妹

    作者 | pk 哥 来源公众号 | Python知识圈(ID:PythonCircle) APP 也有文字转换为语音的功能,虽然听起来很别扭,但是基本能解决长辈们看不清文字或者眼睛疲劳,通过文字转换为 ...

  5. 用js给元素增加链接

    <!DOCTYPE html><html>    <head>        <meta charset="UTF-8">      ...

  6. 跳跳棋——二分+建模LCA

    题目描述 跳跳棋是在一条数轴上进行的.棋子只能摆在整点上.每个点不能摆超过一个棋子. 我们用跳跳棋来做一个简单的游戏:棋盘上有3颗棋子,分别在a,b,c这三个位置.我们要通过最少的跳动把他们的位置移动 ...

  7. vue之注册自定义的全局js方法

    前端开发的时候,总会需要写一些js方法,在vue框架中为了方便使用,可以考虑注册一个全局的js方法,下面是注册步骤: 1.0 可以在assets文件中的js文件下面新建一个js文件,如:yun.js- ...

  8. Resource Path Location Type Target runtime Apache Tomcat v6.0 is not defined(项目报错)已解决

    我换了开发工具后,导入的项目不是这里报错就是那里不错.不过,我喜欢.在tomcat里面部署项目后,定位到报错行时,总是提示我这句话:Description Resource Path Location ...

  9. Groovy单元测试框架spock基础功能Demo

    spock是一款全能型的单元测试框架. 最近在做单元测试框架的调研和尝试,目前确定的方案框架包括是:spock,Junit,Mockito以及powermock.由于本身使用Groovy的原因,比较钟 ...

  10. nyoj 458-小光棍数 (471)

    458-小光棍数 内存限制:64MB 时间限制:1000ms 特判: No 通过数:6 提交数:6 难度:1 题目描述: 最近Topcoder的XD遇到了一个难题,倘若一个数的三次方的后三位是111, ...