[Error]Eureka BeanCreationNotAllowedException

使用Eureka时遇到如下问题:

java.lang.TypeNotPresentException: Type javax.xml.bind.JAXBContext not present
// ...其它信息
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBContext
// ...其它信息

下面警告/错误由上面问题引发的

ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
o.s.b.f.support.DisposableBeanAdapter    : Invocation of destroy method 'close' failed on bean with name 'eurekaRegistration': org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)

解决:

在pom.xml添加


    javax.xml.bind
    jaxb-api
    2.3.0


    com.sun.xml.bind
    jaxb-impl
    2.3.0


    com.sun.xml.bind
    jaxb-core
    2.3.0


    javax.activation
    activation
    1.1.1

参考:

  • 转: 真正解决方案:java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
  • How to resolve java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException in Java 9
  • Eureka Issue 1952

你可能感兴趣的:([Error]Eureka BeanCreationNotAllowedException)