Spring Boot 应用程序启动失败,在 POM.XML 中有 mysql 和 mongo 依赖项

Posted

技术标签:

【中文标题】Spring Boot 应用程序启动失败,在 POM.XML 中有 mysql 和 mongo 依赖项【英文标题】:Spring boot application startup fail on having mysql and mongo dependency in POM.XML 【发布时间】:2017-10-07 09:34:30 【问题描述】:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.xxxx.yyyy</groupId>
    <artifactId>user</artifactId>
    <packaging>jar</packaging>
    <version>1.0.0</version>
    <name>user</name>
    <properties>
        <start-class>com.xxxx.yyyy.user.WebApplication</start-class>
        <spring-boot.version>1.2.4.RELEASE</spring-boot.version>
        <spring-data-commons.version>1.9.2.RELEASE</spring-data-commons.version>
        <spring-cloud-netflix.version>1.0.3.RELEASE</spring-cloud-netflix.version>
        <mysql-connector-version>5.1.21</mysql-connector-version>
        <apache-commons-version>3.1</apache-commons-version>
    </properties>
    <dependencies>

        <!-- Other dependencies -->
        <dependency>
            <!-- Setup Spring Boot -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <version>$spring-boot.version</version>
        </dependency>
        <dependency>
            <!-- Setup Spring Thymeleaf, UI Rendering -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
            <version>$spring-boot.version</version>
        </dependency> 

        <!-- <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
            <version>$spring-boot.version</version>
        </dependency> -->

        <dependency>
            <!-- Setup Spring MVC & REST, use Embedded Tomcat -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>$spring-boot.version</version>
        </dependency>

        <dependency>
            <!-- Setup Spring Data common components -->
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-commons</artifactId>
            <version>$spring-data-commons.version</version>
        </dependency>

        <dependency>
            <!-- Testing starter -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>$spring-boot.version</version>
        </dependency>

        <dependency>
            <!-- Setup Spring Data JPA Repository support -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
            <version>$spring-boot.version</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
            <version>$spring-boot.version</version>
        </dependency>
        <dependency>
            <!-- Spring Cloud starter -->
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter</artifactId>
            <version>$spring-cloud-netflix.version</version>
        </dependency>

        <dependency>
            <!-- Eureka service registration -->
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka-server</artifactId>
            <version>$spring-cloud-netflix.version</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>
                    </exclusion>
                </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>$apache-commons-version</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.9</version>
        </dependency>
         <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>$mysql-connector-version</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.1.4.Final</version>
        </dependency>   
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.1.4.Final</version>
        </dependency>       
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.4</version>
        </dependency>       
        <!--  https://mvnrepository.com/artifact/javax.mail/mail 
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4</version>
        </dependency> -->

        <!-- Spring Data MongoDB-->
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-mongodb</artifactId>
        <version>1.4.0.RELEASE</version>
    </dependency> 

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-expression</artifactId>
        <version>4.3.8.RELEASE</version>
    </dependency>

    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>$spring-boot.version</version>
                <configuration>
                    <mainClass>com.altimetrik.platform.user.WebApplication</mainClass>
                    <layout>ZIP</layout>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-beans</artifactId>
                <version>4.1.6.RELEASE</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
</project>

当我在 POM.XML 中添加 mysql 和 mongo db 的依赖项时,spring boot 应用程序没有启动。

2017-05-09 12:36:42.823  INFO 8612 --- [           main] c.a.platform.user.WebApplication         : Starting WebApplication on JJ09T12-LT1 with PID 8612 (E:\Project\platform-user\target\classes started by nmuthusamy in E:\Project\platform-user)
2017-05-09 12:36:42.847  INFO 8612 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@13acb0d1: startup date [Tue May 09 12:36:42 IST 2017]; root of context hierarchy
2017-05-09 12:36:42.853  INFO 8612 --- [           main] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/E:/Project/platform-user/target/classes/, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter/1.2.4.RELEASE/spring-boot-starter-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot/1.2.4.RELEASE/spring-boot-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.2.4.RELEASE/spring-boot-autoconfigure-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.2.4.RELEASE/spring-boot-starter-logging-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/slf4j/jul-to-slf4j/1.7.12/jul-to-slf4j-1.7.12.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.12/log4j-over-slf4j-1.7.12.jar, file:/C:/Users/nmuthusamy/.m2/repository/ch/qos/logback/logback-classic/1.1.3/logback-classic-1.1.3.jar, file:/C:/Users/nmuthusamy/.m2/repository/ch/qos/logback/logback-core/1.1.3/logback-core-1.1.3.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-core/4.1.6.RELEASE/spring-core-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/yaml/snakeyaml/1.14/snakeyaml-1.14.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-thymeleaf/1.2.4.RELEASE/spring-boot-starter-thymeleaf-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/thymeleaf/thymeleaf-spring4/2.1.4.RELEASE/thymeleaf-spring4-2.1.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/thymeleaf/thymeleaf/2.1.4.RELEASE/thymeleaf-2.1.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/ognl/ognl/3.0.8/ognl-3.0.8.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/unbescape/unbescape/1.1.0.RELEASE/unbescape-1.1.0.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/nz/net/ultraq/thymeleaf/thymeleaf-layout-dialect/1.2.8/thymeleaf-layout-dialect-1.2.8.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-web/1.2.4.RELEASE/spring-boot-starter-web-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/1.2.4.RELEASE/spring-boot-starter-tomcat-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.0.23/tomcat-embed-core-8.0.23.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.0.23/tomcat-embed-el-8.0.23.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/tomcat/embed/tomcat-embed-logging-juli/8.0.23/tomcat-embed-logging-juli-8.0.23.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.0.23/tomcat-embed-websocket-8.0.23.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.4.6/jackson-databind-2.4.6.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.4.0/jackson-annotations-2.4.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.4.6/jackson-core-2.4.6.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/hibernate/hibernate-validator/5.1.3.Final/hibernate-validator-5.1.3.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/fasterxml/classmate/1.0.0/classmate-1.0.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-web/4.1.6.RELEASE/spring-web-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-aop/4.1.6.RELEASE/spring-aop-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-webmvc/4.1.6.RELEASE/spring-webmvc-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/data/spring-data-commons/1.9.2.RELEASE/spring-data-commons-1.9.2.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-beans/4.1.6.RELEASE/spring-beans-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/slf4j/slf4j-api/1.7.10/slf4j-api-1.7.10.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.10/jcl-over-slf4j-1.7.10.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-test/1.2.4.RELEASE/spring-boot-starter-test-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/junit/junit/4.12/junit-4.12.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/mockito/mockito-core/1.10.19/mockito-core-1.10.19.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/objenesis/objenesis/2.1/objenesis-2.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-test/4.1.6.RELEASE/spring-test-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-data-jpa/1.2.4.RELEASE/spring-boot-starter-data-jpa-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-aop/1.2.4.RELEASE/spring-boot-starter-aop-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/aspectj/aspectjrt/1.8.5/aspectjrt-1.8.5.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/aspectj/aspectjweaver/1.8.5/aspectjweaver-1.8.5.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/1.2.4.RELEASE/spring-boot-starter-jdbc-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-jdbc/4.1.6.RELEASE/spring-jdbc-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/tomcat/tomcat-jdbc/8.0.23/tomcat-jdbc-8.0.23.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/tomcat/tomcat-juli/8.0.23/tomcat-juli-8.0.23.jar, file:/C:/Users/nmuthusamy/.m2/repository/javax/transaction/javax.transaction-api/1.2/javax.transaction-api-1.2.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-orm/4.1.6.RELEASE/spring-orm-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/data/spring-data-jpa/1.7.2.RELEASE/spring-data-jpa-1.7.2.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-aspects/4.1.6.RELEASE/spring-aspects-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-mail/1.2.4.RELEASE/spring-boot-starter-mail-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-context/4.1.6.RELEASE/spring-context-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-context-support/4.1.6.RELEASE/spring-context-support-4.1.6.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/sun/mail/javax.mail/1.5.3/javax.mail-1.5.3.jar, file:/C:/Users/nmuthusamy/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/cloud/spring-cloud-starter/1.0.3.RELEASE/spring-cloud-starter-1.0.3.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/cloud/spring-cloud-context/1.0.2.RELEASE/spring-cloud-context-1.0.2.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/security/spring-security-crypto/3.2.7.RELEASE/spring-security-crypto-3.2.7.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/cloud/spring-cloud-commons/1.0.2.RELEASE/spring-cloud-commons-1.0.2.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/cloud/spring-cloud-starter-eureka-server/1.0.3.RELEASE/spring-cloud-starter-eureka-server-1.0.3.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/cloud/spring-cloud-netflix-eureka-server/1.0.3.RELEASE/spring-cloud-netflix-eureka-server-1.0.3.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-actuator/1.2.4.RELEASE/spring-boot-starter-actuator-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-actuator/1.2.4.RELEASE/spring-boot-actuator-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/boot/spring-boot-starter-freemarker/1.2.4.RELEASE/spring-boot-starter-freemarker-1.2.4.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/freemarker/freemarker/2.3.22/freemarker-2.3.22.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/cloud/spring-cloud-netflix-core/1.0.3.RELEASE/spring-cloud-netflix-core-1.0.3.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/eureka/eureka-client/1.1.147/eureka-client-1.1.147.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/codehaus/jettison/jettison/1.2/jettison-1.2.jar, file:/C:/Users/nmuthusamy/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/netflix-commons/netflix-eventbus/0.1.2/netflix-eventbus-0.1.2.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/commons/commons-math/2.2/commons-math-2.2.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/netflix-commons/netflix-infix/0.1.2/netflix-infix-0.1.2.jar, file:/C:/Users/nmuthusamy/.m2/repository/joda-time/joda-time/2.3/joda-time-2.3.jar, file:/C:/Users/nmuthusamy/.m2/repository/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/antlr/antlr-runtime/3.4/antlr-runtime-3.4.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/antlr/stringtemplate/3.2.1/stringtemplate-3.2.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/google/code/gson/gson/2.1/gson-2.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/servo/servo-core/0.7.4/servo-core-0.7.4.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/sun/jersey/jersey-core/1.11/jersey-core-1.11.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/sun/jersey/jersey-client/1.11/jersey-client-1.11.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/sun/jersey/contribs/jersey-apache-client4/1.11/jersey-apache-client4-1.11.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/httpcomponents/httpclient/4.2.1/httpclient-4.2.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/httpcomponents/httpcore/4.2.1/httpcore-4.2.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/governator/governator/1.2.10/governator-1.2.10.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/google/inject/extensions/guice-grapher/3.0/guice-grapher-3.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/google/inject/extensions/guice-assistedinject/3.0/guice-assistedinject-3.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/codehaus/jsr166-mirror/jsr166y/1.7.0/jsr166y-1.7.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/google/inject/guice/3.0/guice-3.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/xbean/xbean-finder/3.11.1/xbean-finder-3.11.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/asm/asm-all/3.2/asm-all-3.2.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/google/inject/extensions/guice-multibindings/3.0/guice-multibindings-3.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/xbean/xbean-bundleutils/3.11.1/xbean-bundleutils-3.11.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/blitz4j/blitz4j/1.36.0/blitz4j-1.36.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/google/guava/guava/11.0.1/guava-11.0.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar, file:/C:/Users/nmuthusamy/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar, file:/C:/Users/nmuthusamy/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/sun/jersey/jersey-servlet/1.13/jersey-servlet-1.13.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/sun/jersey/jersey-server/1.13/jersey-server-1.13.jar, file:/C:/Users/nmuthusamy/.m2/repository/asm/asm/3.1/asm-3.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/eureka/eureka-core/1.1.147/eureka-core-1.1.147.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/amazonaws/aws-java-sdk/1.3.27/aws-java-sdk-1.3.27.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.8.9/jackson-core-asl-1.8.9.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.8.9/jackson-mapper-asl-1.8.9.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/archaius/archaius-core/0.6.5/archaius-core-0.6.5.jar, file:/C:/Users/nmuthusamy/.m2/repository/commons-configuration/commons-configuration/1.8/commons-configuration-1.8.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/cloud/spring-cloud-starter-ribbon/1.0.3.RELEASE/spring-cloud-starter-ribbon-1.0.3.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/ribbon/ribbon/2.0.0/ribbon-2.0.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/ribbon/ribbon-transport/2.0.0/ribbon-transport-2.0.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/reactivex/rxnetty-contexts/0.4.6/rxnetty-contexts-0.4.6.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/reactivex/rxnetty-servo/0.4.6/rxnetty-servo-0.4.6.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/hystrix/hystrix-core/1.4.0-rc.8/hystrix-core-1.4.0-rc.8.jar, file:/C:/Users/nmuthusamy/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/reactivex/rxnetty/0.4.6/rxnetty-0.4.6.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/netty/netty-codec-http/4.0.25.Final/netty-codec-http-4.0.25.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/netty/netty-codec/4.0.25.Final/netty-codec-4.0.25.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/netty/netty-handler/4.0.25.Final/netty-handler-4.0.25.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/netty/netty-transport-native-epoll/4.0.25.Final/netty-transport-native-epoll-4.0.25.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/netty/netty-common/4.0.25.Final/netty-common-4.0.25.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/netty/netty-buffer/4.0.25.Final/netty-buffer-4.0.25.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/netty/netty-transport/4.0.25.Final/netty-transport-4.0.25.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/ribbon/ribbon-core/2.0.0/ribbon-core-2.0.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/ribbon/ribbon-httpclient/2.0.0/ribbon-httpclient-2.0.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/netflix-commons/netflix-commons-util/0.1.1/netflix-commons-util-0.1.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/ribbon/ribbon-loadbalancer/2.0.0/ribbon-loadbalancer-2.0.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/netflix-commons/netflix-statistics/0.1.1/netflix-statistics-0.1.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/io/reactivex/rxjava/1.0.11/rxjava-1.0.11.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/netflix/ribbon/ribbon-eureka/2.0.0/ribbon-eureka-2.0.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/google/code/findbugs/annotations/2.0.0/annotations-2.0.0.jar, file:/C:/Users/nmuthusamy/.m2/repository/com/thoughtworks/xstream/xstream/1.4.2/xstream-1.4.2.jar, file:/C:/Users/nmuthusamy/.m2/repository/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/commons-codec/commons-codec/1.9/commons-codec-1.9.jar, file:/C:/Users/nmuthusamy/.m2/repository/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/hibernate/hibernate-core/4.1.4.Final/hibernate-core-4.1.4.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/jboss/logging/jboss-logging/3.1.0.GA/jboss-logging-3.1.0.GA.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/jboss/spec/javax/transaction/jboss-transaction-api_1.1_spec/1.0.0.Final/jboss-transaction-api_1.1_spec-1.0.0.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.1.Final/hibernate-jpa-2.0-api-1.0.1.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/javassist/javassist/3.15.0-GA/javassist-3.15.0-GA.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/hibernate/common/hibernate-commons-annotations/4.0.1.Final/hibernate-commons-annotations-4.0.1.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/hibernate/hibernate-entitymanager/4.1.4.Final/hibernate-entitymanager-4.1.4.Final.jar, file:/C:/Users/nmuthusamy/.m2/repository/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.jar, file:/C:/Users/nmuthusamy/.m2/repository/commons-pool/commons-pool/1.5.4/commons-pool-1.5.4.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/data/spring-data-mongodb/1.4.0.RELEASE/spring-data-mongodb-1.4.0.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-tx/3.2.8.RELEASE/spring-tx-3.2.8.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/springframework/spring-expression/3.2.8.RELEASE/spring-expression-3.2.8.RELEASE.jar, file:/C:/Users/nmuthusamy/.m2/repository/org/mongodb/mongo-java-driver/2.11.4/mongo-java-driver-2.11.4.jar]
2017-05-09 12:36:42.855 ERROR 8612 --- [           main] o.s.boot.SpringApplication               : Application startup failed

java.lang.NoSuchMethodError: org.springframework.expression.spel.SpelParserConfiguration.<init>(Lorg/springframework/expression/spel/SpelCompilerMode;Ljava/lang/ClassLoader;)V
    at org.springframework.context.expression.StandardBeanExpressionResolver.<init>(StandardBeanExpressionResolver.java:98)
    at org.springframework.context.support.AbstractApplicationContext.prepareBeanFactory(AbstractApplicationContext.java:553)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:455)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:126)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:75)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:55)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
    at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:100)
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:59)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:285)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
    at com.altimetrik.platform.user.WebApplication.main(WebApplication.java:43)

【问题讨论】:

让我猜你没有使用启动器,而是自己包含了单独的依赖项?或者您正在混合框架的版本(这就是它的样子),这可能是由于我评论的第一部分。请添加您的pom.xml 你能发布你的依赖吗? 【参考方案1】:

这是因为 spring-expression jar 可能不匹配。

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-mongodb</artifactId>
    <version>$spring-data-mongodb.version</version>
    <exclusions>
        <exclusion>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
        </exclusion>
    </exclusions>
</dependency>

试试这个,它应该可以工作。

【讨论】:

以上是关于Spring Boot 应用程序启动失败,在 POM.XML 中有 mysql 和 mongo 依赖项的主要内容,如果未能解决你的问题,请参考以下文章

由于 Hystrix,Spring Boot 2 启动失败?

spring-boot 战争在启动时失败

Spring Boot postgresql嵌入式tomcat启动失败

spring boot 启动失败

使用胖 Jar 插件和 Spring Boot 应用程序构建的 Gradle 给出“应用程序启动失败”

Spring Boot 启动预加载数据 CommandLineRunner