tomcat遇到的问以及解决方案
使用tomcat导入servlet-api座标
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<hostName>localhost</hostName> <!-- Default: localhost -->
<port>8080</port> <!-- 启动端口 Default:8080 -->
<path>/</path> <!-- 访问应用路径 Default: /${project.artifactId}-->
<uriEncoding>UTF-8</uriEncoding> <!-- uri编码 Default: ISO-8859-1 -->
</configuration>
</plugin>
- 使用插件遇到的问题
Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/catalina/loader/WebappClassLoader) previously initiated loading for a different type with name "javax/servlet/ServletContext"
- 解决方案: 也有可能是jar包冲突导致的原因
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.3</version>
<scope>provided</scope><!--加入该标签-->
</dependency>