美文网首页
springboot对于java版本依赖报错

springboot对于java版本依赖报错

作者: 戏入子迷 | 来源:发表于2019-11-11 09:39 被阅读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>

    相关文章

      网友评论

          本文标题:springboot对于java版本依赖报错

          本文链接:https://www.haomeiwen.com/subject/daizbctx.html