serviceAPI的路径问题已经排查了,没有问题,下面是具体错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘quickstartConsumer’ defined in file [/Users/GreenArrow/Desktop/springbootdubbo/consumer/target/classes/com/greenarrow/springboot/dubbo/consumer/quickstart/QuickstartConsumer.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: quickstartConsumer; nested exception is com.alibaba.dubbo.rpc.RpcException: Fail to create remoting client for service(dubbo://localhost:20880/com.greenarrow.springboot.dubbo.ServiceAPI?application=dubbo-spring-boot-starter&codec=dubbo&dubbo=2.6.0&heartbeat=60000&interface=com.greenarrow.springboot.dubbo.ServiceAPI&methods=sendMessage&pid=22339®ister.ip=125.211.213.133&side=consumer×tamp=1578404241358): client(url: dubbo://localhost:20880/com.greenarrow.springboot.dubbo.ServiceAPI?application=dubbo-spring-boot-starter&codec=dubbo&dubbo=2.6.0&heartbeat=60000&interface=com.greenarrow.springboot.dubbo.ServiceAPI&methods=sendMessage&pid=22339®ister.ip=125.211.213.133&side=consumer×tamp=1578404241358) failed to connect to server localhost/127.0.0.1:20880, error message is:connection timed out
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:603) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at com.greenarrow.springboot.dubbo.consumer.ConsumerApplication.main(ConsumerApplication.java:15) [classes/:na]
Caused by: org.springframework.beans.factory.BeanCreationException: quickstartConsumer; nested exception is com.alibaba.dubbo.rpc.RpcException: Fail to create remoting client for service(dubbo://localhost:20880/com.greenarrow.springboot.dubbo.ServiceAPI?application=dubbo-spring-boot-starter&codec=dubbo&dubbo=2.6.0&heartbeat=60000&interface=com.greenarrow.springboot.dubbo.ServiceAPI&methods=sendMessage&pid=22339®ister.ip=125.211.213.133&side=consumer×tamp=1578404241358): client(url: dubbo://localhost:20880/com.greenarrow.springboot.dubbo.ServiceAPI?application=dubbo-spring-boot-starter&codec=dubbo&dubbo=2.6.0&heartbeat=60000&interface=com.greenarrow.springboot.dubbo.ServiceAPI&methods=sendMessage&pid=22339®ister.ip=125.211.213.133&side=consumer×tamp=1578404241358) failed to connect to server localhost/127.0.0.1:20880, error message is:connection timed out
at com.alibaba.dubbo.spring.boot.DubboConsumerAutoConfigurationKaTeX parse error: Expected 'EOF', got '&' at position 937: …ng-boot-starter&̲codec=dubbo&dub…Adaptive.refer(Protocol$Adaptive.java) ~[dubbo-2.6.0.jar:2.6.0]
at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:394) ~[dubbo-2.6.0.jar:2.6.0]
at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:333) ~[dubbo-2.6.0.jar:2.6.0]
at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:163) ~[dubbo-2.6.0.jar:2.6.0]
at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:59) ~[dubbo-2.6.0.jar:2.6.0]
at com.alibaba.dubbo.spring.boot.DubboConsumerAutoConfigurationKaTeX parse error: Expected 'EOF', got '&' at position 320: …ng-boot-starter&̲codec=dubbo&dub…Adaptive.connect(TransporterAdaptive.java) [dubbo−2.6.0.jar:2.6.0]atcom.alibaba.dubbo.remoting.Transporters.connect(Transporters.java:75) [dubbo−2.6.0.jar:2.6.0]atcom.alibaba.dubbo.remoting.exchange.support.header.HeaderExchanger.connect(HeaderExchanger.java:38) [dubbo−2.6.0.jar:2.6.0]atcom.alibaba.dubbo.remoting.exchange.Exchangers.connect(Exchangers.java:109) [dubbo−2.6.0.jar:2.6.0]atcom.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.initClient(DubboProtocol.java:401) [dubbo−2.6.0.jar:2.6.0]...28commonframesomittedCausedby:java.net.ConnectException:connectiontimedoutatorg.jboss.netty.channel.socket.nio.NioClientSocketPipelineSinkAdaptive.java) ~[dubbo-2.6.0.jar:2.6.0]
at com.alibaba.dubbo.remoting.Transporters.connect(Transporters.java:75) ~[dubbo-2.6.0.jar:2.6.0]
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchanger.connect(HeaderExchanger.java:38) ~[dubbo-2.6.0.jar:2.6.0]
at com.alibaba.dubbo.remoting.exchange.Exchangers.connect(Exchangers.java:109) ~[dubbo-2.6.0.jar:2.6.0]
at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.initClient(DubboProtocol.java:401) ~[dubbo-2.6.0.jar:2.6.0]
... 28 common frames omitted
Caused by: java.net.ConnectException: connection timed out
at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSinkAdaptive.java) [dubbo−2.6.0.jar:2.6.0]atcom.alibaba.dubbo.remoting.Transporters.connect(Transporters.java:75) [dubbo−2.6.0.jar:2.6.0]atcom.alibaba.dubbo.remoting.exchange.support.header.HeaderExchanger.connect(HeaderExchanger.java:38) [dubbo−2.6.0.jar:2.6.0]atcom.alibaba.dubbo.remoting.exchange.Exchangers.connect(Exchangers.java:109) [dubbo−2.6.0.jar:2.6.0]atcom.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.initClient(DubboProtocol.java:401) [dubbo−2.6.0.jar:2.6.0]...28commonframesomittedCausedby:java.net.ConnectException:connectiontimedoutatorg.jboss.netty.channel.socket.nio.NioClientSocketPipelineSinkBoss.processConnectTimeout(NioClientSocketPipelineSink.java:371) ~[netty-3.2.5.Final.jar:na]
at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSinkBoss.run(NioClientSocketPipelineSink.java:283) [netty−3.2.5.Final.jar:na]atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0191]atjava.util.concurrent.ThreadPoolExecutorBoss.run(NioClientSocketPipelineSink.java:283) ~[netty-3.2.5.Final.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_191]
at java.util.concurrent.ThreadPoolExecutorBoss.run(NioClientSocketPipelineSink.java:283) [netty−3.2.5.Final.jar:na]atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0191]atjava.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_191]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_191]
2020-01-07 21:37:22.647 INFO 22339 — [bboShutdownHook] com.alibaba.dubbo.config.AbstractConfig : [DUBBO] Run shutdown hook now., dubbo version: 2.6.0, current host: 125.211.213.133
2020-01-07 21:37:22.648 INFO 22339 — [bboShutdownHook] c.a.d.r.support.AbstractRegistryFactory : [DUBBO] Close all registries [], dubbo version: 2.6.0, current host: 125.211.213.133
Process finished with exit code 1
他这里是说超时了,我之前出过一次错误,是因为serviceAPI路径不一样,改回来后成功过一次,然后没有动过,吃完饭回来就出现了这个问题,啥都没有动过。。。。。
QuickstartConsumer:
package com.greenarrow.springboot.dubbo.consumer.quickstart;
import com.alibaba.dubbo.config.annotation.Reference;
import com.greenarrow.springboot.dubbo.ServiceAPI;
import org.springframework.stereotype.Component;
/**
* @author greenArrow
* @version 1.0
* @date 2020/1/7 7:27 PM
*/
@Component
public class QuickstartConsumer {
@Reference(url = "dubbo://localhost:20880")
private ServiceAPI serviceAPI;
public void sendMessage(String message){
System.out.println(serviceAPI.sendMessage(message));
}
}
QuickstartServiceImpl:
package com.greenarrow.springboot.dubbo.provider.quickstart;
import com.alibaba.dubbo.config.annotation.Service;
import com.greenarrow.springboot.dubbo.ServiceAPI;
import org.springframework.stereotype.Component;
/**
* @author greenArrow
* @version 1.0
* @date 2020/1/7 5:34 PM
*/
@Component
@Service(interfaceClass = ServiceAPI.class)
public class QuickStartServiceImpl implements ServiceAPI {
@Override
public String sendMessage(String message) {
return "quickstart-provider-message=" + message;
}
}