SpringCloud学习笔记-Eureka搭建过程中的出现问题

问题1:Gson包冲突,启动Server的时候报错,具体信息描述如下:

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    java.lang.invoke.MethodHandleNatives.resolve(Native Method)

The following method did not exist:

    com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder;

The method's class, com.google.gson.GsonBuilder, is available from the following locations:

    jar:file:/C:/Users/farida/.m2/repository/com/google/code/gson/gson/2.1/gson-2.1.jar!/com/google/gson/GsonBuilder.class

It was loaded from the following location:

    file:/C:/Users/farida/.m2/repository/com/google/code/gson/gson/2.1/gson-2.1.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of com.google.gson.GsonBuilder

  解决方案:排除eureka自身所使用的gson包

    
      org.springframework.cloud
      spring-cloud-starter-netflix-eureka-server
      
        
          com.google.code.gson
          gson
        
      
    

 

你可能感兴趣的:(SpringCloud学习笔记-Eureka搭建过程中的出现问题)