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

   ### 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  3.3.3,  openjdk 17,  spring boot 2.7.10
   
   ### Steps to reproduce this issue
   
   1.  maven pom.xml
   `<?xml version="1.0" encoding="UTF-8"?>
   <project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
https://maven.apache.org/xsd/maven-4.0.0.xsd";>
       <modelVersion>4.0.0</modelVersion>
       <parent>
           <groupId>com.example</groupId>
           <artifactId>demo5</artifactId>
           <version>0.0.1-SNAPSHOT</version>
           <relativePath>../pom.xml</relativePath>
       </parent>
       <artifactId>demo5-service</artifactId>
       <name>demo5-service</name>
       <description>The real business logics of the project. You can provide 
service implementations or call other
           services.
       </description>
       <properties>
           <maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
           <javax.annotation-api.version>1.3.2</javax.annotation-api.version>
           <protoc.version>3.22.2</protoc.version>
           <!-- required for jdk9 -->
           <grpc.version>1.63.0</grpc.version>
           <dubbo.version>3.3.3</dubbo.version>
           <spring-boot.version>2.7.10</spring-boot.version>
       </properties>
       <dependencies>
           <!-- TODO 如果这里保持注释,会导致运行时异常
           <dependency>
               <groupId>com.google.protobuf</groupId>
               <artifactId>protobuf-java-util</artifactId>
               <version>3.24.0</version>
           </dependency>
           -->
           <!-- https://mvnrepository.com/artifact/io.grpc/grpc-api -->
           <dependency>
               <groupId>io.grpc</groupId>
               <artifactId>grpc-api</artifactId>
               <version>1.63.0</version>
           </dependency>
           <!-- https://mvnrepository.com/artifact/io.grpc/grpc-stub -->
           <dependency>
               <groupId>io.grpc</groupId>
               <artifactId>grpc-stub</artifactId>
               <version>1.63.0</version>
           </dependency>
   
           <!-- https://mvnrepository.com/artifact/io.grpc/grpc-protobuf -->
           <dependency>
               <groupId>io.grpc</groupId>
               <artifactId>grpc-protobuf</artifactId>
               <version>1.63.0</version>
           </dependency>
   
           <dependency>
               <groupId>com.google.protobuf</groupId>
               <artifactId>protobuf-java</artifactId>
               <version>3.24.0</version>
           </dependency>
           <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter</artifactId>
           </dependency>
           <dependency>
               <groupId>com.alibaba.nacos</groupId>
               <artifactId>nacos-client</artifactId>
               <version>2.2.1</version>
           </dependency>
           <!--
           <dependency>
               <groupId>com.example</groupId>
               <artifactId>demo5-api</artifactId>
           </dependency>
           -->
           <dependency>
               <groupId>org.apache.dubbo</groupId>
               <artifactId>dubbo-spring-boot-starter</artifactId>
           </dependency>
   
           <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter-test</artifactId>
               <scope>test</scope>
           </dependency>
           <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter-actuator</artifactId>
           </dependency>
           <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter-web</artifactId>
           </dependency>
       </dependencies>
   
       <build>
           <extensions>
               <extension>
                   <groupId>kr.motd.maven</groupId>
                   <artifactId>os-maven-plugin</artifactId>
                   <version>1.6.1</version>
               </extension>
           </extensions>
           <plugins>
               <plugin>
                   <groupId>org.xolstice.maven.plugins</groupId>
                   <artifactId>protobuf-maven-plugin</artifactId>
                   <version>0.6.1</version>
                   <configuration>
                       
<protocArtifact>com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}
                       </protocArtifact>
                       <pluginId>grpc-java</pluginId>
                       
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}
                       </pluginArtifact>
                       <protocPlugins>
                           <protocPlugin>
                               <id>dubbo</id>
                               <groupId>org.apache.dubbo</groupId>
                               <artifactId>dubbo-compiler</artifactId>
                               <version>${dubbo.version}</version>
                               
<mainClass>org.apache.dubbo.gen.tri.Dubbo3TripleGenerator</mainClass>
                           </protocPlugin>
                       </protocPlugins>
                   </configuration>
                   <executions>
                       <execution>
                           <goals>
                               <goal>compile</goal>
                               <goal>test-compile</goal>
                               <goal>compile-custom</goal>
                               <goal>test-compile-custom</goal>
                           </goals>
                       </execution>
                   </executions>
               </plugin>
               <plugin>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-compiler-plugin</artifactId>
                   <version>${maven-compiler-plugin.version}</version>
               </plugin>
               <plugin>
                   <groupId>org.codehaus.mojo</groupId>
                   <artifactId>build-helper-maven-plugin</artifactId>
                   <version>3.3.0</version>
                   <executions>
                       <execution>
                           <phase>generate-sources</phase>
                           <goals>
                               <goal>add-source</goal>
                           </goals>
                           <configuration>
                               <sources>
                                   
<source>target/generated-sources/protobuf/java</source>
                                   
<source>target/generated-sources/protobuf/grpc-java</source>
                               </sources>
                           </configuration>
                       </execution>
                   </executions>
               </plugin>
               <plugin>
                   <groupId>org.codehaus.mojo</groupId>
                   <artifactId>exec-maven-plugin</artifactId>
                   <version>3.1.0</version>
                   <executions>
                       <execution>
                           <goals>
                               <goal>java</goal>
                           </goals>
                       </execution>
                   </executions>
                   <configuration>
                       <cleanupDaemonThreads>false</cleanupDaemonThreads>
                   </configuration>
               </plugin>
           </plugins>
       </build>
   
   </project>
   `
   2. application.yml 
   `dubbo:
     application:
       logger: slf4j
       name: Demo5Application
       qos-port: 22223
       qos-enable: false
     registry:
       address: nacos://${nacos.address:127.0.0.1}:8848
     protocol:
       name: tri
   #    name: dubbo
       port: 50053
   
   logging:
     level:
       org.apache.dubbo: debug
   management:
     endpoints:
       web:
         exposure:
           include: mappings
   server:
     port: 8081
   `
   4. protobuf
   `syntax = "proto3";
   option java_multiple_files = true;
   
   package org.apache.dubbo.samples.tri.grpc;
   
   message GreeterRequest {
     string name = 1;
   }
   
   message GreeterReply {
     string message = 1;
   }
   
   service Greeter{
   
     rpc greet(GreeterRequest) returns (GreeterReply);
   
     rpc biStream(stream GreeterRequest) returns (stream GreeterReply);
   
     rpc serverStream(GreeterRequest) returns (stream GreeterReply);
   
   }
   `
   4. invoke by http
   url:  127.0.0.1:50053/org.apache.dubbo.samples.tri.grpc.Greeter/greet
   method: POST
   request body: 
   `{
       "name": "paxxie"
   }`
   reponse exception: 
   `2025-03-28 15:57:36.447 ERROR 21062 --- [:50053-thread-2] 
.r.p.t.h.AbstractServerTransportListener :  [DUBBO] An error occurred while 
processing the http request with DefaultHttp11ServerTransportListener, 
Http1Request{method='POST', 
path='/org.apache.dubbo.samples.tri.grpc.Greeter/greet', 
contentType='application/json'}, method=greet(GreeterRequest), dubbo version: 
3.3.3, current host: 172.16.210.84, error code: 99-0. This may be caused by , 
go to https://dubbo.apache.org/faq/99/0 to find instructions. 
   
   org.apache.dubbo.rpc.protocol.tri.rest.RestException: Name for argument of 
type [class org.apache.dubbo.samples.tri.grpc.GreeterRequest] not specified, 
and parameter name information not available via reflection. Ensure that the 
compiler uses the -parameters flag
        at 
org.apache.dubbo.rpc.protocol.tri.rest.mapping.meta.NamedValueMeta.name(NamedValueMeta.java:59)
 ~[dubbo-3.3.3.jar:3.3.3]
        at 
org.apache.dubbo.rpc.protocol.tri.rest.support.basic.FallbackArgumentResolver.doResolveValue(FallbackArgumentResolver.java:106)
 ~[dubbo-3.3.3.jar:3.3.3]
        at 
org.apache.dubbo.rpc.protocol.tri.rest.support.basic.FallbackArgumentResolver.resolveValue(FallbackArgumentResolver.java:73)
 ~[dubbo-3.3.3.jar:3.3.3]
        at 
org.apache.dubbo.rpc.protocol.tri.rest.argument.NamedValueArgumentResolverSupport.resolve(NamedValueArgumentResolverSupport.java:45)
 ~[dubbo-3.3.3.jar:3.3.3]
        at 
org.apache.dubbo.rpc.protocol.tri.rest.argument.AbstractArgumentResolver.resolve(AbstractArgumentResolver.java:28)
 ~[dubbo-3.3.3.jar:3.3.3]
        at 
org.apache.dubbo.rpc.protocol.tri.rest.argument.CompositeArgumentResolver.resolve(CompositeArgumentResolver.java:76)
 ~[dubbo-3.3.3.jar:3.3.3]
        at 
org.apache.dubbo.rpc.protocol.tri.rest.RestHttpMessageCodec.decode(RestHttpMessageCodec.java:87)
 ~[dubbo-3.3.3.jar:3.3.3]
        at 
org.apache.dubbo.remoting.http12.message.HttpMessageDecoder.decode(HttpMessageDecoder.java:56)
 ~[dubbo-3.3.3.jar:3.3.3]
        at 
org.apache.dubbo.remoting.http12.message.DefaultListeningDecoder.decode(DefaultListeningDecoder.java:41)
 ~[dubbo-3.3.3.jar:3.3.3]
        at 
org.apache.dubbo.rpc.protocol.tri.h12.DefaultHttpMessageListener.onMessage(DefaultHttpMessageListener.java:39)
 ~[dubbo-3.3.3.jar:3.3.3]
        at 
org.apache.dubbo.rpc.protocol.tri.h12.AbstractServerTransportListener.doOnData(AbstractServerTransportListener.java:183)
 ~[dubbo-3.3.3.jar:3.3.3]
        at 
org.apache.dubbo.rpc.protocol.tri.h12.AbstractServerTransportListener.lambda$onData$1(AbstractServerTransportListener.java:168)
 ~[dubbo-3.3.3.jar:3.3.3]
        at 
org.apache.dubbo.common.threadpool.serial.SerializingExecutor.run(SerializingExecutor.java:105)
 ~[dubbo-3.3.3.jar:3.3.3]
        at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
 ~[na:na]
        at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
 ~[na:na]
        at 
org.apache.dubbo.common.threadlocal.InternalRunnable.run(InternalRunnable.java:39)
 ~[dubbo-3.3.3.jar:3.3.3]
        at java.base/java.lang.Thread.run(Thread.java:840) ~[na:na]
   `
   
   ### What you expected to happen
   
   I suggest throw `java.lang.NoClassDefFoundError: 
com/google/protobuf/util/JsonFormat`, not ignore DecodeException
   `                try {
                       Object body = RequestUtils.decodeBody(request, 
meta.genericType());
                       if (body != null) {
                           if (body != RequestUtils.EMPTY_BODY) {
                               return body;
                           }
                           Object value = single ? 
request.parameter(meta.name()) : request.parameterValues(meta.name());
                           return value == null ? body : value;
                       }
                   } catch (DecodeException ignored) {
                      //TODO how about throw DecodeException
                   }`
   
   <!-- Failed to upload "image.png" -->
   
   ### 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