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 2019/12/20 11:48:52 UTC

[GitHub] [servicecomb-java-chassis] sunjinghan7331 opened a new issue #1477: 过滤器不生效

sunjinghan7331 opened a new issue #1477: 过滤器不生效
URL: https://github.com/apache/servicecomb-java-chassis/issues/1477
 
 
   按照官方指导的spi方式配置了过滤器,但是没有生效,请问有什么原因?也没有报任何的错误

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-java-chassis] yhs0092 commented on issue #1477: 过滤器不生效

Posted by GitBox <gi...@apache.org>.
yhs0092 commented on issue #1477: 过滤器不生效
URL: https://github.com/apache/servicecomb-java-chassis/issues/1477#issuecomment-568156851
 
 
   是不是SPI配置文件写漏了呢?
   Java-Chassis使用SPI机制加载扩展的时候会打印日志,可以参考一下[这里](https://github.com/apache/servicecomb-java-chassis/issues/1211#issuecomment-493656699)的评论检查一下日志。

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-java-chassis] sunjinghan7331 commented on issue #1477: 过滤器不生效

Posted by GitBox <gi...@apache.org>.
sunjinghan7331 commented on issue #1477: 过滤器不生效
URL: https://github.com/apache/servicecomb-java-chassis/issues/1477#issuecomment-568392230
 
 
   重新配置了过滤器文件,过滤器生效了,谢谢

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #1477: 过滤器不生效

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #1477: 过滤器不生效
URL: https://github.com/apache/servicecomb-java-chassis/issues/1477#issuecomment-568385769
 
 
   配置正确一般日志会打印loadSortedService,然后下面有你的类的名字。没有的话,看看services文件的名称,目录名称等是不是有误,导致JDK没有加载到对应的文件。 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-java-chassis] sunjinghan7331 commented on issue #1477: 过滤器不生效

Posted by GitBox <gi...@apache.org>.
sunjinghan7331 commented on issue #1477: 过滤器不生效
URL: https://github.com/apache/servicecomb-java-chassis/issues/1477#issuecomment-568324737
 
 
   我在resources文件夹下新建了META-INF/services/org.apache.servicecomb.common.rest.filter.HttpServerFilter 文件,里面以包名+类名的全路径方式指定了我的过滤器,过滤器类实现了HttpServerFilter,并且在afterReceiveRequest()方法中打印一行控制台信息。
   
   微服务运行后收到请求,日志中有如下信息:
   [2019-12-23 09:21:50,886][INFO][vert.x-eventloop-thread-8][SPIServiceUtils.java][]Found SPI service javax.ws.rs.core.Response$StatusType, count=0. org.apache.servicecomb.foundation.common.utils.SPIServiceUtils.loadSortedService(SPIServiceUtils.java:79)
   [2019-12-23 09:21:50,889][INFO][vert.x-eventloop-thread-8][SPIServiceUtils.java][]Found SPI service org.apache.servicecomb.core.tracing.TraceIdGenerator, count=1. org.apache.servicecomb.foundation.common.utils.SPIServiceUtils.loadSortedService(SPIServiceUtils.java:79)
   [2019-12-23 09:21:50,889][INFO][vert.x-eventloop-thread-8][SPIServiceUtils.java][]  0. org.apache.servicecomb.core.tracing.BraveTraceIdGenerator. org.apache.servicecomb.foundation.common.utils.SPIServiceUtils.loadSortedService(SPIServiceUtils.java:82)
   没有我自定义的过滤器类,同时自定义的过滤器也没有生效。请看一下是什么问题

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-java-chassis] sunjinghan7331 closed issue #1477: 过滤器不生效

Posted by GitBox <gi...@apache.org>.
sunjinghan7331 closed issue #1477: 过滤器不生效
URL: https://github.com/apache/servicecomb-java-chassis/issues/1477
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services