springboot对于java版本依赖报错

2019-11-11  本文已影响0人  戏入子迷

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中加上依赖就搞定

    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.3.0</version>
    </dependency>
上一篇下一篇

猜你喜欢

热点阅读