Apache XML-RPC Client Classes

本文介绍了Apache XML-RPC客户端的基本配置和使用方法,包括客户端配置选项如ClientConfig、TransportFactory等,并提供了使用不同传输工厂类进行通信的示例。

The XmlRpcClient

在介绍XML-RPC服务端前,你需要实现一个Apache XML-RPC客户端(XmlRpcClient)。

Apache XML-RPC客户端是一个无状态的,线程安全的对象。客户端配置选项如下:

名称

描述

ClientConfig

这个对象是XmlRpcClientConfig的实现,用于配置客户端属性,包含服务端URL,证书,字符集等。

TransportFactory

TransportFactory将返回一个含有ClinetConfig客户端对象。

XmlWriterFactory

用于生成XmlWriter ,XmlWriter是一个创建XML的类。通常不需要注意这个对象,因为默认配置已经足够好了。但是,当你需要一个特殊的XML语法时,就需要它了。

接着让我们看一下第一个例子:

import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;

XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL("http://127.0.0.1:8080/xmlrpc"));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
Object[] params = new Object[]{new Integer(33), new Integer(9)};
Integer result = (Integer) client.execute("Calculator.add", params);

就是说,我们通过传递参数2和参数3来调用远程方法Calculator.add

传输工厂类(Transport Factory)

上面的例子是使用java.net.URLConnection与服务端通信。那么当你想使用Jakarta HTTP Client时呢?你只要添加一行代码就可实现:

import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory;

XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL("http://127.0.0.1:8080/XmlRpcServlet"));
XmlRpcClient client = new XmlRpcClient();
client.setTransportFactory(new XmlRpcCommonsTransportFactory(client));
client.setConfig(config);
Object[] params = new Object[]{new Integer(2), new Integer(3)};
Integer result = (Integer) client.execute("Calculator.add", params);

也就是说,传输工厂决定客户端与服务端的通信方式。主要的传输工厂类:

名称

描述

XmlRpcSunHttpTransportFactory

这是默认传输工厂,使用java.net.HttpURLConnection连接HTTP服务端。

XmlRpcCommonsTransportFactory

另一个HTTP传输工厂,它使用Jakarta Commons HttpClient。主要的优点是允许直接访问返回文档,对内存消耗更少。

XmlRpcLiteHttpTransportFactory

又一个HTTP传输工厂,它基于自带的轻量级HTTP客户端。它可能是最快的传输工厂,但它不支持HTTP/1.1,即不支持长连接。

XmlRpcLocalTransportFactory

这个是本地传输工厂,含有一个XML-RPC服务端,它直接通过Java调用。用于调试和开发。

客户端配置(Client Configuration)

传输工厂类使用客户端配置。不同的传输工厂类拥有不同的客户端配置类型:

  • Http传输工厂需要实现org.apache.xmlrpc.client.XmlRpcHttpClientConfig。
  • local传输工厂需要实现org.apache.xmlrpc.client.XmlRpcLocalClientConfig.

简便起见,你可以使用org.apache.xmlrpc.client.XmlRpcClientConfigImpl,你可以使用,它实现了两种接口。

下面让我们看看HTTP客户端可接受的配置属性:

属性名

描述

basicUserName

basicPassword

如果HTTP server需要身份验证,这就是设置用户名和密码的属性。

basicEncoding

指定创建base64授权头的encoding,它用于基本身份验证。默认情况下,它被设置成UTF-8。

contentLengthOptional

是否启用更快的更节省内存的流模式,即客户端不设置响应头content-length,将请求直接写入HTTP输出流中。但是XML-RPC规范要求设置content-length响应头。因此只有当EnabledForExtensions属性被启用后,流模式才可用。

enabledForExceptions

客户端是否接受服务端返回异常的序列化对象。如果服务端返回,客户端将反序列化异常,然后抛出,就像捕获客户端代码的异常一样。

enabledForExtensions

是否启用Apache对XML-RPC规范的扩展。默认情况下,Apache XML-RPC严格兼容XML-RPC规范。不幸的是,这个规范具有严重的局限性。例如,它要求必须有content-length响应头。这样就强制XML-RPC请求和响应在发送前必须存储在字节数组中。扩展版包括快速的和节省内存的流模式(通过取消设置响应头content-length),压缩请求和响应。尤其是,传输longs,shorts,bytes,floats,DOM nodes,java.io.Serializable,或者JAXB等数据类型时。

encoding
设置编码,用于创建XML-RPC请求。默认字符编码是UTF-8。通常encoding也常用于基本身份验证。你可以使用basicEncoding属性指定不同的编码用于证书。
gzipCompressing
是否压缩XML-RPC请求。压缩请求违反XML-RPC规范,因此只有当启用enableForExtension后,gzipCompressing才可用。
gzipRequesting
请求服务端压缩响应。压缩响应违反XML-RPC规范,因此只有当启用enableForExtension后,gzipRequesting才可用。另外,不要以为,服务端一定会压缩的响应,除非它是一个Apache XML-RPC 3的服务端。

还有一个设置local transport factory的属性

xmlRpcServer

这是嵌入的XML-RPC服务端,调用它执行客户端请求。显然拥有极快的传输速度。它主要用于调试和开发。

转载于:https://my.oschina.net/wangconglin87/blog/56765

D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\bin\java.exe "-javaagent:D:\Program Files\JetBrains\IntelliJ IDEA 2024.3.6\lib\idea_rt.jar=59333" -Dfile.encoding=UTF-8 -classpath "D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\charsets.jar;D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\ext\access-bridge-64.jar;D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\ext\cldrdata.jar;D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\ext\dnsns.jar;D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\ext\jaccess.jar;D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\ext\jfxrt.jar;D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\ext\localedata.jar;D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\ext\nashorn.jar;D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\ext\sunec.jar;D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\ext\sunjce_provider.jar;D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\ext\sunmscapi.jar;D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\ext\sunpkcs11.jar;D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\ext\zipfs.jar;D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\jce.jar;D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\jfr.jar;D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\jfxswt.jar;D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\jsse.jar;D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\management-agent.jar;D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\resources.jar;D:\java\openlogic-openjdk-8u362-b09-windows-64\openlogic-openjdk-8u362-b09-windows-64\jre\lib\rt.jar;F:\lee\work\basic-spring-boot\target\classes;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\boot\spring-boot-starter-validation\2.7.18\spring-boot-starter-validation-2.7.18.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\boot\spring-boot-starter\2.7.18\spring-boot-starter-2.7.18.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\boot\spring-boot\2.7.18\spring-boot-2.7.18.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\boot\spring-boot-autoconfigure\2.7.18\spring-boot-autoconfigure-2.7.18.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\boot\spring-boot-starter-logging\2.7.18\spring-boot-starter-logging-2.7.18.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\ch\qos\logback\logback-classic\1.2.12\logback-classic-1.2.12.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\ch\qos\logback\logback-core\1.2.12\logback-core-1.2.12.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\apache\logging\log4j\log4j-to-slf4j\2.17.2\log4j-to-slf4j-2.17.2.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\apache\logging\log4j\log4j-api\2.17.2\log4j-api-2.17.2.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\slf4j\jul-to-slf4j\1.7.36\jul-to-slf4j-1.7.36.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\yaml\snakeyaml\1.30\snakeyaml-1.30.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.83\tomcat-embed-el-9.0.83.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\hibernate\validator\hibernate-validator\6.2.5.Final\hibernate-validator-6.2.5.Final.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\jakarta\validation\jakarta.validation-api\2.0.2\jakarta.validation-api-2.0.2.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\jboss\logging\jboss-logging\3.4.3.Final\jboss-logging-3.4.3.Final.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\boot\spring-boot-starter-web\2.7.18\spring-boot-starter-web-2.7.18.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\boot\spring-boot-starter-json\2.7.18\spring-boot-starter-json-2.7.18.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.13.5\jackson-datatype-jdk8-2.13.5.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.13.5\jackson-datatype-jsr310-2.13.5.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.13.5\jackson-module-parameter-names-2.13.5.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\boot\spring-boot-starter-tomcat\2.7.18\spring-boot-starter-tomcat-2.7.18.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.83\tomcat-embed-core-9.0.83.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.83\tomcat-embed-websocket-9.0.83.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\spring-web\5.3.31\spring-web-5.3.31.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\spring-beans\5.3.31\spring-beans-5.3.31.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\spring-webmvc\5.3.31\spring-webmvc-5.3.31.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\spring-context\5.3.31\spring-context-5.3.31.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\spring-expression\5.3.31\spring-expression-5.3.31.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\boot\spring-boot-starter-aop\2.7.18\spring-boot-starter-aop-2.7.18.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\spring-aop\5.3.31\spring-aop-5.3.31.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\aspectj\aspectjweaver\1.9.7\aspectjweaver-1.9.7.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\projectlombok\lombok\1.18.30\lombok-1.18.30.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\jakarta\xml\bind\jakarta.xml.bind-api\2.3.3\jakarta.xml.bind-api-2.3.3.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\jakarta\activation\jakarta.activation-api\1.2.2\jakarta.activation-api-1.2.2.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\net\bytebuddy\byte-buddy\1.12.23\byte-buddy-1.12.23.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\spring-core\5.3.31\spring-core-5.3.31.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\spring-jcl\5.3.31\spring-jcl-5.3.31.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\boot\spring-boot-starter-data-jpa\2.7.18\spring-boot-starter-data-jpa-2.7.18.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\boot\spring-boot-starter-jdbc\2.7.18\spring-boot-starter-jdbc-2.7.18.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\zaxxer\HikariCP\4.0.3\HikariCP-4.0.3.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\spring-jdbc\5.3.31\spring-jdbc-5.3.31.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\jakarta\transaction\jakarta.transaction-api\1.3.3\jakarta.transaction-api-1.3.3.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\jakarta\persistence\jakarta.persistence-api\2.2.3\jakarta.persistence-api-2.2.3.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\hibernate\hibernate-core\5.6.15.Final\hibernate-core-5.6.15.Final.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\jboss\jandex\2.4.2.Final\jandex-2.4.2.Final.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\hibernate\common\hibernate-commons-annotations\5.1.2.Final\hibernate-commons-annotations-5.1.2.Final.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\glassfish\jaxb\jaxb-runtime\2.3.9\jaxb-runtime-2.3.9.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\glassfish\jaxb\txw2\2.3.9\txw2-2.3.9.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\sun\istack\istack-commons-runtime\3.0.12\istack-commons-runtime-3.0.12.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\sun\activation\jakarta.activation\1.2.2\jakarta.activation-1.2.2.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\data\spring-data-jpa\2.7.18\spring-data-jpa-2.7.18.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\data\spring-data-commons\2.7.18\spring-data-commons-2.7.18.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\spring-orm\5.3.31\spring-orm-5.3.31.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\spring-tx\5.3.31\spring-tx-5.3.31.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\spring-aspects\5.3.31\spring-aspects-5.3.31.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\mysql\mysql-connector-j\8.0.33\mysql-connector-j-8.0.33.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\boot\spring-boot-starter-actuator\2.7.18\spring-boot-starter-actuator-2.7.18.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\boot\spring-boot-actuator-autoconfigure\2.7.18\spring-boot-actuator-autoconfigure-2.7.18.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\springframework\boot\spring-boot-actuator\2.7.18\spring-boot-actuator-2.7.18.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\micrometer\micrometer-core\1.11.5\micrometer-core-1.11.5.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\micrometer\micrometer-commons\1.11.5\micrometer-commons-1.11.5.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\micrometer\micrometer-observation\1.11.5\micrometer-observation-1.11.5.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\hdrhistogram\HdrHistogram\2.1.12\HdrHistogram-2.1.12.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\latencyutils\LatencyUtils\2.0.3\LatencyUtils-2.0.3.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\micrometer\micrometer-registry-prometheus\1.11.5\micrometer-registry-prometheus-1.11.5.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\prometheus\simpleclient_common\0.15.0\simpleclient_common-0.15.0.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\prometheus\simpleclient\0.15.0\simpleclient-0.15.0.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\prometheus\simpleclient_tracer_otel\0.15.0\simpleclient_tracer_otel-0.15.0.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\prometheus\simpleclient_tracer_common\0.15.0\simpleclient_tracer_common-0.15.0.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\prometheus\simpleclient_tracer_otel_agent\0.15.0\simpleclient_tracer_otel_agent-0.15.0.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\jsonwebtoken\jjwt-api\0.11.5\jjwt-api-0.11.5.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\jsonwebtoken\jjwt-impl\0.11.5\jjwt-impl-0.11.5.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\jsonwebtoken\jjwt-jackson\0.11.5\jjwt-jackson-0.11.5.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\fasterxml\jackson\core\jackson-databind\2.13.5\jackson-databind-2.13.5.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\fasterxml\jackson\core\jackson-annotations\2.13.5\jackson-annotations-2.13.5.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\fasterxml\jackson\core\jackson-core\2.13.5\jackson-core-2.13.5.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\grpc\grpc-netty-shaded\1.56.1\grpc-netty-shaded-1.56.1.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\google\guava\guava\31.1-android\guava-31.1-android.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\checkerframework\checker-qual\3.12.0\checker-qual-3.12.0.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\google\j2objc\j2objc-annotations\1.3\j2objc-annotations-1.3.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\google\errorprone\error_prone_annotations\2.18.0\error_prone_annotations-2.18.0.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\perfmark\perfmark-api\0.26.0\perfmark-api-0.26.0.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\grpc\grpc-protobuf\1.56.1\grpc-protobuf-1.56.1.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\google\api\grpc\proto-google-common-protos\2.17.0\proto-google-common-protos-2.17.0.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\grpc\grpc-protobuf-lite\1.56.1\grpc-protobuf-lite-1.56.1.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\grpc\grpc-stub\1.56.1\grpc-stub-1.56.1.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\google\protobuf\protobuf-java\3.23.4\protobuf-java-3.23.4.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\net\devh\grpc-spring-boot-starter\2.14.0.RELEASE\grpc-spring-boot-starter-2.14.0.RELEASE.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\net\devh\grpc-server-spring-boot-starter\2.14.0.RELEASE\grpc-server-spring-boot-starter-2.14.0.RELEASE.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\net\devh\grpc-server-spring-boot-autoconfigure\2.14.0.RELEASE\grpc-server-spring-boot-autoconfigure-2.14.0.RELEASE.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\net\devh\grpc-common-spring-boot\2.14.0.RELEASE\grpc-common-spring-boot-2.14.0.RELEASE.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\grpc\grpc-core\1.51.0\grpc-core-1.51.0.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\google\code\gson\gson\2.9.1\gson-2.9.1.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\google\android\annotations\4.1.1.4\annotations-4.1.1.4.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\org\codehaus\mojo\animal-sniffer-annotations\1.21\animal-sniffer-annotations-1.21.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\grpc\grpc-services\1.51.0\grpc-services-1.51.0.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\com\google\protobuf\protobuf-java-util\3.21.7\protobuf-java-util-3.21.7.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\grpc\grpc-api\1.51.0\grpc-api-1.51.0.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\io\grpc\grpc-context\1.51.0\grpc-context-1.51.0.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\net\devh\grpc-client-spring-boot-starter\2.14.0.RELEASE\grpc-client-spring-boot-starter-2.14.0.RELEASE.jar;D:\Program Files\apache-maven-3.9.11-bin\apache-maven-3.9.11\repository\net\devh\grpc-client-spring-boot-autoconfigure\2.14.0.RELEASE\grpc-client-spring-boot-autoconfigure-2.14.0.RELEASE.jar" com.tplink.nbu.demo.basicspringboot.grpc.client.UserGrpcClient 17:36:26.508 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework 17:36:26.512 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - -Dio.netty.noUnsafe: false 17:36:26.513 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - Java version: 8 17:36:26.514 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available 17:36:26.514 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available 17:36:26.514 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.storeFence: available 17:36:26.514 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available 17:36:26.515 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - direct buffer constructor: available 17:36:26.515 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: available, true 17:36:26.515 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable prior to Java9 17:36:26.515 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - java.nio.DirectByteBuffer.<init>(long, int): available 17:36:26.515 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent - sun.misc.Unsafe: available 17:36:26.515 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent - -Dio.netty.tmpdir: C:\Users\admin\AppData\Local\Temp (java.io.tmpdir) 17:36:26.515 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model) 17:36:26.516 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent - Platform: Windows 17:36:26.517 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent - -Dio.netty.maxDirectMemory: 7559184384 bytes 17:36:26.517 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent - -Dio.netty.uninitializedArrayAllocationThreshold: -1 17:36:26.517 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.CleanerJava6 - java.nio.ByteBuffer.cleaner(): available 17:36:26.517 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false 17:36:26.673 [main] DEBUG io.grpc.netty.shaded.io.netty.channel.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 48 17:36:26.681 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.InternalThreadLocalMap - -Dio.netty.threadLocalMap.stringBuilder.initialSize: 1024 17:36:26.681 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.InternalThreadLocalMap - -Dio.netty.threadLocalMap.stringBuilder.maxSize: 4096 17:36:26.685 [main] DEBUG io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false 17:36:26.685 [main] DEBUG io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512 17:36:26.689 [main] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent - org.jctools-core.MpscChunkedArrayQueue: available 17:36:26.893 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.util.ResourceLeakDetector - -Dio.grpc.netty.shaded.io.netty.leakDetection.level: simple 17:36:26.893 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.util.ResourceLeakDetector - -Dio.grpc.netty.shaded.io.netty.leakDetection.targetRecords: 4 17:36:26.896 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.buffer.AbstractByteBuf - -Dio.grpc.netty.shaded.io.netty.buffer.checkAccessible: true 17:36:26.896 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.buffer.AbstractByteBuf - -Dio.grpc.netty.shaded.io.netty.buffer.checkBounds: true 17:36:26.897 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.util.ResourceLeakDetectorFactory - Loaded default ResourceLeakDetector: io.grpc.netty.shaded.io.netty.util.ResourceLeakDetector@ea8c675 17:36:26.925 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numHeapArenas: 48 17:36:26.926 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numDirectArenas: 48 17:36:26.926 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.pageSize: 8192 17:36:26.926 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxOrder: 9 17:36:26.926 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.chunkSize: 4194304 17:36:26.926 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.smallCacheSize: 256 17:36:26.926 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.normalCacheSize: 64 17:36:26.926 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedBufferCapacity: 32768 17:36:26.926 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimInterval: 8192 17:36:26.926 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimIntervalMillis: 0 17:36:26.926 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.useCacheForAllThreads: false 17:36:26.926 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedByteBuffersPerChunk: 1023 17:36:26.936 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.channel.DefaultChannelId - -Dio.netty.processId: 28684 (auto-detected) 17:36:26.937 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.util.NetUtil - -Djava.net.preferIPv4Stack: false 17:36:26.937 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.util.NetUtil - -Djava.net.preferIPv6Addresses: false 17:36:27.010 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.util.NetUtilInitializations - Loopback interface: lo (Software Loopback Interface 1, 127.0.0.1) 17:36:27.011 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.util.NetUtil - Failed to get SOMAXCONN from sysctl and file \proc\sys\net\core\somaxconn. Default: 200 17:36:27.015 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.channel.DefaultChannelId - -Dio.netty.machineId: 10:b6:76:ff:fe:57:72:cf (auto-detected) 17:36:27.031 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: pooled 17:36:27.031 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.buffer.ByteBufUtil - -Dio.netty.threadLocalDirectBufferSize: 0 17:36:27.031 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.buffer.ByteBufUtil - -Dio.netty.maxThreadLocalCharBufferSize: 16384 17:36:27.041 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.util.Recycler - -Dio.netty.recycler.maxCapacityPerThread: 4096 17:36:27.041 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.util.Recycler - -Dio.netty.recycler.ratio: 8 17:36:27.041 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.util.Recycler - -Dio.netty.recycler.chunkSize: 32 17:36:27.041 [grpc-default-executor-0] DEBUG io.grpc.netty.shaded.io.netty.util.Recycler - -Dio.netty.recycler.blocking: false 17:36:27.053 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0xbee5fc34, L:/127.0.0.1:59389 - R:localhost/127.0.0.1:8099] OUTBOUND SETTINGS: ack=false settings={ENABLE_PUSH=0, MAX_CONCURRENT_STREAMS=0, INITIAL_WINDOW_SIZE=1048576, MAX_HEADER_LIST_SIZE=8192} 17:36:27.058 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0xbee5fc34, L:/127.0.0.1:59389 - R:localhost/127.0.0.1:8099] OUTBOUND WINDOW_UPDATE: streamId=0 windowSizeIncrement=983041 17:36:27.102 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0xbee5fc34, L:/127.0.0.1:59389 - R:localhost/127.0.0.1:8099] INBOUND SETTINGS: ack=false settings={MAX_CONCURRENT_STREAMS=2147483647, INITIAL_WINDOW_SIZE=1048576, MAX_HEADER_LIST_SIZE=8192} 17:36:27.102 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0xbee5fc34, L:/127.0.0.1:59389 - R:localhost/127.0.0.1:8099] OUTBOUND SETTINGS: ack=true 17:36:27.111 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0xbee5fc34, L:/127.0.0.1:59389 - R:localhost/127.0.0.1:8099] INBOUND WINDOW_UPDATE: streamId=0 windowSizeIncrement=983041 17:36:27.112 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0xbee5fc34, L:/127.0.0.1:59389 - R:localhost/127.0.0.1:8099] INBOUND SETTINGS: ack=true 17:36:27.118 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0xbee5fc34, L:/127.0.0.1:59389 - R:localhost/127.0.0.1:8099] OUTBOUND HEADERS: streamId=3 headers=GrpcHttp2OutboundHeaders[:authority: localhost:8099, :path: /user.UserService/Login, :method: POST, :scheme: http, content-type: application/grpc, te: trailers, user-agent: grpc-java-netty/1.51.0, grpc-accept-encoding: gzip] streamDependency=0 weight=16 exclusive=false padding=0 endStream=false 17:36:27.125 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0xbee5fc34, L:/127.0.0.1:59389 - R:localhost/127.0.0.1:8099] OUTBOUND DATA: streamId=3 padding=0 endStream=true length=61 bytes=00000000380a367b22757365726e616d65223a2274657374406578616d706c652e636f6d222c2270617373776f7264223a22736563757265313233227d 17:36:27.152 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0xbee5fc34, L:/127.0.0.1:59389 - R:localhost/127.0.0.1:8099] INBOUND PING: ack=false bytes=1234 17:36:27.152 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0xbee5fc34, L:/127.0.0.1:59389 - R:localhost/127.0.0.1:8099] OUTBOUND PING: ack=true bytes=1234 17:36:27.250 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0xbee5fc34, L:/127.0.0.1:59389 - R:localhost/127.0.0.1:8099] INBOUND HEADERS: streamId=3 headers=GrpcHttp2ResponseHeaders[:status: 200, content-type: application/grpc, grpc-status: 9, grpc-message: User not found] padding=0 endStream=true 17:36:27.254 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0xbee5fc34, L:/127.0.0.1:59389 - R:localhost/127.0.0.1:8099] OUTBOUND HEADERS: streamId=5 headers=GrpcHttp2OutboundHeaders[:authority: localhost:8099, :path: /user.UserService/Logout, :method: POST, :scheme: http, content-type: application/grpc, te: trailers, user-agent: grpc-java-netty/1.51.0, grpc-accept-encoding: gzip] streamDependency=0 weight=16 exclusive=false padding=0 endStream=false 17:36:27.254 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0xbee5fc34, L:/127.0.0.1:59389 - R:localhost/127.0.0.1:8099] OUTBOUND DATA: streamId=5 padding=0 endStream=true length=26 bytes=00000000150a137b22757365726e616d65223a2274657374227d 17:36:27.257 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0xbee5fc34, L:/127.0.0.1:59389 - R:localhost/127.0.0.1:8099] INBOUND HEADERS: streamId=5 headers=GrpcHttp2ResponseHeaders[:status: 200, content-type: application/grpc, grpc-encoding: identity, grpc-accept-encoding: gzip] padding=0 endStream=false 17:36:27.261 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0xbee5fc34, L:/127.0.0.1:59389 - R:localhost/127.0.0.1:8099] INBOUND DATA: streamId=5 padding=0 endStream=false length=46 bytes=00000000290a277b22636f6465223a3230302c226d657373616765223a224c6f676f75742073756363657373227d 17:36:27.261 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0xbee5fc34, L:/127.0.0.1:59389 - R:localhost/127.0.0.1:8099] OUTBOUND PING: ack=false bytes=1234 17:36:27.262 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0xbee5fc34, L:/127.0.0.1:59389 - R:localhost/127.0.0.1:8099] INBOUND HEADERS: streamId=5 headers=GrpcHttp2ResponseHeaders[grpc-status: 0] padding=0 endStream=true 17:36:27.263 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0xbee5fc34, L:/127.0.0.1:59389 - R:localhost/127.0.0.1:8099] INBOUND PING: ack=true bytes=1234 Logout Response: {"code":200,"message":"Logout success"} 17:36:27.266 [grpc-nio-worker-ELG-1-2] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler - [id: 0xbee5fc34, L:/127.0.0.1:59389 - R:localhost/127.0.0.1:8099] OUTBOUND GO_AWAY: lastStreamId=0 errorCode=0 length=0 bytes= RPC failed: Status{code=FAILED_PRECONDITION, description=User not found, cause=null}
08-27
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值