最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

dubbo服務(wù)無法注冊到zookeeper的問題

 更新時間:2025年07月16日 09:46:30   作者:VenMan  
Dubbo+Zookeeper項目服務(wù)注冊失敗,因模塊創(chuàng)建時誤選Web項目導(dǎo)致main下文件夾名為data,服務(wù)未被識別,更改為java后,服務(wù)正常注冊,Zookeeper心跳及接口調(diào)用問題解決

Dubbo+Zookeeper后臺項目中服務(wù)注冊不上

1、接口調(diào)用時頁面報404,后臺發(fā)現(xiàn)不了請求的url

19:51:56,458 DEBUG DispatcherServlet:891 - DispatcherServlet with name 'springmvc' processing GET request for [/custmer/findAll.do]
19:51:56,460 DEBUG RequestMappingHandlerMapping:312 - Looking up handler method for path /custmer/findAll.do
19:51:56,461 DEBUG RequestMappingHandlerMapping:322 - Did not find handler method for [/custmer/findAll.do]
19:51:56,462  WARN PageNotFound:1205 - No mapping found for HTTP request with URI [/custmer/findAll.do] in DispatcherServlet with name 'springmvc'
19:51:56,462 DEBUG DispatcherServlet:1000 - Successfully completed request

2、服務(wù)啟動后一直沒有收到zookeeper心跳機(jī)制的反饋,正常情況下日志中會打印出來

19:51:20,214  INFO DispatcherServlet:509 - FrameworkServlet 'springmvc': initialization completed in 1771 ms
19:51:20,214 DEBUG DispatcherServlet:175 - Servlet 'springmvc' configured successfully
五月 03, 2022 7:51:20 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-82"]

可能存在的問題

1、掃描不到服務(wù)

2、地址攔截,請求不通過

3、因為使用了dubbo,在導(dǎo)包注解可能存在導(dǎo)錯其他包

排查

1、翻看多次配置,發(fā)現(xiàn)能正常掃描到指定controller文件

<web-app>
<!--提供外部接口訪問-->
  <servlet>
    <servlet-name>springmvc</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  <init-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath*:spring-mvc.xml</param-value>
  </init-param>
<!--初始化容器-->
    <load-on-startup>1</load-on-startup>
  </servlet>
<!--匹配-->
  <servlet-mapping>
    <servlet-name>springmvc</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>
</web-app>
<beans>
    <!--mvc注解驅(qū)動-->
    <mvc:annotation-driven></mvc:annotation-driven>
    <!--dubbo包掃描-->
    <dubbo:annotation package="com.happy.web"></dubbo:annotation>
    <!--注冊中心-->
    <dubbo:registry address="zookeeper://127.0.0.1:2181"></dubbo:registry>
    <!--應(yīng)用名稱-->
    <dubbo:application name="happy-web"></dubbo:application>
    <!--消費端啟動檢查-->
    <dubbo:consumer check="false" timeout="6000000"></dubbo:consumer>
</beans>

2、tomcat中配置了任何請求都可以到達(dá)

<project>
  <build>
        <plugins>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <configuration>
                    <!--指定端口-->
                    <port>82</port>
                    <!--請求路徑-->
                    <path>/</path>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

3、controller和service中導(dǎo)入的包正常

import com.alibaba.dubbo.config.annotation.Reference;
import com.happy.pojo.Custmer;
import com.happy.service.CustmerService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/custmer")
public class CustmerController {

    @Reference
    CustmerService custmerService;

    @RequestMapping("/findAll")
    public List<Custmer> findAll() {
        List<Custmer> all = custmerService.findAll();
        return all;
    }
}
import com.alibaba.dubbo.config.annotation.Service;
import com.happy.dao.CustmerMapper;
import com.happy.pojo.Custmer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

@Service(interfaceClass = CustmerService.class)
@Transactional
public class CustmerServiceImpl implements CustmerService {
    @Autowired
    CustmerMapper custmerMapper;

    @Override
    public List<Custmer> findAll() {
        return custmerMapper.findAll();
    }
}

以上問題解決方法都試過后,發(fā)現(xiàn)不符合本次問題解決方式。項目之前有過做過,經(jīng)過多次對比也沒有發(fā)現(xiàn)有什么不同之處,最后找朋友看了下,才發(fā)現(xiàn)問題

本次問題的原因

  • 在建立模塊時選擇了web項目

  • main下面自動生成的文件夾名為data,導(dǎo)致服務(wù)找不到

本次問題的解決方法

main下面的文件名更改為java后正常

zookeeper心跳機(jī)制正常:

20:32:51,927  INFO DispatcherServlet:509 - FrameworkServlet 'springmvc': initialization completed in 3575 ms
20:32:51,927 DEBUG DispatcherServlet:175 - Servlet 'springmvc' configured successfully
五月 03, 2022 8:32:51 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-82"]
20:32:56,208 DEBUG ClientCnxn:766 - Got notification sessionid:0x18089b835320006

接口調(diào)用正常:

20:33:29,254 DEBUG DispatcherServlet:891 - DispatcherServlet with name 'springmvc' processing GET request for [/custmer/findAll.do]
20:33:29,255 DEBUG RequestMappingHandlerMapping:312 - Looking up handler method for path /custmer/findAll.do
20:33:29,259 DEBUG RequestMappingHandlerMapping:319 - Returning handler method [public java.util.List<com.happy.pojo.Custmer> com.happy.web.CustmerController.findAll()]
20:33:29,259 DEBUG DefaultListableBeanFactory:254 - Returning cached instance of singleton bean 'custmerController'
20:33:29,260 DEBUG DispatcherServlet:979 - Last-Modified value for [/custmer/findAll.do] is: -1
20:33:34,892 DEBUG DecodeHandler:58 -  [DUBBO] Decode decodeable message com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcResult, dubbo version: 2.6.0, current host: 192.168.1.115
20:33:34,967 DEBUG RequestResponseBodyMethodProcessor:277 - Written [[Custmer(id=1, name=小王), Custmer(id=2, name=小楊), Custmer(id=3, name=小劉), Custmer(id=4, name=小李)]] as "application/json" using [org.springframework.http.converter.json.GsonHttpMessageConverter@3b3104b1]
20:33:34,969 DEBUG DispatcherServlet:1076 - Null ModelAndView returned to DispatcherServlet with name 'springmvc': assuming HandlerAdapter completed request handling
20:33:34,971 DEBUG DispatcherServlet:1000 - Successfully completed request

總結(jié)

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Java后端產(chǎn)生驗證碼后臺驗證功能的實現(xiàn)代碼

    Java后端產(chǎn)生驗證碼后臺驗證功能的實現(xiàn)代碼

    這篇文章主要介紹了Java后臺產(chǎn)生驗證碼后臺驗證功能,本文文字結(jié)合實例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價值,需要的朋友可以參考下
    2019-06-06
  • Java實現(xiàn)http請求文件流對帶寬限速獲取md5值

    Java實現(xiàn)http請求文件流對帶寬限速獲取md5值

    文章介紹了如何在進(jìn)行HTTP請求下載大數(shù)據(jù)時處理帶寬限制和并發(fā)問題,通過使用緩沖區(qū)和限速邏輯,可以有效控制下載速度,避免掉包和數(shù)據(jù)丟失,核心公式基于帶寬和已下載字節(jié)數(shù)計算預(yù)期耗時,并通過Thread.sleep()進(jìn)行動態(tài)休眠補償,感興趣的朋友一起看看吧
    2025-02-02
  • SpringBoot實現(xiàn)事務(wù)鉤子函數(shù)的示例

    SpringBoot實現(xiàn)事務(wù)鉤子函數(shù)的示例

    本文主要介紹了SpringBoot實現(xiàn)事務(wù)鉤子函數(shù)的示例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2025-08-08
  • Java 序列化和反序列化實例詳解

    Java 序列化和反序列化實例詳解

    這篇文章主要介紹了Java 序列化和反序列化實例詳解的相關(guān)資料,需要的朋友可以參考下
    2017-03-03
  • Android Home鍵監(jiān)聽的實現(xiàn)代碼

    Android Home鍵監(jiān)聽的實現(xiàn)代碼

    這篇文章主要介紹了Android Home 鍵監(jiān)聽的實現(xiàn)代碼,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-12-12
  • MyBatis中關(guān)于SQL的寫法總結(jié)

    MyBatis中關(guān)于SQL的寫法總結(jié)

    這篇文章主要介紹了MyBatis中關(guān)于SQL的寫法總結(jié),具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-08-08
  • SpringBoot中的自動裝配原理詳解

    SpringBoot中的自動裝配原理詳解

    本文將通過在Spring中集成MyBatis和在SpringBoot中集成MyBatis為大家簡單梳理自動配置過程,感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下
    2024-11-11
  • MyBatis的@SelectProvider注解構(gòu)建動態(tài)SQL方式

    MyBatis的@SelectProvider注解構(gòu)建動態(tài)SQL方式

    這篇文章主要介紹了MyBatis的@SelectProvider注解構(gòu)建動態(tài)SQL方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-08-08
  • mybatis generator 配置 反向生成Entity簡單增刪改查(推薦)

    mybatis generator 配置 反向生成Entity簡單增刪改查(推薦)

    這篇文章主要介紹了mybatis generator 配置 反向生成Entity簡單增刪改查(推薦)的相關(guān)資料,非常不錯,具有參考借鑒價值,需要的朋友可以參考下
    2016-12-12
  • Spring+SpringMVC+Hibernate整合實例講解

    Spring+SpringMVC+Hibernate整合實例講解

    在本篇文章里小編給大家整理的是關(guān)于Spring+SpringMVC+Hibernate整合實例講解,需要的朋友們可以學(xué)習(xí)下。
    2020-03-03

最新評論

西畴县| 淳安县| 克什克腾旗| 定西市| 松江区| 宁都县| 普宁市| 锦屏县| 乾安县| 娄底市| 连城县| 佛山市| 贵德县| 班戈县| 宽甸| 五大连池市| 社旗县| 玉溪市| 绥阳县| 永靖县| 房产| 大邑县| 无为县| 南雄市| 荥阳市| 丰原市| 赫章县| 额尔古纳市| 郧西县| 同仁县| 邯郸市| 十堰市| 洪湖市| 五原县| 扎鲁特旗| 宝兴县| 六枝特区| 仙游县| 济宁市| 集贤县| 屏边|