[Bug] Application-level service discovery fails when IDL `package` and `java_package` differ
- Dominant language
- Java
- Stars
- 41.6k
- Forks
- 26.4k
- Avg merge
- 15h 13m
- Merged PRs (30d)
- 4
Description
### Pre-check
- [x] I am sure that all the content I provide is in English.
### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no similar issues.
### Apache Dubbo Component
Java SDK (apache/dubbo)
### Dubbo Version
Dubbo Java 3.3.1
JDK 17
Nacos 2.5.1
### Steps to reproduce this issue
[Application-level service discovery fails when IDL `package` and `java_package` differ](https://github.com/lqscript/dubbo-samples/tree/master/1-basic/dubbo-samples-spring-boot-idl)
org.apache.dubbo.rpc.RpcException: No provider available from registry RegistryDirectory(registry: 127.0.0.1:8848)-Directory(invokers: 0[], validInvokers: 0[], invokersToReconnect: 0[]) for service org.apache.dubbo.springboot.demo.idl.Greeter on consumer 10.94.201.88 use dubbo version 3.3.1, please check status of providers(disabled, not registered or in blocklist).
at org.apache.dubbo.registry.integration.DynamicDirectory.doList(DynamicDirectory.java:204) ~[dubbo-3.3.1.jar:3.3.1]
at org.apache.dubbo.rpc.cluster.directory.AbstractDirectory.list(AbstractDirectory.java:232) ~[dubbo-3.3.1.jar:3.3.1]
at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.list(AbstractClusterInvoker.java:452) ~[dubbo-3.3.1.jar:3.3.1]
at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:355) ~[dubbo-3.3.1.jar:3.3.1]
at org.apache.dubbo.rpc.cluster.router.RouterSnapshotFilter.invoke(RouterSnapshotFilter.java:46) ~[dubbo-3.3.1.jar:3.3.1]
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:349) ~[dubbo-3.3.1.jar:3.3.1]
at org.apache.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:109) ~[dubbo-3.3.1.jar:3.3.1]
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:349) ~[dubbo-3.3.1.jar:3.3.1]
### What you expected to happen
The consumer should successfully discover and connect to the service provider, as the `java_package` option is intended to control the Java package for generated code, and Dubbo's service discovery should correctly use SERVICE_NAME instead of JAVA_SERVICE_NAME
### Anything else
_No response_
### Are you willing to submit a pull request to fix on your own?
- [ ] Yes I am willing to submit a pull request on my own!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
Contributor guide
Research direction
Reproduce the failure with the linked 1-basic/dubbo-samples-spring-boot-idl sample using the reported Dubbo, JDK, and Nacos versions. Start at DynamicDirectory.java:204 and trace the service name used during discovery, comparing SERVICE_NAME with JAVA_SERVICE_NAME. Done means a consumer discovers and connects to the provider when IDL package and java_package differ.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100