lqscript opened a new issue, #15484:
URL: https://github.com/apache/dubbo/issues/15484

   ### 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.5
   Jdk 1.8
   
   ### Steps to reproduce this issue
   
   Let service extends the stub base class (e.g., 
DubboGreeterServiceTriple.GreeterServiceImplBase), which is the method 
described in the [official 
documentation](https://cn.dubbo.apache.org/en/overview/mannual/java-sdk/tasks/protocols/triple/idl/#:~:text=extend%20the%20generated%20base%20class%20DubboGreeterTriple.GreeterImplBase)
 for Dubbo Triple services
   
   
![Image](https://github.com/user-attachments/assets/acd20e4b-0b49-4db0-a6c4-1f76f5308e14)
   
   ### What you expected to happen
   
   I found that this problem does not occur if the service class directly 
implements the service interface (e.g., `implements GreeterService`) in[ 
dubbo-demo](https://github.com/apache/dubbo/blob/3.3/dubbo-demo/dubbo-demo-spring-boot-idl/dubbo-demo-spring-boot-idl-provider/src/main/java/org/apache/dubbo/springboot/idl/demo/provider/GreeterServiceImpl.java).
 
   
   However, if the service extends the stub base class (e.g., 
`DubboGreeterServiceTriple.GreeterServiceImplBase`), which is the method 
described in the [official 
documentation](https://cn.dubbo.apache.org/en/overview/mannual/java-sdk/tasks/protocols/triple/idl/#:~:text=extend%20the%20generated%20base%20class%20DubboGreeterTriple.GreeterImplBase)
 for Dubbo Triple services, it returns a 404 error whenever a lowerCamelCase 
method or an UpperCamelCase method is called.
   
   <img width="771" alt="Image" 
src="https://github.com/user-attachments/assets/71833d20-b377-4509-abcc-9c6851666d34";
 />
   
   After debugging the source code, I found that the root cause is related to 
how Dubbo registers HTTP routes for Triple services.
   
   When a service extends the generated base class, Dubbo uses a 
`StubServiceDescriptor`. 
   org/apache/dubbo/config/ServiceConfig.java:565
   <img width="563" alt="Image" 
src="https://github.com/user-attachments/assets/9082ab99-5a1b-4eb5-874b-5fbe659f432e";
 />
   
   This descriptor stores method names using the original names from the .proto 
file, which are typically UpperCamelCase (e.g., `SayHello`).
   
   <img width="1102" alt="Image" 
src="https://github.com/user-attachments/assets/311cdae3-7c77-48f8-a0ad-5bc8445aef4e";
 />
   
   However, the actual method generated in the Java base class follows Java 
conventions and is lowerCamelCase (e.g., `sayHello`).
   
   <img width="1009" alt="Image" 
src="https://github.com/user-attachments/assets/5daeb1ad-ace9-49a8-9e31-8d328b61b162";
 />
   
   When `DefaultRequestMappingRegistry` attempts to create HTTP mappings, it 
reflects on the service implementation and uses the method name 
(lowerCamelCase) to look up its corresponding `ServiceDescriptor`.
   This lookup fails because the registry is searching for a descriptor by its 
lowerCamelCase name, but the descriptor is keyed by the UpperCamelCase name.
   
   
   <img width="803" alt="Image" 
src="https://github.com/user-attachments/assets/24cab6f4-ba1d-4e68-92f3-ab6e0e4b40a0";
 />
   
   
   As a result, no HTTP mapping is registered for the method, causing all 
HTTP-based invocations to fail with a 404 error.
    
   
   ### 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)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to