Failed to bind NettyServer on /192.168.**.*:20880, cause: Failed to bind to: /0.0.0.0:20880
2016-08-08 10:04
423 查看
今天遇到的Dubbo的问题,第一天创建项目,在做Dubbo的Demo的时候遇到的问题,这个问题和解决方案,详见下面:
下面的错误:
其实,我们看代码的话,就可以看到,是地址别占用的问题,我们使用的端口号是20880,说明,20880端口已经被占用了。
我们发布一个系统,那么该系统的所有的提供者,就占用了20880端口:
因此,如果我们,再写一个系统,该系统的dubbo-provider中写的20880:
这个时候,就会报上面的错误,也就是20880端口被一个系统已经占用了,因此,这个提供者的端口,就要换一个了,换一个就随便一个没有被占用的端口就可以了:
这样,我们运行一下provider就不会报错了:
我们可以看一下,我们刚刚的两个系统:
在开发环境上是这样的:
问题:
<span style="font-size:18px;"> Failed to bind NettyServer on /192.168.56.1:20880, cause: Failed to bind to: /0.0.0.0:20880 at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.createServer(DubboProtocol.java:289) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.openServer(DubboProtocol.java:266) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.export(DubboProtocol.java:253) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper.export(ProtocolFilterWrapper.java:55) at com.alibaba.dubbo.rpc.protocol.ProtocolListenerWrapper.export(ProtocolListenerWrapper.java:56) at com.alibaba.dubbo.rpc.Protocol$Adpative.export(Protocol$Adpative.java) at com.alibaba.dubbo.registry.integration.RegistryProtocol.doLocalExport(RegistryProtocol.java:153) at com.alibaba.dubbo.registry.integration.RegistryProtocol.export(RegistryProtocol.java:107) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper.export(ProtocolFilterWrapper.java:53) at com.alibaba.dubbo.rpc.protocol.ProtocolListenerWrapper.export(ProtocolListenerWrapper.java:54) at com.alibaba.dubbo.rpc.Protocol$Adpative.export(Protocol$Adpative.java) at com.alibaba.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:485) at com.alibaba.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:281) at com.alibaba.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:242) at com.alibaba.dubbo.config.ServiceConfig.export(ServiceConfig.java:143) at com.alibaba.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:109) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:163) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:136) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:381) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:335) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:855) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93) at com.tgb.qmx.demo.dubbo.provider.Provider.main(Provider.java:8) Caused by: com.alibaba.dubbo.remoting.RemotingException: Failed to bind NettyServer on /192.168.56.1:20880, cause: Failed to bind to: /0.0.0.0:20880 at com.alibaba.dubbo.remoting.transport.AbstractServer.<init>(AbstractServer.java:72) at com.alibaba.dubbo.remoting.transport.netty.NettyServer.<init>(NettyServer.java:63) at com.alibaba.dubbo.remoting.transport.netty.NettyTransporter.bind(NettyTransporter.java:33) at com.alibaba.dubbo.remoting.Transporter$Adpative.bind(Transporter$Adpative.java) at com.alibaba.dubbo.remoting.Transporters.bind(Transporters.java:48) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchanger.bind(HeaderExchanger.java:41) at com.alibaba.dubbo.remoting.exchange.Exchangers.bind(Exchangers.java:63) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.createServer(DubboProtocol.java:287) ... 24 more Caused by: org.jboss.netty.channel.ChannelException: Failed to bind to: /0.0.0.0:20880 at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:303) at com.alibaba.dubbo.remoting.transport.netty.NettyServer.doOpen(NettyServer.java:94) at com.alibaba.dubbo.remoting.transport.AbstractServer.<init>(AbstractServer.java:67)2016-08-07 21:47:25,015 INFO [com.alibaba.dubbo.config.AbstractConfig] - [DUBBO] Run shutdown hook now., dubbo version: 2.5.3, current host: 127.0.0.1 </span>
下面的错误:
<span style="font-size:18px;">Caused by: java.net.BindException: Address already in use: bind at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:414) at sun.nio.ch.Net.bind(Net.java:406) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.bind(NioServerSocketPipelineSink.java:148) at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleServerSocket(NioServerSocketPipelineSink.java:100) at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:74) at org.jboss.netty.channel.Channels.bind(Channels.java:468) at org.jboss.netty.channel.AbstractChannel.bind(AbstractChannel.java:192) at org.jboss.netty.bootstrap.ServerBootstrap$Binder.channelOpen(ServerBootstrap.java:348) at org.jboss.netty.channel.Channels.fireChannelOpen(Channels.java:176) at org.jboss.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioServerSocketChannel.java:85) at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.newChannel(NioServerSocketChannelFactory.java:142) at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.newChannel(NioServerSocketChannelFactory.java:90) at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:282) ... 33 more </span>
其实,我们看代码的话,就可以看到,是地址别占用的问题,我们使用的端口号是20880,说明,20880端口已经被占用了。
解决方案:
我们看Zookeeper的注册中心查找到了已经有提供者占用了20880端口:我们发布一个系统,那么该系统的所有的提供者,就占用了20880端口:
因此,如果我们,再写一个系统,该系统的dubbo-provider中写的20880:
这个时候,就会报上面的错误,也就是20880端口被一个系统已经占用了,因此,这个提供者的端口,就要换一个了,换一个就随便一个没有被占用的端口就可以了:
这样,我们运行一下provider就不会报错了:
我们可以看一下,我们刚刚的两个系统:
在开发环境上是这样的:
总结:
一句话,一个系统一个端口号。相关文章推荐
- Failed to bind NettyServer on /192.168.**.*:20880, cause: Failed to bind to: /0.0.0.0:20880
- Failed to bind NettyServer on /192.178.103.223:20880, cause: Failed to bind to: /0.0.0.0:20880
- Failed to bind NettyServer on /192.168.49.1:20880, cause: Failed to bind to: /0.0.0.0:20880
- Dubbo 启动报错 Failed to bind NettyServer on /192.168.96.1:20880, cause: Failed to bind to: /0.0.0.0:208
- Failed to bind NettyServer on /192.178.103.223:20880, cause: Failed to bind to: /0.0.0.0:20880
- dobble报错Failed to bind NettyServer on /192.168.0.37:20880, cause: Failed to bind to: /0.0.0.0:20880
- 解决dubbo启动报Failed to bind NettyServer on ip:port的问题
- Dubbo服务启动时Caused by: com.alibaba.dubbo.remoting.RemotingException: Failed to bind NettyServer on /19
- com.alibaba.dubbo.remoting.RemotingException: Failed to bind NettyServer
- (错误)启动ActiveMQ报错:Transport Connector could not be registered in JMX: java.io.IOException: Failed to bind to server socket: stomp://0.0.0.0:61613?
- dubbo单机部署多个应用提示Failed to bind NettyServer
- Failed t bind to server socket:tcp://localhost:61616 due to : java.net.BindException
- bind() to 0.0.0.0:443 failed (10013: An attempt was made to access a socket in a way forbidden by it
- nginx: [emerg] bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way
- 【Nginx】nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
- 解决nginx无法启动, bind() to 0.0.0.0:8080 failed的错误
- nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) 错误解决
- Restarting nginx daemon: nginxnginx: [emerg] bind() to 0.0.0.0:80 failed (98:
- bind() to 0.0.0.0:80 failed (98: Address already in use)
- database connect failed!Can't connect to MySQL server on '127.0.0.1' (13)