dubbo 消费者 ConsumerApplication 启动报错求助
- Dominant language
- Java
- Stars
- 2.4k
- Forks
- 2k
- PR merge metrics
- No merged PRs in 30d
Description
我照着例子抄了一份消费者,一直启动不起来,希望有人提供一下帮助,哪怕帮我指出错误
代码照着 https://github.com/apache/dubbo-samples/blob/master/dubbo-samples-spring-boot/dubbo-samples-spring-boot-consumer/src/main/java/org/apache/dubbo/springboot/demo/consumer/ConsumerApplication.java 这个文件抄的,当然provider和consumer的依赖、配置也都已经照着抄过来了
具体内容就是
```java
import cc.momas.dubbo.api.AccountService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Service;
@SpringBootApplication
@Service
@EnableDubbo
public class ConsumerApplication {
@DubboReference
private AccountService demoService;
public static void main(String[] args) {
ConfigurableApplicationContext context = SpringApplication.run(ConsumerApplication.class, args);
ConsumerApplication application = context.getBean(ConsumerApplication.class);
String result = application.doSayHello("world");
System.out.println("result: " + result);
}
public String doSayHello(String name) {
return demoService.sayHello(name);
}
}
```
如果还需要更多信息的请,我的代码在 https://github.com/Sod-Momas/playground/tree/master/playground-apache-dubbo 这里
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the ConsumerApplication.java shown in the issue and compare it with the referenced dubbo-samples ConsumerApplication.java, then inspect the linked playground-apache-dubbo project. Run the consumer and capture the complete startup exception, including dependency and configuration details; done means the startup failure has a reproducible cause and a confirmed resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100