我正在开发一个多模块maven项目,我想在Tomcat7中运行我的web项目但是我有这个错误“子容器在启动时失败了。”
我继续:(右键点击网络项目) - >以 - >运行运行配置 - >目标:tomcat7:运行,我有这个日志:
AVR。 15,2014 5:39:23 PM org.apache.catalina.core.ContainerBase startInternal 严重:子容器在启动时失败 java.util.concurrent.ExecutionException:org.apache.catalina.LifecycleException:无法启动组件[StandardEngine [Tomcat] .StandardHost [localhost]] at java.util.concurrent.FutureTask $ Sync.innerGet(FutureTask.java:252) 在java.util.concurrent.FutureTask.get(FutureTask.java:111) 在org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) 在org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302) 在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 在org.apache.catalina.core.StandardService.startInternal(StandardService.java:443) 在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 在org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732) 在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 在org.apache.catalina.startup.Tomcat.start(Tomcat.java:341) 在org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.startContainer(AbstractRunMojo.java:1238) 在org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.execute(AbstractRunMojo.java:592) 在org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133) 在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) 在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 在org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108) 在org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76) 在org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) 在org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116) 在org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361) 在org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) 在org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) 在org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213) 在org.apache.maven.cli.MavenCli.main(MavenCli.java:157) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:601) 在org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) 在org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) 在org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) 在org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 在org.codehaus.classworlds.Launcher.main(Launcher.java:46) 引起:org.apache.catalina.LifecycleException:无法启动组件[StandardEngine [Tomcat] .StandardHost [localhost]] 在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 在org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1559) 在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) 在java.lang.Thread.run(Thread.java:722) 引起:org.apache.catalina.LifecycleException:子容器在启动期间失败 在org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131) 在org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800) 在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ......还有7个
首先这是我的父pom.xml:
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<!-- http://maven.apache.org/plugins/maven-war-plugin/ -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
</plugin>
</plugins>
</build>
<modules>
<module>../release-management-core</module>
<module>../release-management-common</module>
<module>../release-management-web</module>
</modules>
这是web项目的pom.xml:
<dependencies>
<dependency>
<groupId>ott.release.management</groupId>
<artifactId>release-management-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<!-- ~~~~~~~~~ -->
<!-- SPRING WEB -->
<!-- ~~~~~~~~~ -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- ~~~~~~~~~ -->
<!-- SPRING SECURITY -->
<!-- ~~~~~~~~~ -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<!-- JSF Dependencies -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>${jsf-api.version}</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>${jsf-api.version}</version>
</dependency>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- PrimeFaces 4.0 -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>${primefaces.version}</version>
</dependency>
<dependency>
<!-- optional theme (see also web.xml to enable it) -->
<groupId>org.primefaces.themes</groupId>
<artifactId>bluesky</artifactId>
<version>${primefaces-themes.version}</version>
</dependency>
<dependency>
<groupId>org.primefaces.extensions</groupId>
<artifactId>primefaces-extensions</artifactId>
<version>${primefaces-extension.version}</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
<build>
<finalName>releaseManagement</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>8082</port>
</configuration>
</plugin>
</plugins>
</build>
这是我的web.xml:
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Parser fichier JSF -->
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<!-- Lier JSF et Spring -->
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<!-- Context needed when adding el-impl for Tomcat 6 -->
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<description>Primefaces theme</description>
<param-name>primefaces.THEME</param-name>
<param-value>bluesky</param-value>
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<!-- The definition of the Root Spring Container shared by all Servlets
and Filters -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:context/applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
拜托,我需要你的帮助。
答案 0 :(得分:2)
我通过添加此依赖项来解决问题
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>