ich für feignClients wie diese meine Feder Wolke aktiviert:Mit Federwolke feign verursacht java.lang.NoClassDefFoundError: heucheln/Logger
@Configuration
@EnableAutoConfiguration
@RestController
@EnableEurekaClient
@EnableCircuitBreaker
@EnableFeignClients
public class SpringCloudConfigClientApplication {
}
Aber als oon wie ich enableFeignClients hinzufügen, habe ich diesen Fehler während der Kompilierung,
java.lang.NoClassDefFoundError: feign/Logger
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2688)
at java.lang.Class.getDeclaredMethods(Class.java:1962)
Mein POM ist
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>1.0.0.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>demo.SpringCloudConfigClientApplication</start-class>
<java.version>1.7</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
</dependencies>
um feign Logger Problem zu beheben, was andere depende Muss ich dem POM noch etwas hinzufügen?
Dank
Danke @spencergibb, basierend auf Ihren Vorschlag, es funktionierte, nachdem ich meine pom ändern. Jetzt habe ich ein anderes Problem für die Verwendung von FeignClient. Bitte siehe unten:
@Autowired
StoreClient storeClient;
@RequestMapping("/stores")
public List<Store> stores() {
return storeClient.getStores();
}
und Schnittstelle ist:
@FeignClient("store")
public interface StoreClient {
@RequestMapping(method = RequestMethod.GET, value = "/stores")
List<Store> getStores();
}
Das Unternehmen lagern ist:
public class Store {
private long id;
private String name;
private String zip;
public Store(long id, String name, String zip) {
this.id = id;
this.name = name;
this.zip = zip;
}
}
Wenn ich jetzt in URL abrufen, habe ich diesen Fehler,
ue Jun 09 15:30:10 PDT 2015
There was an unexpected error (type=Internal Server Error, status=500).
Could not read JSON: No suitable constructor found for type [simple type, class demo.entity.Store]: can not instantiate from JSON object (need to add/enable type information?) at [Source: [email protected]; line: 1, column: 3] (through reference chain: java.util.ArrayList[0]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: No suitable constructor found for type [simple type, class demo.entity.Store]: can not instantiate from JSON object (need to add/enable type information?) at [Source: [email protected]; line: 1, column: 3] (through reference chain: java.util.ArrayList[0])
Schien der Fehler hier abgerufen wird Liste kann nicht in Speicherklasse konvertiert werden. Also, um FeignClient zu verwenden, muss jeder andere Mapper enthalten sein, um JSON in Objekte zu konvertieren?
Dank
mir Antwort, einen Standard leeren Konstruktor in der Entität classs arbeiten, um den Mapper machen setzen zu müssen. Danke – user3006967