分佈式項目中一些常見的問題

錯誤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即可

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章