代码改变世界

使用pom.xml遇到的问题

2017-12-05 21:58  HeHongtao-key  阅读(353)  评论(0编辑  收藏  举报

1.xml文件中混入其他字符

进入pom.xml文件,提示信息如下:

Element 'beans' cannot have character [children], because the type's content type is element-only

解决方法:去掉因误操作插入的其他字符。

2.项目启动失败

Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat

解决方法:

在xml文件中增加以下内容,

<dependency>
<groupId><groupId></groupId>
<artifactId><some dependency></artifactId>
<version><version></version>
<exclusions>
    <exclusion>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
    </exclusion>
</exclusions>

 原因是servlet在多个依赖中有不同的实现,需要在这些依赖中排除掉。