You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
按照官方demo写了一个生产者工程和消费者工程,生产者注册服务到zk上在dubbo-admin中显示正常,然后起了个消费者工程,消费服务报错
Error creating bean with name 'demoService': FactoryBean threw exception on object creation; nested exception is java.lang.UnsupportedOperationException
public class Consumer {
public static void main(String[] args) throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] {
"classpath*:META-INF/spring/spring-config.xml"
});
context.start();
System.out.println("[consumer] 服务已经启动");
DemoService demoService = (DemoService) context.getBean("demoService");
String hello = demoService.sayHello("world");
System.out.println(hello);
System.in.read();
}
}
报错堆栈信息
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'demoService': FactoryBean threw exception on object creation; nested exception is java.lang.UnsupportedOperationException
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:177)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1640)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080)
at org.apache.dubbo.demo.init.Consumer.main(Consumer.java:13)
Caused by: java.lang.UnsupportedOperationException
at java.util.concurrent.CopyOnWriteArrayList$COWIterator.set(CopyOnWriteArrayList.java:1185)
at java.util.Collections.sort(Collections.java:170)
at org.apache.dubbo.rpc.cluster.RouterChain.sort(RouterChain.java:87)
at org.apache.dubbo.rpc.cluster.RouterChain.initWithRouters(RouterChain.java:67)
at org.apache.dubbo.rpc.cluster.RouterChain.<init>(RouterChain.java:57)
at org.apache.dubbo.rpc.cluster.RouterChain.buildChain(RouterChain.java:46)
at org.apache.dubbo.registry.integration.RegistryDirectory.buildRouterChain(RegistryDirectory.java:622)
at org.apache.dubbo.registry.integration.RegistryProtocol.doRefer(RegistryProtocol.java:385)
at org.apache.dubbo.registry.integration.RegistryProtocol.refer(RegistryProtocol.java:367)
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:114)
at org.apache.dubbo.qos.protocol.QosProtocolWrapper.refer(QosProtocolWrapper.java:70)
at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:65)
at org.apache.dubbo.rpc.Protocol$Adaptive.refer(Protocol$Adaptive.java)
at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:366)
at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:305)
at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:231)
at org.apache.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:71)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:170)
... 6 more
Pls. provide [GitHub address] to reproduce this issue.
I guess, The wrong concurrency container was used in the RouterChain.initWithRouters()method,
or the wrong sort method was used in the RouterChain.sort()method.
Use CopyOnWriteArrayList.sort(Comparator<? super E> c) directly sort instead of use Collections.sort
按照官方demo写了一个生产者工程和消费者工程,生产者注册服务到zk上在dubbo-admin中显示正常,然后起了个消费者工程,消费服务报错
Error creating bean with name 'demoService': FactoryBean threw exception on object creation; nested exception is java.lang.UnsupportedOperationException
Environment
code
Pls. provide [GitHub address] to reproduce this issue.
不知道有没有可能是哪些jar包引用的版本不对,我都是按照官方建议的jar包版本配的
The text was updated successfully, but these errors were encountered: