-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conflict with some mechanism in Dubbo 2.6.2 #1769
Comments
@ascrutae please take a look at this. |
@wu-sheng Hey, I also met this problem and I found the reason. Because Skywalking will add /*
* com.alibaba.dubbo.common.extension.ExtensionLoader
* Here dubbo's spi extention mechanism will traverse all the public set method
*/
private T injectExtension(T instance) {
try {
if (objectFactory != null) {
for (Method method : instance.getClass().getMethods()) {
if (method.getName().startsWith("set")
&& method.getParameterTypes().length == 1
&& Modifier.isPublic(method.getModifiers())) {
Class<?> pt = method.getParameterTypes()[0];
try {
String property = method.getName().length() > 3 ? method.getName().substring(3, 4).toLowerCase() + method.getName().substring(4) : "";
Object object = objectFactory.getExtension(pt, property);
if (object != null) {
method.invoke(instance, object);
}
} catch (Exception e) {
logger.error("fail to inject via method " + method.getName()
+ " of interface " + type.getName() + ": " + e.getMessage(), e);
}
}
}
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return instance;
} Before dubbo 2.6.3, the extentionFactory just get bean by name, so there is no errro. /*
* com.alibaba.dubbo.config.spring.extension.SpringExtensionFactory
*/
@Override
@SuppressWarnings("unchecked")
public <T> T getExtension(Class<T> type, String name) {
for (ApplicationContext context : contexts) {
if (context.containsBean(name)) {
Object bean = context.getBean(name);
if (type.isInstance(bean)) {
return (T) bean;
}
}
}
return null;
} After, dubbo monify the code, it also get bean by type and this throw the exception. @Override
@SuppressWarnings("unchecked")
public <T> T getExtension(Class<T> type, String name) {
for (ApplicationContext context : contexts) {
if (context.containsBean(name)) {
Object bean = context.getBean(name);
if (type.isInstance(bean)) {
return (T) bean;
}
}
}
logger.warn("No spring extension(bean) named:" + name + ", try to find an extension(bean) of type " + type.getName());
for (ApplicationContext context : contexts) {
try {
return context.getBean(type);
} catch (NoUniqueBeanDefinitionException multiBeanExe) {
//here will throw exception because setSkyWalkingDynamicField() type is Object and spring will find many beans
throw multiBeanExe;
} catch (NoSuchBeanDefinitionException noBeanExe) {
if (logger.isDebugEnabled()) {
logger.debug("Error when get spring extension(bean) for type:" + type.getName(), noBeanExe);
}
}
}
logger.warn("No spring extension(bean) named:" + name + ", type:" + type.getName() + " found, stop get bean.");
return null;
} Emmm....Maybe you can communicate with dubbo.... |
@IcebergXTY Thanks for the feedback. I already dropped an request in Dubbo mail list, https://lists.apache.org/thread.html/ed79a0284fddfedc53c96e5666a059617693cd4d7628c32de2935ea4@%3Cdev.dubbo.apache.org%3E . Let's wait and see what are they going to response, and we could work from here. |
@chickenlj I've checked the git commit log, this change is from you. Could u pls. take some time to look at it? |
Sure, I am here on it. I guess the newly added method
|
@IcebergXTY @wu-sheng Do you think this will solve your problem? |
@chickenlj I hope the default is not :) SkyWalking will add this method to all enhanced classes, we can't add an annotation belongs to Dubbo only, may trigger ClassNotFound in other scenarios. Or, when could not find the inject way, just ignore. The auto set should not be active always from my perspective. |
Set the default value to not would bring lots of changes to Dubbo, many methods would need to add an annotation and enable injection. Can't SkyWalking just add an annotation when instrumenting Dubbo?
Sounds reasonable, I will consider the possibility of ignoring it when fails. |
@chickenlj What is The parameter |
In theory, we can. But we haven't that kind of core API to do so. So, I hope Dubbo can ignore that by the default mechanism. @chickenlj @diecui1202 Hope this could be fixed soon, and I will keep this open to track the status. If you have any solution, please leave the message here. |
I have created a patch to fix this problem, briefly changes:
|
Both of these are great. Especially just log rather than throw exception. :) Thank so much for helping. @chickenlj . FYI @3zamn @IcebergXTY @ascrutae I think we just need to wait for new version of Dubbo. @chickenlj please info us after release done, then we can close this issue officially. |
@wu-sheng That's great!Thank you for your work! 😊 |
@IcebergXTY The credits belong to Dubbo team. @chickenlj |
I think it will be released along with the upcoming Dubbo v2.6.5. |
@chickenlj Great to know. @IcebergXTY When you have time, please help to test SkyWalking on their incoming 2.6.5, then provide the feedback here. |
@wu-sheng @chickenlj I have updated to dubbo-2.6.5. It works well now. Excellent! |
@IcebergXTY @chickenlj 2.6.5 is already released or not? |
@ascrutae we need to add new dubbo version to our test cases. And we could remove some older ones. |
@wu-sheng I‘m not sure whether dubbo has released officially but the maven repository has already contained the dubbo-2.6.5 |
The new Dubbo version 2.6.5 with this issue solution included has just been released. |
Great. Closing this. Supported is back in 2.6.5 release. |
@chickenlj @wu-sheng Sad……Because dubbo 2.6.6 has bugs so I degrade to dubbo 2.6.4……But I meet this problem. I meet the problem as same as 2009 which QQ or 360 I must choose at most one…… |
They are talking about 2.6.7 is available, is that a better choice? This is also a Dubbo bug... sadly. |
Apache can't randomly release, and each release is unchangeable. So... I am afraid Dubbo community did the right thing. Only the next release is an option. We could ask a Dubbo committer do patch release, such as 2.6.7-patch1, if the community accepts that. |
You are right, so spring-cloud-alibaba comes back to alibaba repo. Thanks for replying |
How about I add a spring bean named skyWalkingDynamicField to avoid this problem ? @wu-sheng In this mechanism maybe skywalking never need this field? |
SkyWalking plugin requires this field. I doubt this w/ highly possible risks. |
I have no other choices since dubbo 2.6.5+ has a bug cannot serialize and 2.6.8 is not release yet…… Maybe I can try? |
You could try :) I am just concerned that, it will break the SpringMVC plugin. |
Or maybe I can delete the dubbo plugin?[It may works] |
/**
* https://github.com/apache/skywalking/issues/1769
*/
@Bean
public String skyWalkingDynamicField() {
return "avoid skywalking conflicts with dubbo 2.6.5-";
} I add this code to my spring config , and it works~ |
That is luck :) Hope it would break other things. |
Please answer these questions before submitting your issue.
Question
extension.SpringExtensionFactory - [DUBBO] No spring extension(bean) named:skyWalkingDynamicField, try to find an extension(bean) of type java.lang.Object, dubbo version: oss, current host: 192.168.0.3
ERROR extension.ExtensionLoader - [DUBBO] fail to inject via method setSkyWalkingDynamicField of interface com.alibaba.dubbo.rpc.Filter:
Bug
Which version of SkyWalking, OS and JRE?
SkyWalking5.6.0、dubbo2.6.2、jre1.8
Which company or project?
What happen?
If possible, provide a way for reproducing the error. e.g. demo application, component version.
dubbo2.6.0- is ok、but dubbo2.6.2+ didn't support
Requirement or improvement
Please support dubbo2.6.2+
The text was updated successfully, but these errors were encountered: