首页 > 代码库 > LINUX环境中tomcat启动错误:The servlets named X and Y are both mapped to the url-pattern [/Z] which is not permitted
LINUX环境中tomcat启动错误:The servlets named X and Y are both mapped to the url-pattern [/Z] which is not permitted
最近有一个问题困扰了我3天,我在windows部署项目无误后,准备将项目发布到阿里云linux服务器上,发现启动报错了:LINUX环境中tomcat启动错误:The servlets named X and Y are both mapped to the url-pattern [/Z] which is not permitted,首先想到的是肯定部署代码或者项目配置文件的事,怀疑有可能是jar包出错了,果不其然,在项目的WebContent\WEB-INF\lib发现了servlet-api.jar 果然删除再次部署。
终于启动成功没有报错,当我满心欢喜打开主页的时候,发现不能跳转页面!!也就是说我的servlet失效了……这三天找了各种土方土法无果,终于发现了一篇文章(原谅我,我找不到原博文了……)解决了问题:因为项目中servlet采用了注解的方式,而在我的web.xml中,存在
<servlet>
<servlet-name>XXX</servlet-name>
<servlet-class>XXX</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>XXX</servlet-name>
<url-pattern>XXX</url-pattern>
</servlet-mapping>
<servlet>
的配置,所以才会报上面的错,将上面这种形式的代码全部注释,大功告成!
LINUX环境中tomcat启动错误:The servlets named X and Y are both mapped to the url-pattern [/Z] which is not permitted