早上重新配置了一下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>