You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2022/08/02 07:59:19 UTC

[GitHub] [servicecomb-java-chassis] shri-arunraj opened a new issue, #3255: Help!! Error in consuming Spring boot standalone Application API's Via Gateway

shri-arunraj opened a new issue, #3255:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3255

   I have built a microservice provider based in Spring boot standalone starter. It listens on port `8116`. The Rest API's  provided by this service can be consumed directly on this port `8116` with postman.
   
   However when routed via Gateway, I am getting the below error in the provider. 
   ```
   2022-08-02 13:22:45.980 ERROR 44749 --- [ntloop-thread-8] o.a.s.t.rest.vertx.VertxRestDispatcher   : http server failed.
   
   io.vertx.core.VertxException: Connection was closed
   
   ```
   And At the `gateway` the request is getting timedout.
   ```
   2022-08-02 13:22:45.921  INFO 77044 --- [ntloop-thread-5] o.a.s.t.r.c.http.RestClientInvocation    : Request timeout, Details: The timeout period of 30000ms has been exceeded while executing POST /oauth2/token for server 192.168.1.2:8116.
   2022-08-02 13:22:46.001  INFO 77044 --- [ntloop-thread-5] o.a.s.f.common.utils.SPIServiceUtils     : Found SPI service org.apache.servicecomb.swagger.invocation.exception.ExceptionToProducerResponseConverter, count=8.
   2022-08-02 13:22:46.002  INFO 77044 --- [ntloop-thread-5] o.a.s.f.common.utils.SPIServiceUtils     :   0. org.usb.talech.microservices.runtime.exceptionConverters.ConstraintViolationExceptionToProducerResponseConverter.
   2022-08-02 13:22:46.002  INFO 77044 --- [ntloop-thread-5] o.a.s.f.common.utils.SPIServiceUtils     :   1. org.usb.talech.microservices.runtime.exceptionConverters.IllegalArgumentExceptionToProducerResponseConverter.
   2022-08-02 13:22:46.002  INFO 77044 --- [ntloop-thread-5] o.a.s.f.common.utils.SPIServiceUtils     :   2. org.apache.servicecomb.swagger.invocation.validator.ConstraintViolationExceptionToProducerResponseConverter.
   2022-08-02 13:22:46.002  INFO 77044 --- [ntloop-thread-5] o.a.s.f.common.utils.SPIServiceUtils     :   3. org.usb.talech.microservices.runtime.exceptionConverters.BusinessExceptionToProducerResponseConverter.
   2022-08-02 13:22:46.002  INFO 77044 --- [ntloop-thread-5] o.a.s.f.common.utils.SPIServiceUtils     :   4. org.apache.servicecomb.swagger.invocation.exception.InvocationExceptionToProducerResponseConverter.
   2022-08-02 13:22:46.002  INFO 77044 --- [ntloop-thread-5] o.a.s.f.common.utils.SPIServiceUtils     :   5. org.apache.servicecomb.swagger.invocation.exception.DefaultExceptionToProducerResponseConverter.
   2022-08-02 13:22:46.003  INFO 77044 --- [ntloop-thread-5] o.a.s.f.common.utils.SPIServiceUtils     :   6. org.apache.servicecomb.core.exception.IllegalArgumentExceptionToProducerResponseConverter.
   2022-08-02 13:22:46.003  INFO 77044 --- [ntloop-thread-5] o.a.s.f.common.utils.SPIServiceUtils     :   7. org.apache.servicecomb.core.exception.ThrowableExceptionToProducerResponseConverter.
   2022-08-02 13:22:46.232 ERROR 77044 --- [ntloop-thread-5] i.v.c.http.impl.HttpClientRequestImpl    : io.vertx.core.http.impl.NoStackTraceTimeoutException: The timeout period of 30000ms has been exceeded while executing POST /oauth2/token for server 192.168.1.2:8116
   
   ```
   
   This is my provider Main application.
   ```
   package com.pos.oauth.app.starter;
   
   import org.apache.servicecomb.springboot2.starter.EnableServiceComb;
   import org.apache.servicecomb.tracing.zipkin.EnableZipkinTracing;
   import org.springframework.boot.SpringApplication;
   import org.springframework.boot.WebApplicationType;
   import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
   import org.springframework.boot.autoconfigure.SpringBootApplication;
   import org.springframework.boot.autoconfigure.domain.EntityScan;
   import org.springframework.boot.builder.SpringApplicationBuilder;
   import org.springframework.context.annotation.ComponentScan;
   import org.springframework.context.annotation.ImportResource;
   import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
   
   import com.pos.oauth.service.inter.IPOSMFAAuthLoginWebService;
   
   @SpringBootApplication(scanBasePackages= {"com.pos"})
   @EnableServiceComb
   @EnableAutoConfiguration
   @ComponentScan({"com.pos"})
   @EntityScan(basePackages ={"com.pos"} )
   @EnableZipkinTracing
   @EnableJpaRepositories("com.pos")
   @ImportResource("classpath:application-context.xml")
   public class OAuthServiceMainStandAlone {
   
     public static void main(String[] args) {
   	    new SpringApplicationBuilder().sources(OAuthServiceMainStandAlone.class).web(WebApplicationType.NONE).build().run(args);
     }
   }
   	
   ```
   
   ANd this is my provider configuration
   ```
   server:
     port: 0
   
   # java-chassis configuration
   servicecomb-config-order: 1
   APPLICATION_ID: talech-services
   service_description:
     name: oauth-service
     version: 4.0.1
   servicecomb:
     service:
       registry:
         address: http://127.0.0.1:30100
     rest:
       address: 0.0.0.0:8116
     highway:
       address: 0.0.0.0:7070
     handler:
       chain:
         Provider:
           default: bizkeeper-provider
   spring:
       datasource:
           password: pospassword
           url: jdbc:mysql://localhost:3306/oauth?jdbcCompliantTruncation=false&connectTimeout=30000&socketTimeout=60000&useUnicode=yes&characterEncoding=UTF-8
           username: posuser
   dozer:
     mapping-files: classpath*:/dozer-mapping.xml        
   ```
   
   What i am doing wrong? Why gateway routed requests are failing at provider?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [servicecomb-java-chassis] shri-arunraj commented on issue #3255: Help!! Error in consuming Spring boot standalone Application API's Via Gateway

Posted by GitBox <gi...@apache.org>.
shri-arunraj commented on issue #3255:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3255#issuecomment-1203521905

   @zhaozw 
   
   ```
   servicecomb-config-order: 100
   servicecomb:
     service:
       application: talech-services
       name: gateway
       properties:
         allowCrossApp: true #whether to allow calls across applications
       version: 0.0.4
       registry:
         # Default using local service center
         address: http://localhost:30100
         # address: https://cse.cn-south-1.myhuaweicloud.com
         instance:
           watch: false
   
     flowcontrol:
        Consumer:
          qps:
             enabled: true
             limit:
               oauth-service:
                 OAuthDeveloperService:
                   registerDeveloper: 4 
     handler:
       chain:
         Consumer:
           default: loadbalance,tracing-consumer,qps-flowcontrol-consumer,bizkeeper-consumer
           service:
            mfa-login-service: authClientGrant,loadbalance,tracing-consumer
         Provider:
              default: bizkeeper-provider,tracing-provider
     loadbalance:
       strategy:
         name: WeightedResponse
     rest:
       address: 0.0.0.0:9091?sslEnabled=false
     tracing:
       enabled: true
     http:
       dispatcher:
         edge:
           url:
             enabled: true
             order: 1
             mappings:
               mfaServices:
                 path: "/a/mfa/login/.*"
                 microserviceName: mfa-login-service
                 prefixSegmentCount: 1
                 versionRule: 0.0.0+	
               oauthAdmin:
                 path: "/admin/oauth/.*"
                 microserviceName: oauth-service
                 prefixSegmentCount: 1
                 versionRule: 0.0.0+
               oauthService:
                 path: "/oauth2/.*"
                 microserviceName: oauth-service
                 prefixSegmentCount: 0
                 versionRule: 0.0.0+   
   ```
   
   Note here I am consuming here the rest API hosted by `oauth-service` microservice  and whose path starts with `/oauth2/.*`. It was working before when the provider uses `servlet` based spring boot starter rather than `standalone` starter.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #3255: Help!! Error in consuming Spring boot standalone Application API's Via Gateway

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #3255:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3255#issuecomment-1203613136

   `i.v.c.http.impl.HttpClientRequestImpl    : io.vertx.core.http.impl.NoStackTraceTimeoutException: The timeout period of 30000ms has been exceeded while executing POST /oauth2/token for server 192.168.1.2:8116`
   
   Maybe you need first check if 192.168.1.2:8116 reachable from your gateway environment.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [servicecomb-java-chassis] shri-arunraj commented on issue #3255: Help!! Error in consuming Spring boot standalone Application API's Via Gateway

Posted by GitBox <gi...@apache.org>.
shri-arunraj commented on issue #3255:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3255#issuecomment-1203647766

   @liubao68  If i change the dependency to `java-chassis-spring-boot-starter-servlet` at the provider, it is working as expected. Both provider and gateway are running in my local host. So i guess it shouldn't be a communication problem. 
   ```
       <dependency>
         <groupId>org.apache.servicecomb</groupId>
         <artifactId>java-chassis-spring-boot-starter-servlet</artifactId>
       </dependency>
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #3255: Help!! Error in consuming Spring boot standalone Application API's Via Gateway

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #3255:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3255#issuecomment-1203561246

   Maybe you can try [CommonHttpEdgeDispatcher](https://servicecomb.apache.org/references/java-chassis/zh_CN/edge/by-servicecomb-sdk.html) .  Java Chassis Edge Service default dispatcher only dispatch requests to microservices developed with java chassis. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #3255: Help!! Error in consuming Spring boot standalone Application API's Via Gateway

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #3255:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3255#issuecomment-1207433582

   Do you used some components from spring boot to implements oauth2?  e.g. how `/oauth2/token` is implemented. 
   
   Maybe the module you used only works with servlet. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [servicecomb-java-chassis] zhaozw commented on issue #3255: Help!! Error in consuming Spring boot standalone Application API's Via Gateway

Posted by GitBox <gi...@apache.org>.
zhaozw commented on issue #3255:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3255#issuecomment-1202213864

   could you paste your gateway configuration


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org