在春季在上下文初始化期间遇到错误

使用PostgreSQL数据库启动Sprint启动应用程序时出现错误,我试图找到一个解决方案,但迄今尚未找到解决方案。

这是错误:

2018-03-29 17:48:17.945警告13508 --- [main] ationConfigEmbeddedWebApplicationContext:在上下文初始化期间遇到异常 - 取消刷新尝试:org.springframework.beans.factory.BeanCreationException:创建名为'entityManagerFactory'类路径资源[org / springframework / boot / autoconfigure / orm / jpa / HibernateJpaAutoConfiguration.class]:调用init方法失败; 嵌套异常是java.lang.NoClassDefFoundError:javax / xml / bind / JAXBException 2018-03-29 17:48:17.950信息13508 --- [main] o.apache.catalina.core.StandardService:停止服务[Tomcat] 2018 -03-29 17:48:17.975 INFO 13508 --- [main] utoConfigurationReportLoggingInitializer:

启动ApplicationContext时出错。 要显示自动配置报告,请启用'debug'重新运行您的应用程序。 2018-03-29 17:48:17.988错误13508 --- [main] osboot.SpringApplication:应用程序启动失败

org.springframework.beans.factory.BeanCreationException:在类路径资源[org / springframework / boot / autoconfigure / orm / jpa / HibernateJpaAutoConfiguration.class]中定义名称为'entityManagerFactory'的bean时出错:init方法的调用失败; 嵌套异常是java.lang.NoClassDefFoundError:javax / xml / bind / JAXBException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)〜[spring-beans-4.3.14.RELEASE.jar :4.3.14.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)〜[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org在org.springframework.beans.factory.support上的.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)〜[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]。 AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:306)〜[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java: 230)〜[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframewor k.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)〜[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory .getBean(AbstractBeanFactory.java:197)〜[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080)〜[ spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857)〜[spring-context-4.3.14.RELEASE.jar :4.3.14.RELEASE]在org.springframework上的org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)〜[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] .boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)〜[spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE] at org.springframework.boot .SpringApplication.refresh(SpringApplication.java:693)[spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)[spring- boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]在org.springframework.boot.SpringApplication.run(SpringApplication.java:303)[spring-boot-1.5.10.RELEASE.jar:1.5.10。发布]在org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)[spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication .java:1107)[spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE] at com.lowes.promo.PromoApplication.main(PromoApplication.java:14)[bin /:na]引起: java.lang.NoClassDefFoundError:javax / xml / bind / JAXBException at org.hibernate.boot.spi.XmlMappingBinderAccess。(XmlMappingBinderAccess.java:43)〜[hibernate-core-5.0.12.Final.jar:5.0.12.Final ] at org.hibernate.boot.MetadataSources。(MetadataSources.java:87)〜[hibernate-core-5.0.12.Final.jar:5.0 org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl。(EntityManagerFactoryBuilderImpl.java:179)〜[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final] at org.hibernate。 jpa.boot.internal.EntityManagerFactoryBuilderImpl。(EntityManagerFactoryBuilderImpl.java:149)〜[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final] at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory( SpringHibernateJpaPersistenceProvider.java:54)〜[spring-orm-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:360)〜[spring-orm -4.3.14.RELEASE.jar:4.3.14.RELEASE]在org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:382)〜[spring-orm-4.3.14.RELEASE.jar:4.3。 14.RELEASE]在org.springframework.orm.jpa.AbstractEntityManagerFactoryBe an.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:371)〜[spring-orm-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:336)〜 [spring-orm-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)〜[spring-beans-4.3.14。 RELEASE.jar:4.3.14.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)〜[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE ] ...省略16个常用框架由...引发:java.lang.ClassNotFoundException:在java.base / jdk.internal.loader.BuiltinClassLoader.loadClass上的javax.xml.bind.JAXBException(BuiltinClassLoader.java:582)〜[na:na ]在java.base / jdk.internal.loader.ClassLoaders $ AppClassLoader.loadClass(ClassLoaders.java:185)〜[na:na] at java.ba se / java.lang.ClassLoader.loadClass(ClassLoader.java:496)〜[na:na] ...省略了27个通用帧


你可以检查你是否有正确的依赖项添加到你的构建工具配置文件。 如果您使用的是maven,请检查您的pom.xml。

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.3.0</version>
</dependency>

ClassNotFoundException:javax.xml.bind.JAXBException

表明你错过了jaxb-api的依赖关系

链接地址: http://www.djcxy.com/p/60303.html

上一篇: Encountering error during context initialization in spring

下一篇: Spring table relationship problems