Tomcat在eclipse中启动失败,只是一闪而过的可能原因及解决方法

tomcat启动失败,一闪而过在eclipse中

出现的问题描述如下:

用到页面:

  • index.jsp
  • web.xml
  • UploadFile
  • 出现错误
    tomcat无法启动

控制台打印的信息如下:




严重: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
	
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
	
Caused by: java.lang.IllegalArgumentException: The servlets named [uploadFile] and [com.cy.servlet.UploadFile] are both mapped to the url-pattern [/upload] which is not permitted
		
严重: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/UploadFile]]
	
Caused by: java.lang.IllegalArgumentException: The servlets named [uploadFile] and [com.cy.servlet.UploadFile] are both mapped to the url-pattern [/upload] which is not permitted
	
严重: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
	
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]

org.apache.catalina.LifecycleException: Failed to start component 
	
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
	
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
	
Caused by: org.apache.catalina.LifecycleException: A child container failed during start

java.lang.NullPointerException

通过我们分析上面错误的描述,我们确定了有一个点是关键点:

Caused by: java.lang.IllegalArgumentException: The servlets named [uploadFile] and [com.cy.servlet.UploadFile] are both mapped to the url-pattern [/upload] which is not permitted

翻译大概内容就是:在servlet中注解的名字和在web.xml中url-pattern映射的名字相同了,这是不被允许的。
此时我们我们就可以到我们的servlet中和web.xml中检查是不是重复定义了这个名字,如果有的话,就把其中一个去掉,因为加上注解和web.xml中的配置只能选择其中的一种。

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值