Tomcat 启动 Dubbo 端口占用报错 Address already in use: bind

实战 Java 并发编程
实战为导向,从Java 并发原理出发,并集合开发实践,全面剖析 Java 并发编程。
wangxiaoming

 

错误信息如下

Caused by: org.jboss.netty.channel.ChannelException: Failed to bind to: /0.0.0.0:6306
	at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:303) ~[netty-3.2.5.Final.jar:?]
	at com.alibaba.dubbo.remoting.transport.netty.NettyServer.doOpen(NettyServer.java:92) ~[dubbo-2.5.10.jar:2.0.1]
	at com.alibaba.dubbo.remoting.transport.AbstractServer.<init>(AbstractServer.java:63) ~[dubbo-2.5.10.jar:2.0.1]
	at com.alibaba.dubbo.remoting.transport.netty.NettyServer.<init>(NettyServer.java:61) ~[dubbo-2.5.10.jar:2.0.1]
	at com.alibaba.dubbo.remoting.transport.netty.NettyTransporter.bind(NettyTransporter.java:31) ~[dubbo-2.5.10.jar:2.0.1]
	at com.alibaba.dubbo.remoting.Transporter$Adaptive.bind(Transporter$Adaptive.java) ~[dubbo-2.5.10.jar:2.0.1]
	at com.alibaba.dubbo.remoting.Transporters.bind(Transporters.java:56) ~[dubbo-2.5.10.jar:2.0.1]
	at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchanger.bind(HeaderExchanger.java:42) ~[dubbo-2.5.10.jar:2.0.1]
	at com.alibaba.dubbo.remoting.exchange.Exchangers.bind(Exchangers.java:70) ~[dubbo-2.5.10.jar:2.0.1]
	at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.createServer(DubboProtocol.java:272) ~[dubbo-2.5.10.jar:2.0.1]
	... 28 more
Caused by: java.net.BindException: Address already in use: bind
	at sun.nio.ch.Net.bind0(Native Method) ~[?:1.8.0_121]
	at sun.nio.ch.Net.bind(Net.java:433) ~[?:1.8.0_121]
	at sun.nio.ch.Net.bind(Net.java:425) ~[?:1.8.0_121]
	at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[?:1.8.0_121]
	at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[?:1.8.0_121]
	at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.bind(NioServerSocketPipelineSink.java:148) ~[netty-3.2.5.Final.jar:?]
	at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleServerSocket(NioServerSocketPipelineSink.java:100) ~[netty-3.2.5.Final.jar:?]
	at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:74) ~[netty-3.2.5.Final.jar:?]
	at org.jboss.netty.channel.Channels.bind(Channels.java:468) ~[netty-3.2.5.Final.jar:?]
	at org.jboss.netty.channel.AbstractChannel.bind(AbstractChannel.java:192) ~[netty-3.2.5.Final.jar:?]
	at org.jboss.netty.bootstrap.ServerBootstrap$Binder.channelOpen(ServerBootstrap.java:348) ~[netty-3.2.5.Final.jar:?]
	at org.jboss.netty.channel.Channels.fireChannelOpen(Channels.java:176) ~[netty-3.2.5.Final.jar:?]
	at org.jboss.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioServerSocketChannel.java:85) ~[netty-3.2.5.Final.jar:?]
	at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.newChannel(NioServerSocketChannelFactory.java:142) ~[netty-3.2.5.Final.jar:?]
	at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.newChannel(NioServerSocketChannelFactory.java:90) ~[netty-3.2.5.Final.jar:?]
	at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:282) ~[netty-3.2.5.Final.jar:?]
	at com.alibaba.dubbo.remoting.transport.netty.NettyServer.doOpen(NettyServer.java:92) ~[dubbo-2.5.10.jar:2.0.1]
	at com.alibaba.dubbo.remoting.transport.AbstractServer.<init>(AbstractServer.java:63) ~[dubbo-2.5.10.jar:2.0.1]
	at com.alibaba.dubbo.remoting.transport.netty.NettyServer.<init>(NettyServer.java:61) ~[dubbo-2.5.10.jar:2.0.1]
	at com.alibaba.dubbo.remoting.transport.netty.NettyTransporter.bind(NettyTransporter.java:31) ~[dubbo-2.5.10.jar:2.0.1]
	at com.alibaba.dubbo.remoting.Transporter$Adaptive.bind(Transporter$Adaptive.java) ~[dubbo-2.5.10.jar:2.0.1]
	at com.alibaba.dubbo.remoting.Transporters.bind(Transporters.java:56) ~[dubbo-2.5.10.jar:2.0.1]
	at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchanger.bind(HeaderExchanger.java:42) ~[dubbo-2.5.10.jar:2.0.1]
	at com.alibaba.dubbo.remoting.exchange.Exchangers.bind(Exchangers.java:70) ~[dubbo-2.5.10.jar:2.0.1]
	at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.createServer(DubboProtocol.java:272) ~[dubbo-2.5.10.jar:2.0.1]
	... 28 more

 

windows  中端口也没有占用 

netstat -ano|grep findstr 8080

 

如果没找到,看下是不是 zookeeper 上面是否有 端口占用

 

如果看到那个任务,使用 taskkill 进行任务删除

taskkill /pid xxx /f

 

 

问题2 QOS  端口冲突

 

我这是在 tomcat 中启动的,因此 在 catalina.sh 中 JAVA_OPTS 修改为

JAVA_OPTS='-DlogPath=/CPCN/logs/Tomcat6 -server -Xms1024m -Xmx4096m -Ddubbo.application.qos.enable=false

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

wangxiaoming CSDN认证博客专家 架构 Spring Boot Redis
博客是很好的总结和记录工具,如果有问题,来不及回复,关注微信公众号:程序员开发者社区,获取我的联系方式,向我提问,也可以给我发送邮件,联系 1275801617@qq.com
©️2020 CSDN 皮肤主题: Age of Ai 设计师: meimeiellie 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值