dubbo分布式项目
1.在注册中心找不到对应的服务
java.lang.IllegalStateException: Failed to check the status of the service com.pinyougou.sellergoods.service.BrandService. No provider available for the service com.pinyougou.sellergoods.service.BrandService from the url zookeeper://192.168.25.129:2181/com.alibaba.dubbo.registry.RegistryService?application=pinyougou-manager-web&dubbo=2.8.4&interface=com.pinyougou.sellergoods.service.BrandService&methods=update,get,delete,selectOptionList,add,getListByPage&pid=3980&revision=0.0.1-SNAPSHOT&side=consumer×tamp=1501146823396 to the consumer 172.16.17.14 use dubbo version 2.8.4 |
这种错误是服务层代码没有成功注册到注册中心导致,请检查一下你的服务层代码是否添加了@service注解,并且该注解的包一定是com.alibaba.dubbo.config.annotation包,不是org.springframework.stereotype.Service,这个地方极容易出错。另外还有一个原因就是你的服务层工程由于某些原因没有正常启动,也无法注册到注册中心里。
2.无法连接到注册中心
org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 5000 org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:876) org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:98) org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:92) org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:80) com.alibaba.dubbo.remoting.zookeeper.zkclient.ZkclientZookeeperClient.<init>(ZkclientZookeeperClient.java:26) |
请检查IP与端口是否填写正确,检查注册中心是否正常启动
3.dubbo标签报错
t
通常是dubbo.xsd文件有错,重新添加后右键这个xml文件选择validate,然后,windows-preferences-validation,把下面2个勾去掉即可
4.web工程缺少分页依赖
5.报错,类找不到
需要在web消费者工程加分页及mybatis依赖
<!-- 分页 --> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> </dependency> <!-- Mybatis --> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> </dependency> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis-spring</artifactId> </dependency> <dependency> <groupId>com.github.miemiedev</groupId> <artifactId>mybatis-paginator</artifactId> </dependency>
6.报服务超时
com.alibaba.dubbo.remoting.TimeoutException: Waiting server-side response timeout
解决:服务消费者设置超时
<dubbo:provider timeout="100000"/>
7.消费者调提供者能正常返回数据,但前端取值却是空集合,返回对象没有序列化和加set,get方法
8.无法请求FastDFS服务器,报如下异常,
java.net.SocketTimeoutException: connect timed out
java.lang.Exception: getStoreStorage fail, errno code: 0
解决方法即可
网络适配器改为仅主机模式
9.
com.alibaba.dubbo.remoting.RemotingException: message can not send, because channel is closed . url:dubbo://192.168.0.113:20881/com.pinyougou.sellergoods.service.SellerService?anyhost=true&application=pinyougou-shop-web&check=false&codec=dubbo&default.timeout=100000&dubbo=2.8.4&generic=false&heartbeat=60000&interface=com.pinyougou.sellergoods.service.SellerService&methods=update,findOne,findAll,updateStatus,delete,findPage,add&pid=12128&revision=0.0.1-SNAPSHOT&side=consumer×tamp=1607993400111
本机ip发生了变更,修改本机Ip和dubbo-admin管理界面显示一样
10.java.lang.IllegalStateException: Failed to check the status of the service com.pinyougou.search.service.ItemSearchService. No provider available for the
报没有提供者,service工程可能没启动或配置zookeeper服务器ip不正确
11.使用solr时,
org.springframework.data.solr.UncategorizedSolrException: Invalid content type: ; nested exception is org.apache.http.ParseException: Invalid content type:
经过排查是,项目名写错
12.Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project
解决办法:因为有别的tomcat在运行,任务管理器把javax结束即可
13.maven install 报错,控制台其实有2个项目不存在,原因可能是把这2个项目删了,但在parent工程pom.xml还存在依赖,需要删除
13.解决3 字节的 UTF-8 序列的字节 3 无效
在pom.xml加上
<build> <!-- 防止启动报错utf-8错误 --> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <configuration> <encoding>UTF-8</encoding> </configuration> </plugin> </plugins> </build>
14,建子工程模块报错,Could not calculate build plan
解决方案,在该项目pom.xml加入以下依赖,然后在改项目工作空间,cmd进入控制台,mvn install
<dependencies> <dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.6</version> </dependency> </dependencies>
最后maven update→选Force Update of Snapshots/Releases 即可
springCloud项目
1.建立Maven工程时出错,Failure to transfer antlr:antlr:jar XXXXXXXX
解决方案:
a.删除本地仓库后缀.lastUpdated为扩展名的文件
b. 然后在工程上点击右键,选择maven →Update Project
2.SpringCloud,feign远程调用时报错:feign.FeignException: status 404 reading xxx
原因:服务名写错,一定要和提供者服务名一样