dubbo项目
@DubboReference注解引用的dubbo接口
项目启动报
Injection of @DubboReference dependencies is failed; nested exception is java.lang.NullPointerException
网上的说明 都是包冲突什么的,解决了很多的包冲突后,问题依然存在
后改为 @DubboReference(check=false) 问题依旧
因为项目内有接口是自提供的,排查injvm方式引用,加入 @DubboReference(check = false, injvm = false)排查spring内部依赖问题
问题终于初见端倪 报了具体的空指针错误位置
java.lang.NullPointerException: null
at org.apache.dubbo.common.extension.support.ActivateComparator.parseActivate(ActivateComparator.java:111)
at org.apache.dubbo.common.extension.support.ActivateComparator.compare(ActivateComparator.java:52)
at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
at java.base/java.util.TimSort.sort(TimSort.java:220)
at java.base/java.util.Arrays.sort(Arrays.java:1515)
at java.base/java.util.ArrayList.sort(ArrayList.java:1750)
at org.apache.dubbo.common.extension.ExtensionLoader.getActivateExtension(ExtensionLoader.java:287)
at org.apache.dubbo.common.extension.ExtensionLoader.getActivateExtension(ExtensionLoader.java:248)
后断点调试,找到空指针所在参数:
org.apache.dubbo.common.extension.support.ActivateComparator
在 info.before = activate.before();断点 找到 activate为null的那个clazz ,发现自定义dubbo过滤器未使用@Activate注解导致此处空指针
private ActivateComparator.ActivateInfo parseActivate(Class> clazz) {
ActivateComparator.ActivateInfo info = new ActivateComparator.ActivateInfo();
if (clazz.isAnnotationPresent(Activate.class)) {
Activate activate = (Activate)clazz.getAnnotation(Activate.class);
info.before = activate.before();
info.after = activate.after();
info.order = activate.order();
} else {
com.alibaba.dubbo.common.extension.Activate activate = (com.alibaba.dubbo.common.extension.Activate)clazz.getAnnotation(com.alibaba.dubbo.common.extension.Activate.class);
info.before = activate.before();
info.after = activate.after();
info.order = activate.order();
}
return info;
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)