一尘不染

Tomcat Maven插件-子容器在启动过程中失败

tomcat

我正在开发一个多模块Maven项目,并且我想在Tomcat7中运行我的Web项目,但是出现此错误“启动时子容器失败”。

我继续:(右键单击Web项目)->运行方式->运行配置->目标:tomcat7:run,我有以下日志:

avr。2014年15月5日39:39:23 org.apache.catalina.core.ContainerBase startInternal
SEVERE:子容器在启动期间失败java.util.concurrent.ExecutionException:org.apache.catalina.LifecycleException:无法启动组件[StandardEngine
[ org.apache.catalina上java.util.concurrent.FutureTask $
Sync.innerGet(FutureTask.java:252)上的Tomcat] .StandardHost
[localhost]]在java.util.concurrent.FutureTask.get(FutureTask.java:111)上的Tomcat]。位于org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)的org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150的.core.ContainerBase.startInternal(ContainerBase.java:1123)
)的org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)的org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)。

首先,这是我的父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>

拜托我需要你的帮忙。


阅读 396

收藏
2020-06-16

共1个答案

一尘不染

我通过添加此依赖关系解决了问题

<dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>
2020-06-16