3

Tomcat 7 で Maven プロジェクトを実行しようとしていますが、うまくいかないようです。コマンド プロンプトから入力するとmvn clean tomcat7:run、次のエラーが表示されます。

    SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException:
 Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].Stand
ardContext[/hitech-store]]
        at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
        at java.util.concurrent.FutureTask.get(FutureTask.java:111)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja
va:1123)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java
:785)
        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$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:603)
        at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [St
andardEngine[Tomcat].StandardHost[localhost].StandardContext[/hitech-store]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
        ... 7 more
Caused by: java.lang.ClassCastException: org.springframework.web.SpringServletCo
ntainerInitializer cannot be cast to javax.servlet.ServletContainerInitializer
        at org.apache.catalina.startup.ContextConfig.getServletContainerInitiali
zer(ContextConfig.java:1657)
        at org.apache.catalina.startup.ContextConfig.processServletContainerInit
ializers(ContextConfig.java:1565)
        at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.jav
a:1273)
        at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfi
g.java:878)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfi
g.java:369)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBa
se.java:90)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContex
t.java:5173)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        ... 7 more

mag 20, 2013 8:05:22 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: 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$Sync.innerGet(FutureTask.java:252)
        at java.util.concurrent.FutureTask.get(FutureTask.java:111)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja
va: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(StandardServic
e.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:335)
        at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.startConta
iner(AbstractRunMojo.java:1018)
        at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.execute(Ab
stractRunMojo.java:478)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:209)
        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.buildProje
ct(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [St
andardEngine[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$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:603)
        at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.catalina.LifecycleException: A child container failed duri
ng start
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja
va:1131)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java
:785)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        ... 7 more

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.658s
[INFO] Finished at: Mon May 20 20:05:22 CEST 2013
[INFO] Final Memory: 19M/175M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.0:
run (default-cli) on project hitech-store: Could not start Tomcat: Failed to sta
rt component [StandardServer[-1]]: Failed to start component [StandardService[To
mcat]]: Failed to start component [StandardEngine[Tomcat]]: A child container fa
iled during start -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception

他のコンピューターでプロジェクトを実行することを含め、すべてを試しました。4 台のコンピューターのうち、2 台では実行されますが、他の 2 台では実行されません。Maven または Tomcat の問題だと思いますか?

4

3 に答える 3

7

実際には正しいバージョンを探しています。以下の依存関係を使用して解決しました:

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

お役に立てれば!PS-正しいバージョンを使用してください。私は最新のものを使用しています。他のサーブレット関連の依存関係をすべて削除し、これだけを保持します。

于 2014-05-21T04:05:42.763 に答える