distributed-limit icon indicating copy to clipboard operation
distributed-limit copied to clipboard

KeyUtil.getKey() 里面 limitEntity.getLimitType() 空指针异常

Open hyede opened this issue 5 years ago • 5 comments

java.lang.NullPointerException: null at io.github.forezp.distributedlimitcore.util.KeyUtil.getKey(KeyUtil.java:20) ~[distributed-limit-core-1.0.4.jar:na] at io.github.forezp.distributedlimitcore.limit.RedisLimitExcutor.tryAccess(RedisLimitExcutor.java:43) ~[distributed-limit-core-1.0.4.jar:na] at io.github.forezp.distributedlimitcore.aop.LimitAop.before(LimitAop.java:77) ~[distributed-limit-core-1.0.4.jar:na] at sun.reflect.GeneratedMethodAccessor526.invoke(Unknown Source) ~[na:na] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:45005) ~[na:1.8.0_112] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112] at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644) ~[spring-aop-5.0.5.RELEASE.jar:5.0.5.RELEASE] at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:626) ~[spring-aop-5.0.5.RELEASE.jar:5.0.5.RELEASE] at org.springframework.aop.aspectj.AspectJMethodBeforeAdvice.before(AspectJMethodBeforeAdvice.java:44) ~[spring-aop-5.0.5.RELEASE.jar:5.0.5.RELEASE]

hyede avatar Oct 12 '19 04:10 hyede

limit.type = redis/local 你需要在配置文件一下

zhengjianfeng1103 avatar Jul 20 '20 07:07 zhengjianfeng1103

已经在配置文件配置了,但还是报了空指针异常

Xiaoah avatar Aug 19 '20 05:08 Xiaoah

解决了吗

已经在配置文件配置了,但还是报了空指针异常

docvirt avatar Oct 19 '20 12:10 docvirt

同遇到

hdtopku avatar Jan 26 '21 14:01 hdtopku

我也遇到了这个问题, 通过查看官方的example,发现需要在配置文件中指定限制规则 ;

limit.filter=true
limit.rule.url.num=100
limit.rule.url.seconds=2
limit.rule.identifier.key=userId

上面会按照url的规则来拦截 ,希望能够提供一个默认的拦截方式,否则如果不配置会出现上面的NPE问题

YczYanchengzhe avatar Mar 17 '21 08:03 YczYanchengzhe