Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Spring Cloud API gateway not working after deploying it on tomcat

After deploying the gateway war file on tomcat not able to access it.

application.yml file setup

server:
  port: 9000
  servlet:
    context-path: /gateway

spring:
  cloud:
    gateway:
      routes:
      - id: mysqlservice
        uri:  http://localhost:8080
        predicates:
        - Path= /gateway/mysql/**
        filters:
        - StripPrefix=1     
        
        
      - id: xyzservice
        uri:  http://localhost:8080
        predicates:
         - Path= /gateway/xyz/**    
        filters:
        - StripPrefix=1     
             
        
      - id: lightservice
        uri:  http://localhost:8080
        predicates:
         - Path= /gateway/light/**    
        filters:
        - StripPrefix=1     
        
    

The above configuration works fine when I run it through the normal spring boot JAR file

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Ex. http://localhost:9000/gateway/mysql/mysqlapi/test

when it deployed on the tomcat server that time I am not able to access it

Ex. Ex. http://localhost:8080/gateway/mysql/mysqlapi/test

So how can i access it from tomcat server?

>Solution :

You can’t as it is not supported:

Spring Cloud Gateway requires the Netty runtime provided by Spring Boot and Spring Webflux. It does not work in a traditional Servlet Container or when built as a WAR.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading