0

I am not experienced in spring micro services and zuul configuration so I will need some help.

I have a microservice running on jhipster-registry and I am trying to access the microservice from my application through the gateway.

In my application I have this service in the current routes:

enter image description here

If I am accessing the service when my application is started as a spring boot app everything works fine; but when I deploy my application on tomcat the same request returns 404.

Here is the zuul config :

zuul:
    routes:
     assessmentapi: 
        path: /assessmentapi/**
        serviceId: assessmentapi
        url:  http://192.168.80.44:8081/assessment-api

and http get request

$http.get('/assessmentapi/main/....)
g00glen00b
  • 41,995
  • 13
  • 95
  • 133
Eva Tomovska
  • 105
  • 2
  • 9
  • Is the endpoint accessible through swagger ? You can access swagger-ui when logged as admin on the gateway in the "API" page. There you can switch between microservices at the top right. – Pierre Besson Mar 06 '17 at 21:54
  • hey yes it is accessible, the image that I attached is from the gateway with available services – Eva Tomovska Mar 06 '17 at 23:22

1 Answers1

1

You should not write the URL part in your configuration. As we can see on your gateway screenshot, the gateway already knows the service's IP thanks to Eureka and the Registry. IP addresses should never go into the config as those are determined dynamically.

Pierre Besson
  • 740
  • 3
  • 6
  • Hey Pierre if i remove the url from the config I got this error - Load balancer does not have available server for client: assessmentapi About the previous problem : I deploy the application into the root of the tomcat and works fine which means that application_name after the / on the context path ,when the application is deployed on tomcat causes problem.How to ignore application_name when application is deployed on tomcat ? thanks – Eva Tomovska Mar 10 '17 at 08:17
  • Are you running the JHipster Registry and does you application can be seen there ? And what do you mean by ignore the application_name ? – Pierre Besson Mar 10 '17 at 08:58
  • yes application is registered on jhipster-registry, same as micro service. Probably I didn't explain very good , if I start application as spring boot the request $http.get('/assessmentapi/main/....) return success (localhost:8080) , but if I start on tomcat localhost:8080/application_name it goes with 404. After deploying the application in the root of the tomcat so the context path is localhost:8080/ it is ok . – Eva Tomovska Mar 10 '17 at 09:33