分布式项目中一些常见的问题

来源:互联网 发布:寻侠境界突破数据 编辑:程序博客网 时间:2024/05/16 19:49

错误1.-Dmaven.multiModuleProjectDirectory system property is not set. Check $M2_HOME environment variable and mvn script match.
发生场景:将maven工程安装到本地仓库中时
解决方法:windows—>preferences—->java—>Installed JREs
选择对应的JDK 然后再编辑里Default VM Arguments里添加
-Dmaven.multiModuleProjectDirectory=$M2_HOME

错误2:HTTP Status 500 - Request processing failed; nested exception is java.lang.RuntimeException: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.taotao.mapper.TbItemMapper.selectByPrimaryKey
发生场景:在测试通过ID获取商品信息的时候
原因:由于在dao层中TbItemMapper.xml这些配置文件没有被读取
解决方法:在pom.xml文件中如下配置

  <build>        <resources>            <resource>                <directory>src/main/java</directory>                <includes>                    <include>**/*.xml</include>                </includes>            </resource>        </resources>    </build>

错误3:HTTP Status 500 - Request processing failed; nested exception is com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method findItem in the service com.ldh.service.ItemService. Tried 3 times of the providers [192.168.25.1:20880] (1/1) from the registry 127.0.0.1:2181 on the consumer 192.168.25.1 using the dubbo version 2.5.3. Last error is: Failed to invoke remote method: findItem, provider: dubbo://192.168.25.1:20880/com.ldh.service.ItemService?anyhost=true&application=ldh-manager-web&check=false&dubbo=2.5.3&interface=com.ldh.service.ItemService&methods=findItem&pid=6152&revision=0.0.1-SNAPSHOT&side=consumer&timeout=300000&timestamp=1505723800649, cause: Failed to send response: Response [id=2, version=2.0.0, status=20, event=false, error=null, result=RpcResult [result=com.taotao.pojo.TbItem@2912e8be, exception=null]], cause: java.lang.IllegalStateException: Serialized class com.taotao.pojo.TbItem must implement java.io.Serializable

发生场景:在测试通过ID获取商品信息的时候
原因:TbItem must implement java.io.Serializable,显然是TbItem这个类需要实现序列化接口,因为在网络传输的时候,类都需要实现序列化接口
解决方法:实现序列化接口

错误4:在启动zookeeper时,发生闪退
解决方法:E:\zookeeper-3.4.6\conf目录下,有一个cfg文件,将其名字改成zoo.cfg即可