-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Closed
Description
- [*] I have searched the issues of this repository and believe that this is not a duplicate.
- [*] I have checked the FAQ of this repository and believe that this is not a duplicate.
Environment
- Dubbo version: 2.7.5-SNAPSHOT
- Dubbo branch: master
- Operating System version: macOS Catalina
- Java version: jdk-11.0.5
Steps to reproduce this issue
- start zookeeper in localhost and port is 2181
- write provider-side code
- start provider, the provider-side code looks like this
public class Application {
private static String zookeeperHost = System.getProperty("zookeeper.address", "127.0.0.1");
public static void main(String[] args) throws Exception {
ServiceConfig<DemoService> service = new ServiceConfig<DemoService>();
service.setApplication(new ApplicationConfig("first-dubbo-provider"));
service.setRegistry(new RegistryConfig("zookeeper://" + zookeeperHost + ":2181"));
service.setInterface(DemoService.class);
service.setRef(new DemoServiceImpl());
service.export();
System.out.println("dubbo service started");
new CountDownLatch(1).await();
}
}Actual Result
But I got an exception.
Exception in thread "main" java.lang.NullPointerException
at org.apache.dubbo.config.AbstractInterfaceConfig.lambda$useRegistryForConfigIfNecessary$7(AbstractInterfaceConfig.java:628)
at java.base/java.util.Optional.orElseGet(Optional.java:369)
at org.apache.dubbo.config.AbstractInterfaceConfig.lambda$useRegistryForConfigIfNecessary$8(AbstractInterfaceConfig.java:620)
at java.base/java.util.Optional.ifPresent(Optional.java:183)
at org.apache.dubbo.config.AbstractInterfaceConfig.useRegistryForConfigIfNecessary(AbstractInterfaceConfig.java:618)
at org.apache.dubbo.config.AbstractInterfaceConfig.checkRegistry(AbstractInterfaceConfig.java:208)
at org.apache.dubbo.config.ServiceConfig.checkAndUpdateSubConfigs(ServiceConfig.java:303)
at org.apache.dubbo.config.ServiceConfig.export(ServiceConfig.java:370)
at com.example.studydubboProvider.Application.main(Application.java:22)
Is this an issue?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels