找不到zookeeper register中的方法
原因:使用了本地tomcat8
解决:在provider和consumer的pom.xml中添加tomcat7plugin maven启动
问题结局,但我不知道是为何,启动本地的tomcat8时,运行完全是规范的???

类型 异常报告

消息 Request processing failed; nested exception is com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method sayHello in the service com.cheung.service.HelloService. Tried 3 times of the providers [192.168.2.xxx:20881] (1/1) from the registry 10.xxx.55.7:2181 on the consumer 192.168.2.xxx using the dubbo version 2.6.0. Last error is: Failed to invoke remote method: sayHello, provider: dubbo://192.168.2.xxx:20881/com.cheung.service.HelloService?anyhost=true&application=dubbo_consumer&check=false&dubbo=2.6.0&generic=false&interface=com.cheung.service.HelloService&methods=satHello&pid=85829&register.ip=192.168.2.101&remote.timestamp=1647394108767&side=consumer&timestamp=1647394159250, cause: com.alibaba.dubbo.rpc.RpcException: Failed to invoke remote proxy method sayHello to registry://10.xxx.55.7:2181/com.alibaba.dubbo.registry.RegistryService?application=provider_dubbo&dubbo=2.6.0&export=dubbo%3A%2F%2F192.168.2.xxx%3A20881%2Fcom.cheung.service.HelloService%3Fanyhost%3Dtrue%26application%3Dprovider_dubbo%26bind.ip%3D192.168.2.xxx%26bind.port%3D20881%26dubbo%3D2.6.0%26generic%3Dfalse%26interface%3Dcom.cheung.service.HelloService%26methods%3DsatHello%26pid%3D85748%26side%3Dprovider%26timestamp%3D1647394108767&pid=85748&registry=zookeeper&timestamp=1647394108763, cause: Not found method "sayHello" in class com.cheung.service.impl.HelloServiceImpl.
provider pom.xml
<build>
  <plugins>
    <plugin>
            <!--tomcat7插件-->
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <!--指定端口-->
                <port>8888</port>
                <!--请求路径-->
                <path>/</path>
            </configuration>
    </plugin>
  </plugins>
</build>

consumer pom.xml:
<build>
  <plugins>
    <plugin>
            <!--tomcat7插件-->
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <!--指定端口-->
                <port>8887</port>
                <!--请求路径-->
                <path>/</path>
            </configuration>
    </plugin>
  </plugins>
</build>

成功运行结果:
在这里插入图片描述

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐