Spring启动无法启动运行
Spring启动无法启动运行,spring,spring-boot,gradle,build.gradle,Spring,Spring Boot,Gradle,Build.gradle,我正在尝试使用osx中的Gradle创建我的第一个Spring Boot应用程序。运行命令gradle bootrun时,出现以下错误:
任务:启动失败
失败:生成失败,出现异常
出了什么问题:
任务“:bootRun”的执行失败。
进程'command'/Library/Java/JavaVirtualMachines/jdk-10.0.2。jdk/Contents/Home/bin/Java''以非零出口值1结束
我的build.gradle文件如下所示(我添加了三个依赖项,rest存储
我正在尝试使用osx中的Gradle创建我的第一个Spring Boot应用程序。运行命令gradle bootrun时,出现以下错误:
任务:启动失败
失败:生成失败,出现异常
任务“:bootRun”的执行失败。
进程'command'/Library/Java/JavaVirtualMachines/jdk-10.0.2。jdk/Contents/Home/bin/Java''以非零出口值1结束
我的build.gradle文件如下所示(我添加了三个依赖项,rest存储库、h2和jpa):
有什么想法吗?
谢谢
编辑:更多错误代码
启动ApplicationContext时出错。要显示条件报告,请在启用“调试”的情况下重新运行应用程序。
2018-08-29 16:45:55.800错误51728---[main]o.s.boot.SpringApplication:应用程序运行失败
org.springframework.beans.factory.BeanCreationException:创建名为“entityManagerFactory”的bean时出错,该bean在类路径资源[org/springframework/boot/autoconfigure/orm/jpa/hibernatejPacConfiguration.class]中定义:调用init方法失败;嵌套的异常是java.lang.NoClassDefFoundError:javax/xml/bind/jaxBeException
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1699)~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:573)~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
在org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
在org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
在org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
在org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1089)~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE]
在org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:859)~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE]
在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE]
在org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)~[spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
在org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762)[spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
位于org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:398)[spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
在org.springframework.boot.SpringApplication.run(SpringApplication.java:330)[spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
在org.springframework.boot.SpringApplication.run(SpringApplication.java:1258)[spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
在org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)[spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
在io.navan.courses.courseApplication.main(courseApplication.java:10)[main/:na]
原因:java.lang.NoClassDefFoundError:javax/xml/bind/JAXBException
在org.hibernate.boot.spi.XmlMappingBinderAccess.(XmlMappingBinderAccess.java:43)~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
在org.hibernate.boot.MetadataSources.(MetadataSources.java:87)~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
在org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.(EntityManagerFactoryBuilderImpl.java:209)~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
在org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.(EntityManagerFactoryBuilderImpl.java:164)~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
在org.springframework.orm.jpa.vendor.springhibernatejbapersistenceprovider.createContainerEntityManager工厂(springhibernatejbapersistenceprovider.java:51)~[spring-orm-5.0.8.RELEASE.jar:5.0.8.RELEASE]
在org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365)~[spring-orm-5.0.8.RELEASE.jar:5.0.8.RELEASE]
在org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:390)~[spring-orm-5.0.8.RELEASE.jar:5.0.8.RELEASE]
在org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.AfterPropertieSet(AbstractEntityManagerFactoryBean.java:377)~[spring-orm-5.0.8.RELEASE.jar:5.0.8.RELEASE]
在org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341)~[spring-orm-5.0.8.RELEASE.jar:5.0.8.RELEASE]
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1758)~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1695)~[spring-beans-5.0.8.RELEASE.jar:5.0.8
buildscript {
ext {
springBootVersion = '2.0.4.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'io.simon'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-data-rest')
runtime('com.h2database:h2')
testCompile('org.springframework.boot:spring-boot-starter-test')
}