当前位置: 首页 > 知识库问答 >
问题:

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

胡向阳
2023-03-14

我正在将一个遗留应用程序升级到spring boot,并创建一个完全可执行的jar。为了呈现jsp和tiles,我想我需要添加tomcat嵌入jasper依赖项。然后,尝试运行应用程序,应用程序启动失败,stacktrace如下。

原因:org.springframework.context.Application ContextException:无法启动嵌入式容器;嵌套异常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依赖关系:树

[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个答案

蒋星驰
2023-03-14

好吧,你的pom一团糟。使用spring-boot-starter-*jar来管理您的依赖项。首先从清理依赖项开始,删除以下内容

  • 你所有的org.springframework依赖项
  • 你所有的org.springframework.security依赖项
  • 删除javax.servlet-api依赖
  • 删除速度依赖项
  • 删除javax.mail依赖
  • 删除AsheJ和aopAlliance依赖项
  • 删除JUnit依赖项
  • 删除您的org.slf4jCommons-loglog4j依赖项
  • 删除jta依赖项

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

  • Spring启动机aop
  • spring boot starter邮件
  • Spring启动速度
  • spring-boot-starter-log4j
  • Spring启动起动机测试

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

公孙巴英
2023-03-14

从您的依赖关系中,我可以看到您有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>
 类似资料:
  • 我刚刚开始使用microservices,我想创建一个简单的Eureka服务器来执行我的Serviceregistry。目前,我只想在localhost上运行服务器,稍后我想添加一个注册到其中的示例微服务。问题是,我在尝试启动Eureka服务器时出错。我在Eclipse中使用Spring和Maven在ubuntu vm中开发。 我的POM. xml如下所示: http://maven.apache

  • 问题内容: 我正在从JBoss / Wildfly移植一个旧应用程序以在tomcat上运行。我可以使用网络上的资源完成的大多数工作。但是,我对最新一期不太满意。我很早就知道我必须补充 作为请求路由的依赖项。如果不包括此依赖项,则发出请求时会出现404错误。现在,这似乎对我的应用程序没有任何不利影响,但是如果没有错误,我将不理解启动错误。 为此的目标环境是运行Tomcat 8的AWS,并且在部署时工

  • 运行Spring Boot应用程序时,嵌入式tomcat服务器无法启动。我刚刚在pom.xml中添加了所需的依赖项,并创建了一个简单的java POJO类。应用程序属性已经按照oracle数据库所需的jdbc配置以及Hibernate方言信息进行了设置。 执行mvn spring-boot:run时的控制台日志

  • 下面是我的pom.xml文件 http://maven.apache.org/xsd/maven-4.0.0.xsd“>4.0.0

  • 当我将keystore.jks添加到资源目录时,会出现这个错误。当我在命令行中运行spring-boot应用程序时,就面临着这一点。在IntelliJ中,IDEA应用程序运行没有任何问题。 2020-11-08 21:37:05.776错误2422--[main]O.S.Boot.SpringApplication:应用程序运行失败

  • 说明:无法启动web服务器;嵌套的异常是org。springframework。靴子网状物服务器WebServerException:无法启动嵌入式Tomcat 启动Tomcat上下文时出错。例外情况: 组织。springframework。豆。工厂BeanCreationException。消息:创建在类路径资源[org/springframework/boot/actuate/autoconf