springboot对于java版本依赖报错

JAVA版本从1.8升级到1.9

有一些依赖库,从1.9中分离了,需要手动添加,不然会出现java.lang.NoClassDefFoundError错误

报错如下

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.http.encoding-org.springframework.boot.autoconfigure.web.HttpEncodingProperties': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/ValidationException

注意最后的

nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/ValidationException

这是缺少依赖库,在pom.xml中加上依赖就搞定

    
        javax.xml.bind
        jaxb-api
        2.3.0
    

你可能感兴趣的:(springboot对于java版本依赖报错)