使用maven的tomcat外掛啟動時報錯問題
1、最近在學習Apache下的一個許可權框架shiro。在eclipse上建了一個web專案,使用maven引入對應的依賴。在spring和springMVC等配置都準備好後,準備跑一下JSP頁面確保環境沒問題,跑的時候使用的也是maven的tomcat7外掛,在pom.xml的外掛配置處配置如下:
2、然後在eclipse中使用maven命令執行,如下:<build> <finalName>shiro</finalName> <!-- tomcat7 配置外掛 --> <plugins> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <configuration> <port>8080</port> <path>/</path> <uriEncoding>UTF-8</uriEncoding> </configuration> </plugin> </plugins> </build>
clean tomcat7:run
3、此時報錯,如下:
4、解決辦法如下:[INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for com.shiro.test.spring:shiro-test-spring:war:0.0.1-SNAPSHOT [WARNING] 'build.plugins.plugin.version' for org.apache.tomcat.maven:tomcat7-maven-plugin is missing. @ line 114, column 12 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building shiro-test-spring Maven Webapp 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ shiro-test-spring --- [INFO] Deleting D:\WorkSpace\EclipseWorkSpace\shiro-test-spring\target [INFO] [INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) > process-classes @ shiro-test-spring >>> [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ shiro-test-spring --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 2 resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ shiro-test-spring --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) < process-classes @ shiro-test-spring <<< [INFO] [INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) @ shiro-test-spring --- [INFO] Running war on http://localhost:8080/ [INFO] Creating Tomcat server configuration at D:\WorkSpace\EclipseWorkSpace\shiro-test-spring\target\tomcat [INFO] create webapp with contextPath: 一月 02, 2017 2:01:36 下午 org.apache.coyote.AbstractProtocol init 資訊: Initializing ProtocolHandler ["http-bio-8080"] 一月 02, 2017 2:01:36 下午 org.apache.catalina.core.StandardService startInternal 資訊: Starting service Tomcat 一月 02, 2017 2:01:36 下午 org.apache.catalina.core.StandardEngine startInternal 資訊: Starting Servlet Engine: Apache Tomcat/7.0.47 一月 02, 2017 2:01:38 下午 org.apache.catalina.core.ContainerBase startInternal 嚴重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) ... 6 more 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" at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1191) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1669) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547) at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:167) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5423) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 6 more 一月 02, 2017 2:01:38 下午 org.apache.catalina.core.ContainerBase startInternal 嚴重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.startup.Tomcat.start(Tomcat.java:341) at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.startContainer(AbstractRunMojo.java:1238) at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.execute(AbstractRunMojo.java:592) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 6 more [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.132 s [INFO] Finished at: 2017-01-02T14:01:38+08:00 [INFO] Final Memory: 20M/336M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:run (default-cli) on project shiro-test-spring: Could not start Tomcat: Failed to start component [StandardServer[-1]]: Failed to start component [StandardService[Tomcat]]: Failed to start component [StandardEngine[Tomcat]]: A child container failed during start -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
5、在pom.xml引入的web(如上面的servlet-api)相關的依賴時,需要加入<scope>provided</scope>
6、再次使用上面的命令啟動tomcat,此時問題解決。
相關推薦
使用maven的tomcat外掛啟動時報錯問題
1、最近在學習Apache下的一個許可權框架shiro。在eclipse上建了一個web專案,使用maven引入對應的依賴。在spring和springMVC等配置都準備好後,準備跑一下JSP頁面確保環境沒問題,跑的時候使用的也是maven的tomcat7外掛,在pom.xm
Spacemacs啟動時報錯:Symbol's funciton definition is void: cl-struct-define
space 不兼容 文件 編譯 mac 運行 void style truct 解決方法很簡單:刪除.emacs.d/elpa/ 目錄下面所有的*.elc文件。 原因:elc是el文件的預編譯文件,類似py文件的pyc文件,是一種二進制文件,不同版本的emacs是不兼容的。
docker jetty啟動時報錯 failed setting default capabilities.
cap 報錯 style 方法 容器 def class ... logs docker 容器中jetty啟動fail ,查看/var/log/jetty中的日誌發現具體錯誤信息如下: failed setting default capabilities.set_caps
Maven項目Eclipse啟動時報錯: java.lang.ClassNotFoundException: org.springframework.web.util.IntrospectorCleanupListener
otf exce exe maven com apply ges 選中項 apache Eclipse中啟動Maven項目時報如下錯誤: 嚴重: Error configuring application listener of class org.springfra
NFS啟動時報錯Linux NFS:could not open connection for tcp6
anti 註釋 svc oot pan ons udp borde toad 1.1 啟動時出現的錯誤 [root@znix ~]#/etc/init.d/nfs start Shutting down NFS daemon:
hive啟動時報錯${system:java.io.tmpdir
hive system:java.io.tmpdirException in thread "main" java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${syst
hive啟動時報錯: Relative path in absolute URI: ${system:java.io.t
hive system:java.io.tmpdirException in thread "main" java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${syst
CentOS啟動時報錯修復
itl times eight ons http oot expect centos com CentOS啟動時報錯“UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY”修復步驟:1、輸入root用戶密碼後回車,出現命令行提示符2、如上圖
mysql啟動時報錯:Starting MySQL... ERROR! The server quit without updating PID file (/opt/mysql/data/mysql.pid)
.com quit blog erro selinux 打開 archive out com mysql啟動報錯Starting MySQL... ERROR! The server quit without updating PID file (/opt/mysql/da
項目啟動時報錯:Result Maps collection already contains value for com.xxx.xxx.xx.mapper.XxxMapper.baseResultMap
rom efi 英語水平 base ont mapper 出現 技術 aps Caused by: java.lang.IllegalArgumentException: Result Maps collection already contains value for c
專案啟動時報錯--報錯資訊為:java.lang.IllegalStateException
專案啟動時報錯資訊:java.lang.IllegalStateException:BeanFactory not initialized or already closed -call ‘refresh’ before accessing beans via the Applocati
tomcat準備啟動時報錯
1、在linu上部署好tomcat後,準備啟動時報錯: Cannot find bin/catalina.sh The file is absent or does not have execute permission This file is needed to run this
JBOSS4.2啟動時報錯【配置檔案不可讀】
一、問題 二、原因分析 &n
TOMCAT啟動時報錯:the CATALINA_HOME environment variable is not defined correctly
步驟一:新增CATALINA_HOME環境變數,變數值同TOMCAT_HOME 步驟二:檢查CATALINA_HOME,JAVA_HOME,TOMCAT_HOME的變數值後邊有沒有分號(;)有的話刪除 此時啟動TOMCAT應該會成功,但在瀏覽器位址列中輸入http://localhost:8
解決Eclipse啟動時報錯
因為最近一次專案要用到Eclipse,然而已經很久沒用了,為了方便,所以直接讓從別人那裡拷過來的 懷著滿心的期待開啟Eclipse,卻出現了這種情況 第一反應就是檢查環境變數有沒有配置錯誤,檢查了一番過後發現沒用任何問題,然後檢查了下JDK發現也沒用錯誤 便到
Hive啟動時報錯:cannot access ....spark/lib/spark-assembly-*.jar: No such file or directoryog解決
在安裝spark後,通過bin/hive 啟動hive時報錯: ls:cannot access /export/servers/spark/lib/spark-assembly-*.jar: No such file or directoryog 原因分析:
eclipse 通過git外掛commit時報錯 “There are no staged files”的解決辦法
這裡樓主上網搜到一篇文章,簡單明瞭,現在分享給大家; eclipse git 提交程式碼時提示 “There are no staged files”,原因很可能是eclipse中勾選瞭如下圖的選項,不選中該選項即可,根本的原因待研究。 部落格轉載於:https://blog.csdn
解決mariadb 啟動時報錯Job for mariadb.service failed because the control process exited with error code. Se
錯誤:[[email protected] ~]# systemctl start mariadb.service Job for mariadb.service failed because the control process exited
tomcat啟動時報錯:Error creating bean with name 'transactionManager' defined in class path resource
最近寫了一個專案,部署到服務上的時候遇到一個奇葩的問題,一般本地起專案是用jetty玩的,jetty完全正常當部署到tomcat報錯了,找了2天才解決問題,這兩天tomcat問題就像 滿漢全席一樣不重樣。 報錯原文:Error creating bean with name 'transacti
Android Studio啟動時報錯 Emulator: emulator: ERROR: OpenGLES emulation failed to initialize.
問題描述 Android Studio啟動模擬器報錯 Emulator: emulator: ERROR: OpenGLES emulation failed to initialize. 問題原因 問題原因是我使用了 Nexus 5X and Nexus 5 模擬器,