2017-04-23 24 views
1

我有一個SpringBoot應用程序,一個使用嵌入式Tomcat + Thymeleaf模板引擎的基本Web骨架應用程序。ClassDefFoundError:SpringBoot應用程序中的org/hibernate/HibernateException

這個pom.xml的這種依賴關係

<dependencies> 
    <!-- Spring Boot dependencies --> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-thymeleaf</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-web</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-security</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-data-jpa</artifactId> 
    </dependency> 
    <!-- Spring data --> 
    <dependency> 
     <groupId>com.h2database</groupId> 
     <artifactId>h2</artifactId> 
    </dependency> 

    <!-- Test dependencies --> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-test</artifactId> 
     <scope>test</scope> 
    </dependency> 

    <!-- Spring Security --> 
    <dependency> 
     <groupId>org.thymeleaf.extras</groupId> 
     <artifactId>thymeleaf-extras-springsecurity4</artifactId> 
    </dependency> 


    <!-- Email dependencies --> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-mail</artifactId> 
    </dependency> 

    <!-- Logging dependencies --> 
    <dependency> 
     <groupId>ch.qos.logback</groupId> 
     <artifactId>logback-classic</artifactId> 
    </dependency> 

    <!-- Webjars for JQuery and Bootstrap --> 
    <dependency> 
     <groupId>org.webjars</groupId> 
     <artifactId>bootstrap</artifactId> 
     <version>3.3.7-1</version> 
    </dependency> 
    <dependency> 
     <groupId>org.webjars</groupId> 
     <artifactId>jquery</artifactId> 
     <version>3.2.0</version> 
    </dependency> 

</dependencies> 

此應用程序屬性文件:

# Spring Data JPA properties 

spring.datasource.url=jdbc:h2:mem:testdb;MODE=MySQL;DB_CLOSE_ON_EXIT=FALSE 
spring.datasource.username=sa 
spring.datasource.password= 

spring.jpa.show-sql=true 
spring.jpa.properties.hibernate.format_sql=true 

hibernate.dialect=org.hibernate.dialect.H2Dialect 

但是當我啓動應用程序。我得到這個錯誤:

. ____   _   __ _ _ 
/\\/___'_ __ _ _(_)_ __ __ _ \ \ \ \ 
(()\___ | '_ | '_| | '_ \/ _` | \ \ \ \ 
\\/ ___)| |_)| | | | | || (_| | )))) 
    ' |____| .__|_| |_|_| |_\__, |//// 
=========|_|==============|___/=/_/_/_/ 
:: Spring Boot ::  (v1.5.3.RELEASE) 

15413 [main] INFO c.d.DevopsbuddyApplication - Starting DevopsbuddyApplication on MacBook-Pro-de-calzada.local with PID 80844 (/Users/nunito/Development/J2EE/workspace-sts-3.8.4.RELEASE/devopsbuddy/target/classes started by nunito in /Users/nunito/Development/J2EE/workspace-sts-3.8.4.RELEASE/devopsbuddy) 
15416 [main] DEBUG c.d.DevopsbuddyApplication - Running with Spring Boot v1.5.3.RELEASE, Spring v4.3.8.RELEASE 

    17325 [main] WARN o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactoryBuilder' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactoryBuilder' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaVendorAdapter' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.JpaVendorAdapter]: Factory method 'jpaVendorAdapter' threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/HibernateException 
    17341 [main] WARN o.s.boot.SpringApplication - Error handling failed (Error creating bean with name 'delegatingApplicationListener' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available) 
    17347 [main] ERROR o.s.boot.SpringApplication - Application startup failed 
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactoryBuilder' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactoryBuilder' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaVendorAdapter' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.JpaVendorAdapter]: Factory method 'jpaVendorAdapter' threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/HibernateException 
     at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) 
     at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) 
     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 
     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) 
     at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1081) 
     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:856) 
     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) 
     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) 
     at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) 
     at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) 
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) 
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) 
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) 
     at com.devopsbuddy.DevopsbuddyApplication.main(DevopsbuddyApplication.java:10) 
    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactoryBuilder' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactoryBuilder' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaVendorAdapter' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.JpaVendorAdapter]: Factory method 'jpaVendorAdapter' threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/HibernateException 
     at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) 
     at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) 
     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 
     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) 
     at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) 
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) 
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) 
     at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835) 
     at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) 
     ... 19 common frames omitted 
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaVendorAdapter' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.JpaVendorAdapter]: Factory method 'jpaVendorAdapter' threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/HibernateException 
     at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) 
     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 
     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) 
     at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) 
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) 
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) 
     at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835) 
     at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) 
     ... 33 common frames omitted 
    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.JpaVendorAdapter]: Factory method 'jpaVendorAdapter' threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/HibernateException 
     at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) 
     at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) 
     ... 46 common frames omitted 
    Caused by: java.lang.NoClassDefFoundError: org/hibernate/HibernateException 
     at org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter.<init>(HibernateJpaVendorAdapter.java:64) 
     at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration.createJpaVendorAdapter(HibernateJpaAutoConfiguration.java:98) 
     at org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.jpaVendorAdapter(JpaBaseConfiguration.java:103) 
     at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration$$EnhancerBySpringCGLIB$$22397ccc.CGLIB$jpaVendorAdapter$6(<generated>) 
     at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration$$EnhancerBySpringCGLIB$$22397ccc$$FastClassBySpringCGLIB$$fbd62950.invoke(<generated>) 
     at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) 
     at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358) 
     at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration$$EnhancerBySpringCGLIB$$22397ccc.jpaVendorAdapter(<generated>) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:498) 
     at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) 
     ... 47 common frames omitted 
    Caused by: java.lang.ClassNotFoundException: org.hibernate.HibernateException 
     at java.net.URLClassLoader.findClass(URLClassLoader.java:381) 
     at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) 
     at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
     ... 60 common frames omitted 

我也試過mvn clean install -U

MVN依賴的結果:樹

[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building devopsbuddy 0.0.1-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[WARNING] The POM for com.h2database:h2:jar:1.4.194 is missing, no dependency information available 
[INFO] 
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ devopsbuddy --- 
[INFO] com.devopsbuddy:devopsbuddy:jar:0.0.1-SNAPSHOT 
[INFO] +- org.springframework.boot:spring-boot-starter-thymeleaf:jar:1.5.3.RELEASE:compile 
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.5.3.RELEASE:compile 
[INFO] | | +- org.springframework.boot:spring-boot:jar:1.5.3.RELEASE:compile 
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.3.RELEASE:compile 
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.3.RELEASE:compile 
[INFO] | | | +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile 
[INFO] | | | \- org.slf4j:log4j-over-slf4j:jar:1.7.25:compile 
[INFO] | | \- org.yaml:snakeyaml:jar:1.17:runtime 
[INFO] | +- org.thymeleaf:thymeleaf-spring4:jar:2.1.5.RELEASE:compile 
[INFO] | | \- org.thymeleaf:thymeleaf:jar:2.1.5.RELEASE:compile 
[INFO] | |  +- ognl:ognl:jar:3.0.8:compile 
[INFO] | |  \- org.unbescape:unbescape:jar:1.1.0.RELEASE:compile 
[INFO] | \- nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:jar:1.4.0:compile 
[INFO] |  \- org.codehaus.groovy:groovy:jar:2.4.10:compile 
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.5.3.RELEASE:compile 
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.3.RELEASE:compile 
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.14:compile 
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.14:compile 
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.14:compile 
[INFO] | +- org.hibernate:hibernate-validator:jar:5.3.5.Final:compile 
[INFO] | | +- javax.validation:validation-api:jar:1.1.0.Final:compile 
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile 
[INFO] | | \- com.fasterxml:classmate:jar:1.3.3:compile 
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.8:compile 
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile 
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.8.8:compile 
[INFO] | +- org.springframework:spring-web:jar:4.3.8.RELEASE:compile 
[INFO] | | \- org.springframework:spring-beans:jar:4.3.8.RELEASE:compile 
[INFO] | \- org.springframework:spring-webmvc:jar:4.3.8.RELEASE:compile 
[INFO] |  \- org.springframework:spring-expression:jar:4.3.8.RELEASE:compile 
[INFO] +- org.springframework.boot:spring-boot-starter-security:jar:1.5.3.RELEASE:compile 
[INFO] | +- org.springframework:spring-aop:jar:4.3.8.RELEASE:compile 
[INFO] | +- org.springframework.security:spring-security-config:jar:4.2.2.RELEASE:compile 
[INFO] | | \- org.springframework.security:spring-security-core:jar:4.2.2.RELEASE:compile 
[INFO] | \- org.springframework.security:spring-security-web:jar:4.2.2.RELEASE:compile 
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.5.3.RELEASE:compile 
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:1.5.3.RELEASE:compile 
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.8.10:compile 
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.5.3.RELEASE:compile 
[INFO] | | +- org.apache.tomcat:tomcat-jdbc:jar:8.5.14:compile 
[INFO] | | | \- org.apache.tomcat:tomcat-juli:jar:8.5.14:compile 
[INFO] | | \- org.springframework:spring-jdbc:jar:4.3.8.RELEASE:compile 
[INFO] | +- org.hibernate:hibernate-core:jar:5.0.12.Final:compile 
[INFO] | | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile 
[INFO] | | +- org.javassist:javassist:jar:3.21.0-GA:compile 
[INFO] | | +- antlr:antlr:jar:2.7.7:compile 
[INFO] | | +- org.jboss:jandex:jar:2.0.0.Final:compile 
[INFO] | | +- dom4j:dom4j:jar:1.6.1:compile 
[INFO] | | \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile 
[INFO] | +- org.hibernate:hibernate-entitymanager:jar:5.0.12.Final:compile 
[INFO] | +- javax.transaction:javax.transaction-api:jar:1.2:compile 
[INFO] | +- org.springframework.data:spring-data-jpa:jar:1.11.3.RELEASE:compile 
[INFO] | | +- org.springframework.data:spring-data-commons:jar:1.13.3.RELEASE:compile 
[INFO] | | +- org.springframework:spring-orm:jar:4.3.8.RELEASE:compile 
[INFO] | | +- org.springframework:spring-tx:jar:4.3.8.RELEASE:compile 
[INFO] | | \- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile 
[INFO] | \- org.springframework:spring-aspects:jar:4.3.8.RELEASE:compile 
[INFO] +- com.h2database:h2:jar:1.4.194:compile 
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.5.3.RELEASE:test 
[INFO] | +- org.springframework.boot:spring-boot-test:jar:1.5.3.RELEASE:test 
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.3.RELEASE:test 
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.2.0:test 
[INFO] | | \- net.minidev:json-smart:jar:2.2.1:test 
[INFO] | |  \- net.minidev:accessors-smart:jar:1.1:test 
[INFO] | |  \- org.ow2.asm:asm:jar:5.0.3:test 
[INFO] | +- junit:junit:jar:4.12:test 
[INFO] | +- org.assertj:assertj-core:jar:2.6.0:test 
[INFO] | +- org.mockito:mockito-core:jar:1.10.19:test 
[INFO] | | \- org.objenesis:objenesis:jar:2.1:test 
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test 
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:test 
[INFO] | +- org.skyscreamer:jsonassert:jar:1.4.0:test 
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test 
[INFO] | +- org.springframework:spring-core:jar:4.3.8.RELEASE:compile 
[INFO] | \- org.springframework:spring-test:jar:4.3.8.RELEASE:test 
[INFO] +- org.thymeleaf.extras:thymeleaf-extras-springsecurity4:jar:2.1.3.RELEASE:compile 
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.25:compile 
[INFO] +- org.springframework.boot:spring-boot-starter-mail:jar:1.5.3.RELEASE:compile 
[INFO] | +- org.springframework:spring-context:jar:4.3.8.RELEASE:compile 
[INFO] | +- org.springframework:spring-context-support:jar:4.3.8.RELEASE:compile 
[INFO] | \- com.sun.mail:javax.mail:jar:1.5.6:compile 
[INFO] |  \- javax.activation:activation:jar:1.1:compile 
[INFO] +- ch.qos.logback:logback-classic:jar:1.1.11:compile 
[INFO] | \- ch.qos.logback:logback-core:jar:1.1.11:compile 
[INFO] +- org.webjars:bootstrap:jar:3.3.7-1:compile 
[INFO] \- org.webjars:jquery:jar:3.2.0:compile 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 1.189 s 
[INFO] Finished at: 2017-04-23T20:10:12+02:00 
[INFO] Final Memory: 25M/437M 
[INFO] ------------------------------------------------------------------------ 
+0

能否請您發佈全'pom.xml'。另外,你用什麼命令來運行應用程序? –

+0

你的應用程序中是否有其他文件? –

+0

不,我沒有其他文件 –

回答

1

嘗試這種依賴關係添加到您的pom.xml

<dependency> 
    <groupId>org.hibernate</groupId> 
    <artifactId>hibernate-core</artifactId> 
    <version>4.3.11.Final</version> 
</dependency> 
+0

不,我在pom文件「複製hibernate-core的託管版本l」中有這樣的警告 –

+1

對於我來說,刪除了 .m2 \ repository \ org \ hibernate \ hibernate-core目錄後,它工作。我有一個無效的jar,並且在mvn安裝後,它再次下載了jar。不需要在pom文件中添加它。 –

0

我遇到了與以下POM相同的問題:

<?xml version="1.0" encoding="UTF-8"?> 
<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/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>dzone.springboot.mysql</groupId> 
    <artifactId>dzone-springboot-mysql-test</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>jar</packaging> 

    <name>dzone-springboot-mysql-test</name> 
    <description>Testing out Spring Boot and MySQL</description> 

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

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
     <java.version>1.8</java.version> 
    </properties> 

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

     <dependency> 
      <groupId>mysql</groupId> 
      <artifactId>mysql-connector-java</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.data</groupId> 
      <artifactId>spring-data-commons</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-test</artifactId> 
      <scope>test</scope> 
     </dependency> 
    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-maven-plugin</artifactId> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

這是mvn dependency:tree輸出:

[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ dzone-springboot-mysql-test --- 
[INFO] dzone.springboot.mysql:dzone-springboot-mysql-test:jar:0.0.1-SNAPSHOT 
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.5.6.RELEASE:compile 
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.5.6.RELEASE:compile 
. . . 
[INFO] | +- org.hibernate:hibernate-core:jar:5.0.12.Final:compile 
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile 
[INFO] | | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile 
[INFO] | | +- org.javassist:javassist:jar:3.21.0-GA:compile 
[INFO] | | +- antlr:antlr:jar:2.7.7:compile 
[INFO] | | +- org.jboss:jandex:jar:2.0.0.Final:compile 
[INFO] | | +- dom4j:dom4j:jar:1.6.1:compile 
[INFO] | | \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile 
[INFO] | +- org.hibernate:hibernate-entitymanager:jar:5.0.12.Final:compile 
[INFO] | +- javax.transaction:javax.transaction-api:jar:1.2:compile 
[INFO] | +- org.springframework.data:spring-data-jpa:jar:1.11.6.RELEASE:compile 
[INFO] | | +- org.springframework:spring-orm:jar:4.3.10.RELEASE:compile 
[INFO] | | +- org.springframework:spring-context:jar:4.3.10.RELEASE:compile 
[INFO] | | | \- org.springframework:spring-expression:jar:4.3.10.RELEASE:compile 
[INFO] | | \- org.springframework:spring-tx:jar:4.3.10.RELEASE:compile 
[INFO] | \- org.springframework:spring-aspects:jar:4.3.10.RELEASE:compile 
. . . 

這是(相關)堆棧跟蹤我得到:

. ____   _   __ _ _ 
/\\/___'_ __ _ _(_)_ __ __ _ \ \ \ \ 
(()\___ | '_ | '_| | '_ \/ _` | \ \ \ \ 
\\/ ___)| |_)| | | | | || (_| | )))) 
    ' |____| .__|_| |_|_| |_\__, |//// 
=========|_|==============|___/=/_/_/_/ 
:: Spring Boot ::  (v1.5.6.RELEASE) 

2017-11-22 11:52:04 ERROR o.s.boot.SpringApplication - Application startup failed 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactoryBuilder' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactoryBuilder' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaVendorAdapter' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.JpaVendorAdapter]: Factory method 'jpaVendorAdapter' threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/HibernateException 
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) 
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) 
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1078) 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) 
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) 
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) 
    at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:120) 
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) 
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) 
    at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83) 
    at org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener.outputConditionEvaluationReport(SpringBootDependencyInjectionTestExecutionListener.java:54) 
    at org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener.prepareTestInstance(SpringBootDependencyInjectionTestExecutionListener.java:47) 
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230) 
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228) 
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287) 
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) 
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289) 
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247) 
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) 
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) 
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) 
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) 
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) 
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) 
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) 
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) 
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) 
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) 
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) 
. . . 
Caused by: java.lang.ClassNotFoundException: org.hibernate.HibernateException 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
    ... 85 common frames omitted 

正如我一直在嘗試了一下彈簧啓動較晚,我發現對於許多依賴項,除了Spring Boot 1.4.1.RELEASE以外,入門項目功能不能很好地處理依賴性處理。當我改變像這樣的彈簧引導版本:

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

......它一切都很完美。正如人們所預料的那樣,mvn dependency:tree揭示了依賴性的變化。這裏的變化統一差異的看法:

--- /home/rick/projects/dzone-springboot-mysql-test/tree.1.4.1.RELEASE.txt 
+++ /home/rick/projects/dzone-springboot-mysql-test/tree.1.5.6.RELEASE.txt 
@@ -27,66 +6,65 @@ 
[INFO] 
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ dzone-springboot-mysql-test --- 
[INFO] dzone.springboot.mysql:dzone-springboot-mysql-test:jar:0.0.1-SNAPSHOT 
-[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.4.1.RELEASE:compile 
-[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.4.1.RELEASE:compile 
-[INFO] | | +- org.springframework.boot:spring-boot:jar:1.4.1.RELEASE:compile 
-[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.4.1.RELEASE:compile 
-[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.4.1.RELEASE:compile 
-[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.1.7:compile 
-[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.1.7:compile 
-[INFO] | | | +- org.slf4j:jul-to-slf4j:jar:1.7.21:compile 
-[INFO] | | | \- org.slf4j:log4j-over-slf4j:jar:1.7.21:compile 
+[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.5.6.RELEASE:compile 
+[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.5.6.RELEASE:compile 
+[INFO] | | +- org.springframework.boot:spring-boot:jar:1.5.6.RELEASE:compile 
+[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.6.RELEASE:compile 
+[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.6.RELEASE:compile 
+[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.1.11:compile 
+[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.1.11:compile 
+[INFO] | | | +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile 
+[INFO] | | | \- org.slf4j:log4j-over-slf4j:jar:1.7.25:compile 
[INFO] | | \- org.yaml:snakeyaml:jar:1.17:runtime 
-[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:1.4.1.RELEASE:compile 
-[INFO] | | +- org.springframework:spring-aop:jar:4.3.3.RELEASE:compile 
-[INFO] | | \- org.aspectj:aspectjweaver:jar:1.8.9:compile 
-[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.4.1.RELEASE:compile 
-[INFO] | | +- org.apache.tomcat:tomcat-jdbc:jar:8.5.5:compile 
-[INFO] | | | \- org.apache.tomcat:tomcat-juli:jar:8.5.5:compile 
-[INFO] | | \- org.springframework:spring-jdbc:jar:4.3.3.RELEASE:compile 
-[INFO] | +- org.hibernate:hibernate-core:jar:5.0.11.Final:compile 
-[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile 
+[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:1.5.6.RELEASE:compile 
+[INFO] | | +- org.springframework:spring-aop:jar:4.3.10.RELEASE:compile 
+[INFO] | | \- org.aspectj:aspectjweaver:jar:1.8.10:compile 
+[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.5.6.RELEASE:compile 
+[INFO] | | +- org.apache.tomcat:tomcat-jdbc:jar:8.5.16:compile 
+[INFO] | | | \- org.apache.tomcat:tomcat-juli:jar:8.5.16:compile 
+[INFO] | | \- org.springframework:spring-jdbc:jar:4.3.10.RELEASE:compile 
+[INFO] | +- org.hibernate:hibernate-core:jar:5.0.12.Final:compile 
+[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile 
[INFO] | | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile 
-[INFO] | | +- org.javassist:javassist:jar:3.20.0-GA:compile 
+[INFO] | | +- org.javassist:javassist:jar:3.21.0-GA:compile 
[INFO] | | +- antlr:antlr:jar:2.7.7:compile 
[INFO] | | +- org.jboss:jandex:jar:2.0.0.Final:compile 
[INFO] | | +- dom4j:dom4j:jar:1.6.1:compile 
-[INFO] | | | \- xml-apis:xml-apis:jar:1.4.01:compile 
[INFO] | | \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile 
-[INFO] | +- org.hibernate:hibernate-entitymanager:jar:5.0.11.Final:compile 
+[INFO] | +- org.hibernate:hibernate-entitymanager:jar:5.0.12.Final:compile 
[INFO] | +- javax.transaction:javax.transaction-api:jar:1.2:compile 
-[INFO] | +- org.springframework.data:spring-data-jpa:jar:1.10.3.RELEASE:compile 
-[INFO] | | +- org.springframework:spring-orm:jar:4.3.3.RELEASE:compile 
-[INFO] | | +- org.springframework:spring-context:jar:4.3.3.RELEASE:compile 
-[INFO] | | | \- org.springframework:spring-expression:jar:4.3.3.RELEASE:compile 
-[INFO] | | \- org.springframework:spring-tx:jar:4.3.3.RELEASE:compile 
-[INFO] | \- org.springframework:spring-aspects:jar:4.3.3.RELEASE:compile 
-[INFO] +- mysql:mysql-connector-java:jar:5.1.39:compile 
-[INFO] +- org.springframework.data:spring-data-commons:jar:1.12.3.RELEASE:compile 
-[INFO] | +- org.springframework:spring-core:jar:4.3.3.RELEASE:compile 
-[INFO] | +- org.springframework:spring-beans:jar:4.3.3.RELEASE:compile 
-[INFO] | +- org.slf4j:slf4j-api:jar:1.7.21:compile 
-[INFO] | \- org.slf4j:jcl-over-slf4j:jar:1.7.21:compile 
-[INFO] \- org.springframework.boot:spring-boot-starter-test:jar:1.4.1.RELEASE:test 
-[INFO] +- org.springframework.boot:spring-boot-test:jar:1.4.1.RELEASE:test 
-[INFO] +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.4.1.RELEASE:test 
+[INFO] | +- org.springframework.data:spring-data-jpa:jar:1.11.6.RELEASE:compile 
+[INFO] | | +- org.springframework:spring-orm:jar:4.3.10.RELEASE:compile 
+[INFO] | | +- org.springframework:spring-context:jar:4.3.10.RELEASE:compile 
+[INFO] | | | \- org.springframework:spring-expression:jar:4.3.10.RELEASE:compile 
+[INFO] | | \- org.springframework:spring-tx:jar:4.3.10.RELEASE:compile 
+[INFO] | \- org.springframework:spring-aspects:jar:4.3.10.RELEASE:compile 
+[INFO] +- mysql:mysql-connector-java:jar:5.1.43:compile 
+[INFO] +- org.springframework.data:spring-data-commons:jar:1.13.6.RELEASE:compile 
+[INFO] | +- org.springframework:spring-core:jar:4.3.10.RELEASE:compile 
+[INFO] | +- org.springframework:spring-beans:jar:4.3.10.RELEASE:compile 
+[INFO] | +- org.slf4j:slf4j-api:jar:1.7.25:compile 
+[INFO] | \- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile 
+[INFO] \- org.springframework.boot:spring-boot-starter-test:jar:1.5.6.RELEASE:test 
+[INFO] +- org.springframework.boot:spring-boot-test:jar:1.5.6.RELEASE:test 
+[INFO] +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.6.RELEASE:test 
[INFO] +- com.jayway.jsonpath:json-path:jar:2.2.0:test 
[INFO] | \- net.minidev:json-smart:jar:2.2.1:test 
[INFO] |  \- net.minidev:accessors-smart:jar:1.1:test 
[INFO] |  \- org.ow2.asm:asm:jar:5.0.3:test 
[INFO] +- junit:junit:jar:4.12:test 
-[INFO] +- org.assertj:assertj-core:jar:2.5.0:test 
+[INFO] +- org.assertj:assertj-core:jar:2.6.0:test 
[INFO] +- org.mockito:mockito-core:jar:1.10.19:test 
[INFO] | \- org.objenesis:objenesis:jar:2.1:test 
[INFO] +- org.hamcrest:hamcrest-core:jar:1.3:test 
[INFO] +- org.hamcrest:hamcrest-library:jar:1.3:test 
-[INFO] +- org.skyscreamer:jsonassert:jar:1.3.0:test 
-[INFO] | \- org.json:json:jar:20140107:test 
-[INFO] \- org.springframework:spring-test:jar:4.3.3.RELEASE:test 
+[INFO] +- org.skyscreamer:jsonassert:jar:1.4.0:test 
+[INFO] | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test 
+[INFO] \- org.springframework:spring-test:jar:4.3.10.RELEASE:test 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
-[INFO] Total time: 3.699 s 
-[INFO] Finished at: 2017-11-22T12:02:08-05:00 
-[INFO] Final Memory: 23M/252M 
+[INFO] Total time: 1.525 s 
+[INFO] Finished at: 2017-11-22T12:02:29-05:00 
+[INFO] Final Memory: 23M/429M 
[INFO] ------------------------------------------------------------------------ 

總結的變化:

org.springframework.boot:彈簧引導起動數據JPA:罐子:1.5.6.RELEASE 降級 org.springframework.boot:彈簧引導起動數據JPA:罐:1.4.1.RELEASE

org.hibernate作爲:休眠核:罐:5.0.12.Final 降級到 org.hibernate作爲:hibernate-core:jar:5.0.11.Final

org.springframework.data:spring-data-jpa:jar:1.11.6.RELEASE 降級到 org.springframework.data:spring-data-jpa:jar:1.10.3.RELEASE

在這點我不完全確定哪個修復了類路徑,但現在springboot正在愉快地加載上下文。

UPDATE:這裏是對代碼的鏈接:https://github.com/rbuitragoc/dzone-springboot-mysql-test

相關問題