美文网首页
两个错误的解决方案

两个错误的解决方案

作者: 赵镇 | 来源:发表于2018-07-22 11:46 被阅读10次

Element web-app must be declared

这是部署描述符版本问题导致的

解决办法换成如下配置:

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee     http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">

参考Element web-app must be declared错误解决办法

maven请求servlet报cannot be cast to javax.servlet.Servlet 解决

在pom.xml的servelet-api里面加入

<scope>provided</scope>

完整内容

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>

原因,依赖jar包跟tomcat冲突。

参考maven请求servlet报cannot be cast to javax.servlet.Servlet 解决

相关文章

网友评论

      本文标题:两个错误的解决方案

      本文链接:https://www.haomeiwen.com/subject/svelmftx.html