在添加tomcat-embed-jasper依赖项时,Spring启动jar无法启动嵌入式服务器

时间:2016-02-17 04:30:30

标签: spring spring-boot embedded-tomcat-7

我正在将遗留应用程序升级到spring boot并创建一个完全可执行的jar。为了渲染jsp和tile,我想我需要添加tomcat-embed-jasper依赖项。在我这样做之后,尝试运行应用程序应用程序启动失败,并跟随堆栈跟踪。

  

引起:org.springframework.context.ApplicationContextException:无法启动嵌入式容器;嵌套异常是org.springframework.boot.context.embedded.EmbeddedServletContainerException:无法启动嵌入式Tomcat

在谷歌上搜索我发现我的一些依赖可能会干扰嵌入式tomcat。我尝试删除一些依赖项,但没有太多运气。我可以在调试依赖树时使用一些帮助。

这是我的pom.xml

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.2.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <maven.version>2.0.2</maven.version>
        <version.aopalliance>1.0</version.aopalliance>
        <version.tiles>2.1.3</version.tiles>
        <version.standard.taglibs>1.1.2</version.standard.taglibs>
        <maven.local.path>${project.basedir}</maven.local.path>
        <cxf.version>3.1.5</cxf.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
        </dependency>

        <!-- Other community dependencies -->
        <dependency>
            <groupId>aopalliance</groupId>
            <artifactId>aopalliance</artifactId>
            <version>${version.aopalliance}</version>
        </dependency>
        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <version>${version.standard.taglibs}</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>${version.commons.logging}</version>
        </dependency>
        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>3.1</version>
        </dependency>

        <!-- Needed for running tests (you may also use TestNG) -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>


        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib-nodep</artifactId>
            <version>2.2</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
        </dependency>
        <dependency>
            <groupId>net.sf.ehcache</groupId>
            <artifactId>ehcache-core</artifactId>
            <version>2.6.0</version>
        </dependency>
        <dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.4</version>
            <classifier>jdk15</classifier>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.sun.jmx</groupId>
                    <artifactId>jmxri</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jdmk</groupId>
                    <artifactId>jmxtools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.jms</groupId>
                    <artifactId>jms</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.velocity</groupId>
            <artifactId>velocity</artifactId>
        </dependency>

        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjtools</artifactId>
        </dependency>


        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-support</artifactId>
            <version>2.0.8</version>
        </dependency>

        <dependency>
            <groupId>com.googlecode.ehcache-spring-annotations</groupId>
            <artifactId>ehcache-spring-annotations</artifactId>
            <version>1.1.3</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.5</version>
        </dependency>

        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-core</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-ws-security</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.ws.security</groupId>
            <artifactId>wss4j</artifactId>
            <version>1.6.19</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-api</artifactId>
            <version>2.7.18</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-rs-extension-providers</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-bindings-soap</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-bindings-xml</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-databinding-jaxb</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-simple</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-ws-policy</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-ws-addr</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-rs-client</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-bundle-jaxrs</artifactId>
            <version>2.1.2</version>
        </dependency>


        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>jsr311-api</artifactId>
            <version>1.0</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>

        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.0</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.0</version>
        </dependency>

        <dependency>
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
            <version>1.4.0</version>
        </dependency>


        <dependency>
            <groupId>javax.transaction</groupId>
            <artifactId>jta</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-servlet</artifactId>
            <version>3.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-core</artifactId>
            <version>3.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-jsp</artifactId>
            <version>3.0.1</version>

        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-api</artifactId>
            <version>3.0.1</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>

        <dependency>
            <groupId>org.antlr</groupId>
            <artifactId>stringtemplate</artifactId>
            <version>3.2.1</version>

        </dependency>
        <dependency>
            <groupId>org.owasp.esapi</groupId>
            <artifactId>esapi</artifactId>
            <version>2.0GA</version>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>2.9.1</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jettison</groupId>
            <artifactId>jettison</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.11</version>
        </dependency>

        <!-- Added for mailGun -->
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-core</artifactId>
            <version>1.17.1</version>
        </dependency>

        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-client</artifactId>
            <version>1.17.1</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey.contribs</groupId>
            <artifactId>jersey-multipart</artifactId>
            <version>1.17.1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>

    </dependencies>


    <build>
        <finalName>admin</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <executable>true</executable>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <packaging>jar</packaging>
</project>

我的mvn dependency:tree

[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ demo ---
[INFO] demo:demo:jar:1.0
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.3.2.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.3.2.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:1.3.2.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.3.2.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.3.2.RELEASE:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.1.3:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.1.3:compile
[INFO] |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.13:compile
[INFO] |  |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.13:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.16:runtime
[INFO] |  +- org.springframework.boot:spring-boot-starter-validation:jar:1.3.2.RELEASE:compile
[INFO] |  |  \- org.hibernate:hibernate-validator:jar:5.2.2.Final:compile
[INFO] |  |     +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] |  |     \- com.fasterxml:classmate:jar:1.1.0:compile
[INFO] |  \- com.fasterxml.jackson.core:jackson-databind:jar:2.6.5:compile
[INFO] |     +- com.fasterxml.jackson.core:jackson-annotations:jar:2.6.5:compile
[INFO] |     \- com.fasterxml.jackson.core:jackson-core:jar:2.6.5:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.3.2.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:1.3.2.RELEASE:compile
[INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.8.8:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.3.2.RELEASE:compile
[INFO] |  |  \- org.apache.tomcat:tomcat-jdbc:jar:8.0.30:compile
[INFO] |  |     \- org.apache.tomcat:tomcat-juli:jar:8.0.30:compile
[INFO] |  +- org.hibernate:hibernate-entitymanager:jar:4.3.11.Final:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] |  |  +- org.hibernate:hibernate-core:jar:4.3.11.Final:compile
[INFO] |  |  |  \- org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] |  |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |  +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.5.Final:compile
[INFO] |  |  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] |  |  \- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] |  +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] |  +- org.springframework.data:spring-data-jpa:jar:1.9.2.RELEASE:compile
[INFO] |  |  \- org.springframework.data:spring-data-commons:jar:1.11.2.RELEASE:compile
[INFO] |  \- org.springframework:spring-aspects:jar:4.2.4.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-security:jar:1.3.2.RELEASE:compile
[INFO] +- javax.servlet:servlet-api:jar:2.5:compile
[INFO] +- org.springframework:spring-aop:jar:4.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-beans:jar:4.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:4.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-context-support:jar:4.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-core:jar:4.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-expression:jar:4.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:4.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-orm:jar:4.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-tx:jar:4.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-test:jar:4.2.4.RELEASE:test
[INFO] +- org.springframework:spring-web:jar:4.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.2.4.RELEASE:compile
[INFO] +- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- taglibs:standard:jar:1.1.2:compile
[INFO] +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO] |  \- commons-codec:commons-codec:jar:1.2:compile
[INFO] +- junit:junit:jar:4.12:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- cglib:cglib-nodep:jar:2.2:compile
[INFO] +- org.slf4j:slf4j-simple:jar:1.7.13:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.13:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] +- net.sf.ehcache:ehcache-core:jar:2.6.0:compile
[INFO] +- net.sf.json-lib:json-lib:jar:jdk15:2.4:compile
[INFO] |  +- commons-beanutils:commons-beanutils:jar:1.9.2:compile
[INFO] |  +- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] |  +- commons-lang:commons-lang:jar:2.5:compile
[INFO] |  \- net.sf.ezmorph:ezmorph:jar:1.0.6:compile
[INFO] +- log4j:log4j:jar:1.2.17:compile
[INFO] +- org.apache.velocity:velocity:jar:1.7:compile
[INFO] +- org.aspectj:aspectjtools:jar:1.8.8:compile
[INFO] +- org.springframework:spring-support:jar:2.0.8:compile
[INFO] +- com.googlecode.ehcache-spring-annotations:ehcache-spring-annotations:jar:1.1.3:compile
[INFO] +- javax.mail:mail:jar:1.4.5:compile
[INFO] |  \- javax.activation:activation:jar:1.1:compile
[INFO] +- org.apache.cxf:cxf-core:jar:3.1.5:compile
[INFO] |  +- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:compile
[INFO] |  |  \- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile
[INFO] |  \- org.apache.ws.xmlschema:xmlschema-core:jar:2.2.1:compile
[INFO] +- org.apache.cxf:cxf-rt-frontend-jaxws:jar:3.1.5:compile
[INFO] |  +- xml-resolver:xml-resolver:jar:1.2:compile
[INFO] |  \- org.ow2.asm:asm:jar:5.0.4:compile
[INFO] +- org.apache.cxf:cxf-rt-transports-http:jar:3.1.5:compile
[INFO] +- org.apache.cxf:cxf-rt-frontend-jaxrs:jar:3.1.5:compile
[INFO] |  +- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile
[INFO] |  \- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] +- org.apache.cxf:cxf-rt-ws-security:jar:3.1.5:compile
[INFO] |  +- org.apache.cxf:cxf-rt-security-saml:jar:3.1.5:compile
[INFO] |  |  +- org.apache.cxf:cxf-rt-security:jar:3.1.5:compile
[INFO] |  |  \- org.apache.wss4j:wss4j-ws-security-common:jar:2.1.4:compile
[INFO] |  |     +- org.opensaml:opensaml-saml-impl:jar:3.1.1:compile
[INFO] |  |     |  +- org.opensaml:opensaml-profile-api:jar:3.1.1:compile
[INFO] |  |     |  |  \- org.opensaml:opensaml-core:jar:3.1.1:compile
[INFO] |  |     |  +- org.opensaml:opensaml-saml-api:jar:3.1.1:compile
[INFO] |  |     |  |  +- org.opensaml:opensaml-xmlsec-api:jar:3.1.1:compile
[INFO] |  |     |  |  \- org.opensaml:opensaml-soap-api:jar:3.1.1:compile
[INFO] |  |     |  +- org.opensaml:opensaml-security-impl:jar:3.1.1:compile
[INFO] |  |     |  |  \- org.opensaml:opensaml-security-api:jar:3.1.1:compile
[INFO] |  |     |  |     +- org.cryptacular:cryptacular:jar:1.0:compile
[INFO] |  |     |  |     \- org.bouncycastle:bcprov-jdk15on:jar:1.51:compile
[INFO] |  |     |  +- org.opensaml:opensaml-xmlsec-impl:jar:3.1.1:compile
[INFO] |  |     |  \- net.shibboleth.utilities:java-support:jar:7.1.1:compile
[INFO] |  |     |     \- com.google.guava:guava:jar:18.0:compile
[INFO] |  |     +- org.opensaml:opensaml-xacml-impl:jar:3.1.1:compile
[INFO] |  |     |  \- org.opensaml:opensaml-xacml-api:jar:3.1.1:compile
[INFO] |  |     +- org.opensaml:opensaml-xacml-saml-impl:jar:3.1.1:compile
[INFO] |  |     |  \- org.opensaml:opensaml-xacml-saml-api:jar:3.1.1:compile
[INFO] |  |     \- org.jasypt:jasypt:jar:1.9.2:compile
[INFO] |  +- net.sf.ehcache:ehcache:jar:2.10.1:compile
[INFO] |  +- org.apache.wss4j:wss4j-ws-security-dom:jar:2.1.4:compile
[INFO] |  +- org.apache.wss4j:wss4j-policy:jar:2.1.4:compile
[INFO] |  +- org.apache.wss4j:wss4j-ws-security-stax:jar:2.1.4:compile
[INFO] |  |  \- org.apache.wss4j:wss4j-bindings:jar:2.1.4:compile
[INFO] |  \- org.apache.wss4j:wss4j-ws-security-policy-stax:jar:2.1.4:compile
[INFO] +- org.apache.ws.security:wss4j:jar:1.6.19:compile
[INFO] |  +- org.apache.santuario:xmlsec:jar:1.5.8:compile
[INFO] |  \- org.opensaml:opensaml:jar:2.5.1-1:compile
[INFO] |     \- org.opensaml:openws:jar:1.4.2-1:compile
[INFO] |        \- org.opensaml:xmltooling:jar:1.3.2-1:compile
[INFO] |           \- joda-time:joda-time:jar:2.8.2:compile
[INFO] +- org.apache.cxf:cxf-api:jar:2.7.18:compile
[INFO] |  +- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.1:compile
[INFO] |  \- wsdl4j:wsdl4j:jar:1.6.3:compile
[INFO] +- org.apache.cxf:cxf-rt-rs-extension-providers:jar:3.1.5:compile
[INFO] +- org.apache.cxf:cxf-rt-bindings-soap:jar:3.1.5:compile
[INFO] |  \- org.apache.cxf:cxf-rt-wsdl:jar:3.1.5:compile
[INFO] +- org.apache.cxf:cxf-rt-bindings-xml:jar:3.1.5:compile
[INFO] +- org.apache.cxf:cxf-rt-databinding-jaxb:jar:3.1.5:compile
[INFO] |  +- com.sun.xml.bind:jaxb-impl:jar:2.2.11:compile
[INFO] |  \- com.sun.xml.bind:jaxb-core:jar:2.2.11:compile
[INFO] +- org.apache.cxf:cxf-rt-frontend-simple:jar:3.1.5:compile
[INFO] +- org.apache.cxf:cxf-rt-ws-policy:jar:3.1.5:compile
[INFO] |  \- org.apache.neethi:neethi:jar:3.0.3:compile
[INFO] +- org.apache.cxf:cxf-rt-ws-addr:jar:3.1.5:compile
[INFO] +- org.apache.cxf:cxf-rt-rs-client:jar:3.1.5:compile
[INFO] +- org.apache.cxf:cxf-bundle-jaxrs:jar:2.1.2:compile
[INFO] |  +- org.apache.geronimo.specs:geronimo-annotation_1.0_spec:jar:1.1.1:compile
[INFO] |  +- javax.xml.bind:jaxb-api:jar:2.1:compile
[INFO] |  +- org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0.1:compile
[INFO] |  +- org.apache.ws.commons.schema:XmlSchema:jar:1.4.2:compile
[INFO] |  +- org.apache.geronimo.specs:geronimo-activation_1.1_spec:jar:1.0.2:compile
[INFO] |  +- org.codehaus.woodstox:wstx-asl:jar:3.2.4:compile
[INFO] |  +- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.2:compile
[INFO] |  +- org.mortbay.jetty:jetty:jar:6.1.9:compile
[INFO] |  +- org.mortbay.jetty:jetty-util:jar:6.1.9:compile
[INFO] |  +- org.slf4j:slf4j-jdk14:jar:1.7.13:runtime
[INFO] |  +- org.apache.geronimo.specs:geronimo-servlet_2.5_spec:jar:1.2:compile
[INFO] |  +- jaxen:jaxen:jar:1.1.6:compile
[INFO] |  +- jdom:jdom:jar:1.0:compile
[INFO] |  +- org.apache.abdera:abdera-core:jar:0.4.0-incubating:compile
[INFO] |  +- org.apache.abdera:abdera-i18n:jar:0.4.0-incubating:compile
[INFO] |  +- org.apache.abdera:abdera-parser:jar:0.4.0-incubating:compile
[INFO] |  +- org.apache.ws.commons.axiom:axiom-impl:jar:1.2.7:compile
[INFO] |  +- org.apache.ws.commons.axiom:axiom-api:jar:1.2.7:compile
[INFO] |  +- org.apache.abdera:abdera-extensions-json:jar:0.4.0-incubating:compile
[INFO] |  +- org.apache.abdera:abdera-extensions-main:jar:0.4.0-incubating:compile
[INFO] |  \- org.apache.xmlbeans:xmlbeans:jar:2.3.0:compile
[INFO] +- javax.ws.rs:jsr311-api:jar:1.0:compile
[INFO] +- org.springframework.security:spring-security-core:jar:4.0.3.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-web:jar:4.0.3.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-config:jar:4.0.3.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-taglibs:jar:4.0.3.RELEASE:compile
[INFO] |  \- org.springframework.security:spring-security-acl:jar:4.0.3.RELEASE:compile
[INFO] +- javax.servlet:jsp-api:jar:2.0:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.0:compile
[INFO] +- commons-validator:commons-validator:jar:1.4.0:compile
[INFO] |  \- commons-digester:commons-digester:jar:2.1:compile
[INFO] +- javax.transaction:jta:jar:1.1:compile
[INFO] +- org.apache.tiles:tiles-servlet:jar:3.0.1:compile
[INFO] |  \- org.apache.tiles:tiles-request-servlet:jar:1.0.1:compile
[INFO] +- org.apache.tiles:tiles-core:jar:3.0.1:compile
[INFO] |  \- org.slf4j:jcl-over-slf4j:jar:1.7.13:compile
[INFO] +- org.apache.tiles:tiles-jsp:jar:3.0.1:compile
[INFO] |  +- org.apache.tiles:tiles-template:jar:3.0.1:compile
[INFO] |  |  \- org.apache.tiles:tiles-autotag-core-runtime:jar:1.1.0:compile
[INFO] |  \- org.apache.tiles:tiles-request-jsp:jar:1.0.1:compile
[INFO] +- org.apache.tiles:tiles-api:jar:3.0.1:compile
[INFO] |  \- org.apache.tiles:tiles-request-api:jar:1.0.1:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.38:compile
[INFO] +- org.antlr:stringtemplate:jar:3.2.1:compile
[INFO] |  \- antlr:antlr:jar:2.7.7:compile
[INFO] +- org.owasp.esapi:esapi:jar:2.0GA:compile
[INFO] |  +- commons-configuration:commons-configuration:jar:1.5:compile
[INFO] |  +- commons-beanutils:commons-beanutils-core:jar:1.7.0:compile
[INFO] |  +- commons-fileupload:commons-fileupload:jar:1.2:compile
[INFO] |  +- xom:xom:jar:1.1:compile
[INFO] |  |  +- xerces:xmlParserAPIs:jar:2.6.2:compile
[INFO] |  |  \- xalan:xalan:jar:2.7.0:compile
[INFO] |  +- org.beanshell:bsh-core:jar:2.0b4:compile
[INFO] |  \- org.owasp.antisamy:antisamy:jar:1.4.3:compile
[INFO] |     +- org.apache.xmlgraphics:batik-css:jar:1.7:compile
[INFO] |     |  +- org.apache.xmlgraphics:batik-ext:jar:1.7:compile
[INFO] |     |  +- org.apache.xmlgraphics:batik-util:jar:1.7:compile
[INFO] |     |  \- xml-apis:xml-apis-ext:jar:1.3.04:compile
[INFO] |     \- net.sourceforge.nekohtml:nekohtml:jar:1.9.22:compile
[INFO] +- javax.inject:javax.inject:jar:1:compile
[INFO] +- xerces:xercesImpl:jar:2.9.1:compile
[INFO] |  \- xml-apis:xml-apis:jar:1.3.04:compile
[INFO] +- org.codehaus.jettison:jettison:jar:1.1:compile
[INFO] |  \- stax:stax-api:jar:1.0.1:compile
[INFO] +- org.apache.poi:poi-ooxml:jar:3.11:compile
[INFO] |  +- org.apache.poi:poi:jar:3.11:compile
[INFO] |  \- org.apache.poi:poi-ooxml-schemas:jar:3.11:compile
[INFO] +- com.sun.jersey:jersey-core:jar:1.17.1:compile
[INFO] +- com.sun.jersey:jersey-client:jar:1.17.1:compile
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- com.sun.jersey.contribs:jersey-multipart:jar:1.17.1:compile
[INFO] |  \- org.jvnet:mimepull:jar:1.6:compile
[INFO] +- org.apache.tomcat.embed:tomcat-embed-jasper:jar:8.0.30:provided
[INFO] |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.0.30:provided
[INFO] |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.30:compile
[INFO] |  \- org.eclipse.jdt.core.compiler:ecj:jar:4.4.2:provided
[INFO] \- org.springframework.boot:spring-boot-starter-tomcat:jar:1.3.2.RELEASE:provided
[INFO]    +- org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:8.0.30:provided
[INFO]    \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.0.30:provided

2 个答案:

答案 0 :(得分:2)

从您的依赖项中我可以看到您在编译范围内有javax.servlet:servlet-api:jar:2.5。这导致以下例外。

java.lang.ClassCastException: <Setvlet Class> 
  cannot be cast to javax.servlet.Servlet

通常javax.servlet:servlet-api将成为容器的一部分,并提供范围。

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

答案 1 :(得分:1)

好吧你的pom很乱。使用spring-boot-starter-* jar来管理您的依赖项。首先清理依赖项,然后删除以下内容

  • 所有org.springframework依赖项
  • 所有org.springframework.security依赖项
  • 删除javax.servlet-api依赖
  • 删除velocity依赖
  • 删除javax.mail依赖
  • 删除AspectJ和aopalliance依赖
  • 删除JUnit依赖
  • 删除您的org.slf4jcommons-logginglog4j依赖关系
  • 删除jta依赖项

现在添加以下Spring Boot启动器。

  • spring-boot-starter-aop
  • spring-boot-starter-mail
  • spring-boot-starter-velocity
  • spring-boot-starter-log4j
  • spring-boot-starter-test<scope>test</test>

然后重启。这应该清理您的依赖项列表,并确保您有兼容的版本。