# jboot-rpc-test **Repository Path**: FangDengFu/jboot-rpc-test ## Basic Information - **Project Name**: jboot-rpc-test - **Description**: 出现一些个问题 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-01-26 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 这是一个测试jboot-rpc的项目。 问题已解决([链接地址](https://gitee.com/fuhai/jboot/issues/IRGGU)) 最近2天一直想用jboot尝试做微服务,但是遇见一些问题,整理在这里等待大神来帮忙,不甚感激。 按照jboot文档进行配置: #### api: ``` package com.fang.rpc.service; public interface HelloService { public String hello(); } ``` #### service-provider: ``` package com.fang.rpc.service.impl; import com.fang.rpc.service.HelloService; import io.jboot.components.rpc.annotation.RPCBean; /** * @author fangdengfu * @date 19-1-26 下午2:53 */ @RPCBean public class HelloServiceImpl implements HelloService { @Override public String hello() { return "hello jboot rpc srv test"; } } ``` ##### service-provider-properties: ``` jboot.app.mode=dev #server config undertow.host=localhost undertow.port=9091 jboot.rpc.type=dubbo jboot.rpc.requestTimeOut=60000 jboot.rpc.registryType=zookeeper jboot.rpc.registryAddress=101.132.42.175:2181 jboot.rpc.registryName=test jboot.rpc.defaultGroup=test jboot.rpc.defaultVersion=1.0 jboot.rpc.hystrixEnable=true jboot.rpc.hystrixTimeout=5000 ``` #### service-customer: ``` package com.fang.rpc.controller; import com.fang.rpc.service.HelloService; import io.jboot.components.rpc.annotation.RPCInject; import io.jboot.web.controller.JbootController; import io.jboot.web.controller.annotation.RequestMapping; /** * @author fangdengfu * @date 19-1-26 下午3:02 */ @RequestMapping("/") public class IndexController extends JbootController { @RPCInject(port = 9091, group = "test", version = "1.0", timeout = 30000) //(这里的配置是我后加的,加上之前调不通,所以尝试这么配置,但是依然调不通) HelloService helloService; public void hello() { renderText(helloService.hello()); } } ``` ##### service-customer-properties: ``` jboot.app.mode=dev #server config undertow.host=localhost undertow.port=9092 jboot.rpc.type=dubbo jboot.rpc.callMode=registry jboot.rpc.requestTimeOut=60000 jboot.rpc.registryType=zookeeper jboot.rpc.registryAddress=101.132.42.175:2181 jboot.rpc.defaultGroup=test jboot.rpc.defaultVersion=1.0 jboot.rpc.hystrixEnable=true jboot.rpc.hystrixTimeout=5000 ``` 以上代码在该项目中都能找到。 #### 调用结果: ``` 500 Internal Server Error com.alibaba.dubbo.rpc.RpcException : Failed to invoke the method hello in the service com.fang.rpc.service.HelloService. No provider available for the service test/com.fang.rpc.service.HelloService:1.0 from registry 101.132.42.175:2181 on the consumer 172.33.0.1 using the dubbo version 2.6.5. Please check if the providers have been started and registered. at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.checkInvokers(AbstractClusterInvoker.java:268) at com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:56) at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:244) at com.alibaba.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:75) at com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:52) at com.alibaba.dubbo.common.bytecode.proxy0.hello(proxy0.java) at com.fang.rpc.controller.IndexController.hello(IndexController.java:19) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.jfinal.aop.Invocation.invoke(Invocation.java:75) at io.jboot.web.fixedinterceptor.FixedInvocation.invoke(FixedInvocation.java:46) at io.jboot.support.metric.JbootMetricInterceptor.intercept(JbootMetricInterceptor.java:40) at io.jboot.web.fixedinterceptor.FixedInvocation.invoke(FixedInvocation.java:44) at io.jboot.support.shiro.JbootShiroInterceptor.intercept(JbootShiroInterceptor.java:33) at io.jboot.web.fixedinterceptor.FixedInvocation.invoke(FixedInvocation.java:44) at io.jboot.support.jwt.JwtInterceptor.intercept(JwtInterceptor.java:41) at io.jboot.web.fixedinterceptor.FixedInvocation.invoke(FixedInvocation.java:44) at io.jboot.web.validate.ParaValidateInterceptor.intercept(ParaValidateInterceptor.java:54) at io.jboot.web.fixedinterceptor.FixedInvocation.invoke(FixedInvocation.java:44) at io.jboot.web.cors.CORSInterceptor.intercept(CORSInterceptor.java:56) at io.jboot.web.fixedinterceptor.FixedInvocation.invoke(FixedInvocation.java:44) at io.jboot.web.handler.JbootActionHandler.invokeInvocation(JbootActionHandler.java:185) at io.jboot.web.handler.JbootActionHandler.handle(JbootActionHandler.java:88) at io.jboot.web.handler.JbootHandler.doHandle(JbootHandler.java:54) at io.jboot.web.handler.JbootHandler.handle(JbootHandler.java:42) at io.jboot.web.cache.ActionCacheHandler.handle(ActionCacheHandler.java:64) at io.jboot.web.handler.JbootFilterHandler.handle(JbootFilterHandler.java:45) at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:86) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.SessionRestoringHandler.handleRequest(SessionRestoringHandler.java:119) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292) at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:360) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Powered by Jboot ``` #### 由此引出一些问题: 1、dubbo-admin 在provider启动后,没有发现服务
2、公司用的dubbo服务名称是这个格式:```com.wnzx.credit.service.xxxx.AuthFacadeService:xxxxx_1.0```
   但是根据报错内容看,jboot用的是这个格式:```test/com.fang.rpc.service.HelloService:1.0```
   这个有影响吗?
麻烦大佬带带我这个小菜逼,谢谢->-