Failed to bind NettyServer on /10.254.4.57:20880, cause: Failed to bind to: /0.0.0.0:20880 配置dubbo遇到的问题

被刻印的时光 ゝ 提交于 2019-12-05 02:13:20

早上重新配置了一下dubbo,报了这个异常

Initialization of bean failed; nested exception is com.alibaba.dubbo.rpc.RpcException: Fail to start server

...

Failed to bind NettyServer on /10.254.4.57:20880, cause: Failed to bind to: /0.0.0.0:20880

无法绑定,找半天发现是端口冲突,起了两个提供者,端口占用,后面把测试的关了就行了,或者把配置里面的端口换一下也行。

 

顺带提一下,dubbo起提供者的时候,一定要记得配置一个容器!,这里一般是服务层,配置一个监听器就好了。

如果注册中心是zookeeper,启动完成后看看控制台有没有zookeeper打印的心跳检测机制。

web.xml配置:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">

  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>

  <!-- 加载spring容器 -->
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:spring-service.xml</param-value>
  </context-param>
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
</web-app>

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!