码上敲享录 > java常见报错解答 > Failed to start bean 'eurekaAutoServiceRegistration'; nested exception is java.lang.NullPointerExcep

Failed to start bean 'eurekaAutoServiceRegistration'; nested exception is java.lang.NullPointerExcep

上一章章节目录下一章 2020-07-26已有2927人阅读 评论(0)

org.springframework.context.ApplicationContextException: Failed to start bean 'eurekaAutoServiceRegistration'; nested exception is java.lang.NullPointerException


引入spring-cloud-starter-netflix-eureka-client和spring-boot-starter-web两个依赖的时候,会出现冲突。由于代码里面用了Spring MVC的Rest方式,而没有用spring-cloud-starter-netflix-eureka-client本身包含Jesery Rest方式。而导致报错


解决方法:

在spring-cloud-starter-netflix-eureka-client排出Jersey

如下:

<dependency>

   <groupId>org.springframework.cloud</groupId>

   <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>


   <!-- 排除Jersey,用SpringMVC Rest方式-->

   <exclusions>

       <exclusion>

           <groupId>com.sun.jersey</groupId>

           <artifactId>jersey-client</artifactId>

       </exclusion>

       <exclusion>

           <groupId>com.sun.jersey</groupId>

           <artifactId>jersey-core</artifactId>

       </exclusion>

       <exclusion>

           <groupId>com.sun.jersey.contribs</groupId>

           <artifactId>jersey-apache-client4</artifactId>

       </exclusion>

   </exclusions>

</dependency>



向大家推荐《Activiti工作流实战教程》:https://xiaozhuanlan.com/activiti
4

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交