Closed recollects closed 5 years ago
升级到 sofa-boot 2.4.3 看看呢.
rpc 的工程里有个 sample.
感谢解答,我升到了2.4.3.这个例子也从找到了 发布服务还是同样的报错! 你运行那个例子是正常的嘛? 因为我查看源码没有找到com.alipay.sofa.runtime.spi.service.BindingConverter这转换器配置文件,在META-INF/services下的文件,所以才会“Can not found binding converter for binding type bolt”
你项目中是引入了 rpc 的 starter?
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>rpc-sofa-boot-starter</artifactId>
</dependency>
http://www.sofastack.tech/sofa-rpc/docs/Getting-Started-with-SOFA-Boot
嗯,这些都引了,发布jvm服务正常,发布其它bolt服务异常。最新源码也下下来了看了! com.alipay.sofa.runtime.spi.service.BindingConverter这转换器配置文件我这里没有找到,binging适配器配置文件是有的,可能是没有这个配置文件ServiceLoader.load加载不到实现吧,麻烦大神看下
@recollects 能否提交一下你的工程到你的公开仓库?这样方便排查,这个文件可以确认肯定是有的
我已经提交上去了,地址:https://github.com/recollects/sofaboot.git 我的意思是加载 应该有这种配置文件的。 运行AnnotationServerApplication这个文件,可以看到错误‘Can not found binding converter for binding type bolt’ 麻烦看看
@recollects 你只是加在了主 pom 的依赖管理里面,可以看一下 mvn 的依赖管理,要真正生效,要在子 pom 中引入.或者按照我们的官方文档来引入依赖.
`@SofaService(bindings = @SofaServiceBinding(bindingType = "jvm")) @Service public class SampleServiceImpl implements SampleService {
} `
异常场景 `@SofaService(bindings = @SofaServiceBinding(bindingType = "bolt")) @Service public class SampleServiceImpl implements SampleService {
@Override public String message() { return "hello sofa"; } } `
源码部分
` if (JvmBinding.JVM_BINDING_TYPE.getType().equals( sofaReferenceAnnotation.binding().bindingType())) { reference.addBinding(new JvmBinding()); } else { BindingConverter bindingConverter = bindingConverterFactory .getBindingConverter(new BindingType(sofaReferenceAnnotation.binding() .bindingType())); if (bindingConverter == null) { throw new ServiceRuntimeException( "Can not found binding converter for binding type "
debug源码部分这个绑定转换器工厂好像没有向这个map里添加绑定转换器! 版本:sofa-boot 2.4.0 SofaRuntimeSpringContextInitializer.initialize这个方法并没有初始化bingdingConverterFactory,所以map里是空的。 看了版本:sofa-boot 2.3.1有初始的操作但是ServiceLoader.load(BindingConverter.class)没有找到关于bolt或者其它类的配置项,相当于bindingConverterFactory里的map转换器还是空的! 麻烦sofa团队大神门帮忙看一下,谢谢啦