yangdi1990 opened a new issue #1246: 参数校验不生效
URL: https://github.com/apache/servicecomb-java-chassis/issues/1246
 
 
   
按照文档配置ExceptionToProducerResponseConverter,但是没有生效,报错信息可以看出先抛出的异常然后再加载SPI服务,其中CustomExceptionToProducerResponseConverter是自定义的ExceptionToProducerResponseConverter(在另一个工程里面同样的写法却是正常的,正常的逻辑应该是走到swagger-invocation-validator.jar中的ParameterValidator类中抛出ConstraintViolationException后被自定义的ExceptionToProducerResponseConverter实现类捕获)
   报错信息如下:
   org.apache.servicecomb.swagger.invocation.exception.InvocationException: 
InvocationException: code=400;msg=CommonExceptionData [message=Parameter is not 
valid for operation [data-service.overview.addVod]. Parameter is [req]. 
Processor is [body].]
        at 
org.apache.servicecomb.common.rest.codec.RestCodec.restToArgs(RestCodec.java:66)
        at 
org.apache.servicecomb.common.rest.filter.inner.ServerRestArgsFilter.afterReceiveRequest(ServerRestArgsFilter.java:60)
        at 
org.apache.servicecomb.common.rest.AbstractRestInvocation.prepareInvoke(AbstractRestInvocation.java:226)
        at 
org.apache.servicecomb.common.rest.AbstractRestInvocation.invoke(AbstractRestInvocation.java:206)
        at 
org.apache.servicecomb.common.rest.AbstractRestInvocation.runOnExecutor(AbstractRestInvocation.java:196)
        at 
org.apache.servicecomb.common.rest.AbstractRestInvocation.lambda$scheduleInvocation$0(AbstractRestInvocation.java:159)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
   16:38:28.009 [pool-2-thread-1] INFO  [] o.a.s.f.common.utils.SPIServiceUtils 
- Found SPI service 
org.apache.servicecomb.swagger.invocation.exception.ExceptionToProducerResponseConverter,
 count=5.
   16:38:28.009 [pool-2-thread-1] INFO  [] o.a.s.f.common.utils.SPIServiceUtils 
-   0. 
com.huawei.wukong.dataservice.exception.CustomExceptionToProducerResponseConverter.
   16:38:28.010 [pool-2-thread-1] INFO  [] o.a.s.f.common.utils.SPIServiceUtils 
-   1. 
org.apache.servicecomb.swagger.invocation.validator.ConstraintViolationExceptionToProducerResponseConverter.
   16:38:28.010 [pool-2-thread-1] INFO  [] o.a.s.f.common.utils.SPIServiceUtils 
-   2. 
org.apache.servicecomb.swagger.invocation.exception.InvocationExceptionToProducerResponseConverter.
   16:38:28.010 [pool-2-thread-1] INFO  [] o.a.s.f.common.utils.SPIServiceUtils 
-   3. 
org.apache.servicecomb.swagger.invocation.exception.DefaultExceptionToProducerResponseConverter.
   16:38:28.010 [pool-2-thread-1] INFO  [] o.a.s.f.common.utils.SPIServiceUtils 
-   4. 
com.huawei.wukong.dataservice.exception.MyExceptionToProducerResponseConverter.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to