maven报错

报错一:

关于解决构建maven项目中报错:Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1...:的方法

1.首先进入仓库下面repository\org\apache\maven\plugins这个目录

2.删除目录下的maven-archetype-plugin文件夹

3.重新加载

https://blog.csdn.net/w19980426/article/details/81275461

报错二

A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]

 

 实际是:

Cannot cast ch.qos.logback.classic.servlet.LogbackServletContainerInitializer cannot be cast to javax.servlet.ServletContainerInitializer 

问题描述
我采用了Servlet3.X,新增加了SPI加载机制,会自动扫描classpath:META-INF/services/javax.servlet.ServletContainerInitializer中的所有这个文件,并加载其中的所有javax.servlet.ServletContainerInitializer的实现类,实现替换web.xml的功能,让你的项目war可以不需要web.xml也能正常在tomcat运行。
然后呢,日志我采用了logback,这个jar中ch.qos.logback.classic.servlet.LogbackServletContainerInitializer就实现了javax.servlet.ServletContainerInitializer,因此tomcat在启动时就会自动加载这个类初始化一些配置。
LogbackServletContainerInitializer是在logback-classic包中的,javax.servlet.ServletContainerInitializer是在javax.servlet-api包中的。
解决方式

保证你的项目依赖中mvn dependency:tree查到的所有servlet-api依赖都是provided,就能启动成功了。

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


原文链接:https://blog.csdn.net/njcctsj/article/details/99572816

http://www.360doc.com/content/18/1013/19/43284313_794447242.shtml

posted @ 2020-04-11 11:48  你猜lovlife  阅读(348)  评论(0)    收藏  举报