0

I have added spring-cloud-starter-openfeign as a dependency in pom.xml for a spring boot microservice as shown below:

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-openfeign</artifactId>
    </dependency>

When I tried to restart the microservice I saw the below error:

Exception in thread "main" java.lang.IllegalStateException: Failed to read Class-Path attribute from manifest of jar file:/C:/Users/vv185058/.m2/repository/io/reactivex/rxjava/1.3.8/rxjava-1.3.8.jar
    at org.springframework.boot.devtools.restart.ChangeableUrls.getUrlsFromClassPathOfJarManifestIfPossible(ChangeableUrls.java:132)
    at org.springframework.boot.devtools.restart.ChangeableUrls.fromClassLoader(ChangeableUrls.java:98)
    at org.springframework.boot.devtools.restart.DefaultRestartInitializer.getUrls(DefaultRestartInitializer.java:91)
    at org.springframework.boot.devtools.restart.DefaultRestartInitializer.getInitialUrls(DefaultRestartInitializer.java:55)
    at org.springframework.boot.devtools.restart.Restarter.<init>(Restarter.java:142)
    at org.springframework.boot.devtools.restart.Restarter.initialize(Restarter.java:556)

I am using spring boot version 2.0.4. Can you please help me out?

Leviand
  • 2,745
  • 4
  • 29
  • 43
Vamsi
  • 51
  • 2
  • 9
  • Please let me know if any other information is required from my side. – Vamsi Sep 06 '18 at 12:57
  • Assuming you are using maven, did you do a `mvn clean install`? What also is worth a try is removing the folder: C:/Users/vv185058/.m2/repository/io/reactivex/rxjava/1.3.8 from your file system and let maven download it again (by re-building the project) – Casper Sep 06 '18 at 12:59
  • I deleted the directory 1.3.8 and performed maven update project and performed `maven clean install` too. The error is still there. Is there any problem with Eclipse version(I'm using Eclipse Photon) ? – Vamsi Sep 06 '18 at 13:10
  • Mhh eclipse could be the struggle, but I don't know for sure. I stoped using eclipe a long time ago and am still remembering the struggles it gave me back then. You say you performed the `mvn clean install`, did you do this with eclipse or with your CLI (command line interface)? Also try running your application outside eclipse e.g. with your CLI. If these actions don't fix the problem then we have to look at the dependency you added the last to your pom (spring-cloud-starter-openfeign) – Casper Sep 06 '18 at 13:18
  • If using eclipse and this error appears when building from eclipse, try right clicking on the project > select Maven > Update Project. – J E Carter II Sep 06 '18 at 15:56
  • @JECarterII I tried it but it didn’t work for me – Vamsi Sep 06 '18 at 15:58
  • @Casper I used eclipse’s ‘maven clean install’. One more thing I noticed is .. If I remove the openfeign dependency it is fine but the minute I include openfeign in pom.xml it is failing. I did something like this kept the microservice in running state and then I included all the feign dependencies and imports and let it restarted automatically. But if I stop the service and restart again it fails with the above mentioned error. – Vamsi Sep 07 '18 at 09:34
  • @Vamsi Could you include your whole pom.xml so I can test some things for you. – Casper Sep 07 '18 at 09:37
  • Here is the link: https://drive.google.com/open?id=1EJ6P3nasuMxKoz7ji6TLbQFqqq0EqpxL – Vamsi Sep 07 '18 at 09:46
  • Allright I didi some testing and for me everything works fine. I am assuming you know how to use maven in your CLI/console/terminal. I really think you need to run the `mvn clean install` command from your terminal. Also try running your Spring boot application from the terminal with `java -jar target/{your application}.jar` (instead of using eclipse) – Casper Sep 07 '18 at 11:40
  • @Casper thanks for your time. I did see some configuration settings in my eclipse, Windows -> Preferences -> Java -> Installed JREs; This setting only points to JRE, but not to any JDK. Now I set it and did `maven clean install` . It works perfectly alright now. Problem resolved! But I'm still unsure why only openfeign dependency gave issues while rest everything worked well. – Vamsi Sep 07 '18 at 12:08
  • Indeed a weird thing. Glad you got it fixed, your welcome :) – Casper Sep 07 '18 at 13:06
  • The previous setting of jdk worked partially but still I could see issues sometimes. It seems to be a devtools exception. I removed it's dependency from pom.xml and restarted and it worked fine. Couldn't figure out why the issue happens only after adding feign/ribbon dependency to pom. – Vamsi Sep 10 '18 at 11:33

1 Answers1

0

use

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-openfeign-core</artifactId>
</dependency>