Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

服务mock疑问 #1273

Open
2 tasks done
JoJoJotarou opened this issue May 7, 2024 · 0 comments
Open
2 tasks done

服务mock疑问 #1273

JoJoJotarou opened this issue May 7, 2024 · 0 comments

Comments

@JoJoJotarou
Copy link

  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the REAMDE of this repository and believe that this is not a duplicate.

Environment

  • Dubbo Admin version: 0.6.0
  • Registry center detail (type and version): nacos 2.3.1
  • Operating System version: centos 7
  • Java version: 1.8

nacos、dubbo-admin docker启动,并且新建一个network,即启动时加了--host nacos-br

Steps to reproduce this issue

  1. code
package com.xinji.boot.example;  // 以下代码都在这个package

@SpringBootApplication
@EnableDubbo
public class DubboAdminMockExampleApplication {

    public static void main(String[] args) {
        SpringApplication.run(DubboAdminMockExampleApplication.class, args);
    }
}

public interface MockService {
    String sayHello(String name);
}

@RestController
@RequestMapping("mock")
public class MockConsumerController {

    @DubboReference
    private MockService mockService;

    @GetMapping
    public String mock() {
        return mockService.sayHello("123");
    }
}
  1. 依赖
    <dependencies>
        <dependency>
            <groupId>org.apache.dubbo.extensions</groupId>
            <artifactId>dubbo-mock-admin</artifactId>
            <version>3.2.0</version>
        </dependency>

        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-spring-boot-starter</artifactId>  // 3.2.11
        </dependency>

        <dependency>
            <groupId>com.alibaba.boot</groupId>
            <artifactId>nacos-config-spring-boot-starter</artifactId> // 0.2.12
        </dependency>
    </dependencies>
  1. yml
server:
  port: 18080
dubbo:
  application:
    name: dubbo-admin-mock-example
  protocol:
    name: dubbo
    port: -1
  registry:
    address: nacos://xxxxx:8848
  1. dubbo-admin 服务mock添加: com.xinji.boot.example.MockService sayHello mock
  2. idea 添加 jvm参数 -Denable.dubbo.admin.mock=true

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

What do you expected from the above steps?

Actual Result

What actually happens?

If there is an exception, please attach the exception trace:

java.lang.IllegalStateException: Failed to check the status of the service com.xinji.boot.example.MockService. No provider available for the service com.xinji.boot.example.MockService from the url consumer://192.168.1.147/com.xinji.boot.example.MockService?application=dubbo-admin-mock-example&background=false&dubbo=2.0.2&executor-management-mode=isolation&file-cache=true&interface=com.xinji.boot.example.MockService&methods=sayHello&pid=308400&register.ip=192.168.1.147&release=3.2.11&side=consumer&sticky=false&timestamp=1715068057062&unloadClusterRelated=false to the consumer 192.168.1.147 use dubbo version 3.2.11
	at org.apache.dubbo.config.ReferenceConfig.checkInvokerAvailable(ReferenceConfig.java:740) [dubbo-3.2.11.jar:3.2.11]
	at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:379) [dubbo-3.2.11.jar:3.2.11]
	at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:238) [dubbo-3.2.11.jar:3.2.11]
	at org.apache.dubbo.config.ReferenceConfigBase.get(ReferenceConfigBase.java:395) [dubbo-3.2.11.jar:3.2.11]
	at org.apache.dubbo.config.utils.SimpleReferenceCache.destroyReference(SimpleReferenceCache.java:294) [dubbo-3.2.11.jar:3.2.11]
	at org.apache.dubbo.config.utils.SimpleReferenceCache.lambda$destroyAll$4(SimpleReferenceCache.java:285) [dubbo-3.2.11.jar:3.2.11]
	at java.util.concurrent.ConcurrentHashMap.forEach(ConcurrentHashMap.java:1597) ~[na:1.8.0_362]
	at org.apache.dubbo.config.utils.SimpleReferenceCache.destroyAll(SimpleReferenceCache.java:283) [dubbo-3.2.11.jar:3.2.11]
	at org.apache.dubbo.config.deploy.DefaultModuleDeployer.unreferServices(DefaultModuleDeployer.java:569) ~[dubbo-3.2.11.jar:3.2.11]
	at org.apache.dubbo.config.deploy.DefaultModuleDeployer.postDestroy(DefaultModuleDeployer.java:296) ~[dubbo-3.2.11.jar:3.2.11]
	at org.apache.dubbo.rpc.model.ModuleModel.onDestroy(ModuleModel.java:111) ~[dubbo-3.2.11.jar:3.2.11]
	at org.apache.dubbo.rpc.model.ScopeModel.destroy(ScopeModel.java:122) ~[dubbo-3.2.11.jar:3.2.11]
	at org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onContextClosedEvent(DubboDeployApplicationListener.java:189) ~[dubbo-3.2.11.jar:3.2.11]
	at org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onApplicationEvent(DubboDeployApplicationListener.java:145) ~[dubbo-3.2.11.jar:3.2.11]
	at org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onApplicationEvent(DubboDeployApplicationListener.java:52) ~[dubbo-3.2.11.jar:3.2.11]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[spring-context-5.3.15.jar:5.3.15]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[spring-context-5.3.15.jar:5.3.15]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[spring-context-5.3.15.jar:5.3.15]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421) ~[spring-context-5.3.15.jar:5.3.15]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378) ~[spring-context-5.3.15.jar:5.3.15]
	at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1058) ~[spring-context-5.3.15.jar:5.3.15]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.doClose(ServletWebServerApplicationContext.java:172) ~[spring-boot-2.6.3.jar:2.6.3]
	at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1021) ~[spring-context-5.3.15.jar:5.3.15]
	at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:788) ~[spring-boot-2.6.3.jar:2.6.3]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.6.3.jar:2.6.3]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) ~[spring-boot-2.6.3.jar:2.6.3]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) ~[spring-boot-2.6.3.jar:2.6.3]
	at com.xinji.boot.example.DubboAdminMockExampleApplication.main(DubboAdminMockExampleApplication.java:12) ~[classes/:na]

然后我加了个yml如下配置禁止检查:

dubbo:
  consumer:
    check: false

然后 GET http://localhost:18080/mock 都是返回500。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant