tonyruiyu / dubbo-mock Goto Github PK
View Code? Open in Web Editor NEWdubbo mock web server
License: Apache License 2.0
dubbo mock web server
License: Apache License 2.0
如题
这个项目主要解决什么问题?
服务Mock规则, {测试}、{新增} 按钮默认置灰,用不了,是前端问题吗
哈咯,这边项目拉下来跑了起来,然后也按照你的介绍录了些相关数据,在页面上配置相关的zk地址dubbo服务地址,然后自己写一点规则,都是是页面上的展现呀,这边的mock精华是我还没有体会到么?一脸懵逼。。。这边我看pmo里面还配置了javassist的版本,但是没有看到引包,是作者分享的整个项目吗?
配置的图片现在访问不了了,能更新一下吗
本地启动项目并注册服务和方法,使用dubbo调用该方法,报错
Failed to check the status of the service com.scarb.test.TestService. No provider available for the service com.scarb.test.TestService from the url zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=app&dubbo=2.5.3&interface=com.scarb.test.TestService&methods=testString&pid=8300&side=consumer×tamp=1553619744776 to the consumer 10.0.75.1 use dubbo version 2.5.3
在本地用启动项目web端,注册了一个服务并添加一个Mock方法,如图。
打印日志
2019-03-27 01:01:43,374 INFO [com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry,http-nio-8088-exec-1] - < [DUBBO] Register: dubbo://10.0.75.1:8788/com.scarb.test.TestService?anyhost=true&application=app&dubbo=2.5.3&generic=true&group=group&interface=com.scarb.test.TestService&methods=*&pid=4060&retries=5&side=provider&timeout=50000×tamp=1553619703373, dubbo version: 2.5.3, current host: 127.0.0.1>
2019-03-27 01:01:43,383 INFO [com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry,http-nio-8088-exec-1] - < [DUBBO] Subscribe: provider://10.0.75.1:8788/com.scarb.test.TestService?anyhost=true&application=app&category=configurators&check=false&dubbo=2.5.3&generic=true&group=group&interface=com.scarb.test.TestService&methods=*&pid=4060&retries=5&side=provider&timeout=50000×tamp=1553619703373, dubbo version: 2.5.3, current host: 127.0.0.1>
2019-03-27 01:01:43,389 INFO [com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry,http-nio-8088-exec-1] - < [DUBBO] Notify urls for subscribe url provider://10.0.75.1:8788/com.scarb.test.TestService?anyhost=true&application=app&category=configurators&check=false&dubbo=2.5.3&generic=true&group=group&interface=com.scarb.test.TestService&methods=*&pid=4060&retries=5&side=provider&timeout=50000×tamp=1553619703373, urls: [empty://10.0.75.1:8788/com.scarb.test.TestService?anyhost=true&application=app&category=configurators&check=false&dubbo=2.5.3&generic=true&group=group&interface=com.scarb.test.TestService&methods=*&pid=4060&retries=5&side=provider&timeout=50000×tamp=1553619703373], dubbo version: 2.5.3, current host: 127.0.0.1>
实现TestService
接口
package com.scarb.test;
public interface TestService {
String testString();
}
然后编写消费者如下
import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.ReferenceConfig;
import com.alibaba.dubbo.config.RegistryConfig;
import com.alibaba.dubbo.rpc.service.GenericService;
import com.scarb.test.TestService;
public class MockTestConsumer {
private static TestService testService;
public static void main(String[] args) throws Exception{
ApplicationConfig application = new ApplicationConfig();
application.setName("app");
RegistryConfig registry = new RegistryConfig();
registry.setAddress("zookeeper://127.0.0.1:2181");
registry.setGroup("group");
application.setRegistry(registry);
ReferenceConfig<GenericService> reference = new ReferenceConfig<GenericService>();
// 弱类型接口名
reference.setInterface(TestService.class);
reference.setApplication(application);
TestService testService = (TestService) reference.get();
System.out.println(testService.testString());
}
}
用该程序尝试调用Mock接口,报错,如下
[27/03/19 01:02:33:033 CST] main-SendThread(activate.navicat.com:2181) INFO zookeeper.ClientCnxn: Socket connection established to activate.navicat.com/127.0.0.1:2181, initiating session
[27/03/19 01:02:33:033 CST] main-SendThread(activate.navicat.com:2181) INFO zookeeper.ClientCnxn: Session establishment complete on server activate.navicat.com/127.0.0.1:2181, sessionid = 0x100058eef05001c, negotiated timeout = 30000
[27/03/19 01:02:33:033 CST] main-EventThread INFO zkclient.ZkClient: zookeeper state changed (SyncConnected)
[27/03/19 01:02:33:033 CST] main INFO zookeeper.ZookeeperRegistry: [DUBBO] Register: consumer://10.0.75.1/com.scarb.test.TestService?application=app&category=consumers&check=false&dubbo=2.5.3&interface=com.scarb.test.TestService&methods=testString&pid=8300&side=consumer×tamp=1553619744776, dubbo version: 2.5.3, current host: 10.0.75.1
[27/03/19 01:02:33:033 CST] main INFO zookeeper.ZookeeperRegistry: [DUBBO] Subscribe: consumer://10.0.75.1/com.scarb.test.TestService?application=app&category=providers,configurators,routers&dubbo=2.5.3&interface=com.scarb.test.TestService&methods=testString&pid=8300&side=consumer×tamp=1553619744776, dubbo version: 2.5.3, current host: 10.0.75.1
[27/03/19 01:02:34:034 CST] main INFO zookeeper.ZookeeperRegistry: [DUBBO] Notify urls for subscribe url consumer://10.0.75.1/com.scarb.test.TestService?application=app&category=providers,configurators,routers&dubbo=2.5.3&interface=com.scarb.test.TestService&methods=testString&pid=8300&side=consumer×tamp=1553619744776, urls: [empty://10.0.75.1/com.scarb.test.TestService?application=app&category=providers&dubbo=2.5.3&interface=com.scarb.test.TestService&methods=testString&pid=8300&side=consumer×tamp=1553619744776, empty://10.0.75.1/com.scarb.test.TestService?application=app&category=configurators&dubbo=2.5.3&interface=com.scarb.test.TestService&methods=testString&pid=8300&side=consumer×tamp=1553619744776, empty://10.0.75.1/com.scarb.test.TestService?application=app&category=routers&dubbo=2.5.3&interface=com.scarb.test.TestService&methods=testString&pid=8300&side=consumer×tamp=1553619744776], dubbo version: 2.5.3, current host: 10.0.75.1
Exception in thread "main" java.lang.IllegalStateException: Failed to check the status of the service com.scarb.test.TestService. No provider available for the service com.scarb.test.TestService from the url zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=app&dubbo=2.5.3&interface=com.scarb.test.TestService&methods=testString&pid=8300&side=consumer×tamp=1553619744776 to the consumer 10.0.75.1 use dubbo version 2.5.3
at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:420)
at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:300)
at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:138)
at MockTestConsumer.main(MockTestConsumer.java:25)
试了很久始终无法成功调用mock,所以求助
是调用方法错误还是其他问题?
能否提供成功调用Mock的示例?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.