forezp / distributed-limit

一个分布式限流的解决方案!
Apache License 2.0
105 stars 54 forks source link

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

Open hyede opened 5 years ago

hyede commented 5 years ago

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]

zhengjianfeng1103 commented 4 years ago

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

Xiaoah commented 4 years ago

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

docvirt commented 4 years ago

解决了吗

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

hdtopku commented 3 years ago

同遇到

YczYanchengzhe commented 3 years ago

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

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

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

liuyi-stack commented 1 month ago

我配置了,还是空指针 image