lqscript commented on issue #15291:
URL: https://github.com/apache/dubbo/issues/15291#issuecomment-3000081211

   @zrlw 
   I also encountered this issue.
   
   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.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to