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

   ### 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.2.13 oracle jdk 1.8 window10
   
   ### Steps to reproduce this issue
   
   proto: `echo.proto`
   ```
   syntax = "proto3";
   
   package echo;
   option java_package = "dcloud.common";
   option java_multiple_files = true;
   
   service EchoService {
     rpc echo (EchoRequest) returns (EchoResponse) {}
     rpc echo2 (EchoRequest) returns (EchoResponse) {}
   }
   
   message EchoRequest {
     string message = 1;
     string name = 2;
   }
   
   message EchoResponse {
     string message = 1;
     repeated Trace traces = 2;
   }
   ```
   The generated code
   
![image](https://github.com/apache/dubbo/assets/18380553/810e8a92-8bd6-46a1-808d-810d32b729c1)
   EchoServiceOuterClass class is not exists.
   EchoServiceOuterClass  maby use Echo class replace
   Echo class code:
   ```
   
   package dcloud.common;
   
   public final class Echo {
     private Echo() {}
     public static void registerAllExtensions(
         com.google.protobuf.ExtensionRegistryLite registry) {
     }
   
     public static void registerAllExtensions(
         com.google.protobuf.ExtensionRegistry registry) {
       registerAllExtensions(
           (com.google.protobuf.ExtensionRegistryLite) registry);
     }
     static final com.google.protobuf.Descriptors.Descriptor
       internal_static_echo_EchoRequest_descriptor;
     static final 
       com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
         internal_static_echo_EchoRequest_fieldAccessorTable;
     static final com.google.protobuf.Descriptors.Descriptor
       internal_static_echo_EchoResponse_descriptor;
     static final 
       com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
         internal_static_echo_EchoResponse_fieldAccessorTable;
     static final com.google.protobuf.Descriptors.Descriptor
       internal_static_echo_Trace_descriptor;
     static final 
       com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
         internal_static_echo_Trace_fieldAccessorTable;
   
     public static com.google.protobuf.Descriptors.FileDescriptor
         getDescriptor() {
       return descriptor;
     }
     private static  com.google.protobuf.Descriptors.FileDescriptor
         descriptor;
     static {
       java.lang.String[] descriptorData = {
         "\n\necho.proto\022\004echo\",\n\013EchoRequest\022\017\n\007mes" +
         "sage\030\001 \001(\t\022\014\n\004name\030\002 
\001(\t\"<\n\014EchoResponse" +
         "\022\017\n\007message\030\001 \001(\t\022\033\n\006traces\030\002 
\003(\0132\013.echo" +
         ".Trace\"\025\n\005Trace\022\014\n\004host\030\001 
\001(\t2p\n\013EchoSer" +
         "vice\022/\n\004echo\022\021.echo.EchoRequest\032\022.echo.E" +
         "choResponse\"\000\0220\n\005echo2\022\021.echo.EchoReques" +
         "t\032\022.echo.EchoResponse\"\000B\021\n\rdcloud.common" +
         "P\001b\006proto3"
       };
       descriptor = com.google.protobuf.Descriptors.FileDescriptor
         .internalBuildGeneratedFileFrom(descriptorData,
           new com.google.protobuf.Descriptors.FileDescriptor[] {
           });
       internal_static_echo_EchoRequest_descriptor =
         getDescriptor().getMessageTypes().get(0);
       internal_static_echo_EchoRequest_fieldAccessorTable = new
         com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
           internal_static_echo_EchoRequest_descriptor,
           new java.lang.String[] { "Message", "Name", });
       internal_static_echo_EchoResponse_descriptor =
         getDescriptor().getMessageTypes().get(1);
       internal_static_echo_EchoResponse_fieldAccessorTable = new
         com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
           internal_static_echo_EchoResponse_descriptor,
           new java.lang.String[] { "Message", "Traces", });
       internal_static_echo_Trace_descriptor =
         getDescriptor().getMessageTypes().get(2);
       internal_static_echo_Trace_fieldAccessorTable = new
         com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
           internal_static_echo_Trace_descriptor,
           new java.lang.String[] { "Host", });
     }
   
     // @@protoc_insertion_point(outer_class_scope)
   }
   ```
   The issue was resolved when I renamed the proto file name from echo.proto to 
echoService.proto
   
   I checked the dubco-compile code and found that this might be the problem
   
![image](https://github.com/apache/dubbo/assets/18380553/c8784713-d77f-4deb-93bf-b2fb7bfe939c)
   
   
   ### What you expected to happen
   
   Use the proto name when the proto file name is inconsistent with service, 
otherwise use service name +OuterClass
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit a pull request to fix on your own?
   
   - [X] 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: [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