Open tqknight1984 opened 8 years ago
在线等!!
@tqknight1984 thrift版本是多少呢? 我暂时没有在jdk1.8中测试过 我公司内的jdk环境为1.7
<!-- rpc https://mvnrepository.com/artifact/org.apache.thrift/libthrift -->
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
<version>0.9.3</version>
</dependency>
我通过单服务正常的: ThriftConnectionPoolConfig config = new ThriftConnectionPoolConfig(); config.setConnectTimeout(3000); config.setThriftProtocol(ThriftConnectionPoolConfig.TProtocolType.BINARY); config.setClientClass(User.Client.class); config.addThriftServer("127.0.0.1", 9818); config.setMaxConnectionPerServer(1); config.setMinConnectionPerServer(1); config.setIdleMaxAge(2, TimeUnit.SECONDS); config.setMaxConnectionAge(2); config.setLazyInit(false); try { ThriftConnectionPool pool = new ThriftConnectionPool(config);
... ...
但是通过多接口服务,
ThriftConnectionPoolConfig config = new ThriftConnectionPoolConfig(ThriftConnectionPoolConfig.ThriftServiceType.MULTIPLEXED_INTERFACE); config.setConnectTimeout(3000); config.setThriftProtocol(ThriftConnectionPoolConfig.TProtocolType.BINARY); config.addThriftServer("127.0.0.1", 9818); config.addThriftClientClass("user", User.Client.class); //config.addThriftClientClass("example", Example.Client.class);
// example service User.Client userClient = connection.getClient("user", User.Client.class); // userClient.ping();
.......
报错,如下:
log4j:WARN No such property [maxBackupIndex] in org.apache.log4j.DailyRollingFileAppender. 2016-09-08 16:52:46 INFO ThriftConnectionPoolConfig:423 - 注册服务客户端:user 2016-09-08 16:52:46 INFO ThriftConnectionPoolConfig:423 - 注册服务客户端:user 2016-09-08 16:52:46 DEBUG MulitServiceThriftConnecion:116 - 创建新连接成功:127.0.0.1 端口:9818 2016-09-08 16:52:46 DEBUG MulitServiceThriftConnecion:116 - 创建新连接成功:127.0.0.1 端口:9818 2016-09-08 16:52:51 DEBUG MulitServiceThriftConnecion:116 - 创建新连接成功:127.0.0.1 端口:9818 org.apache.thrift.TApplicationException: Invalid method name: 'user:regedit_p' at org.apache.thrift.TApplicationException.read(TApplicationException.java:111) at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:79) at net.gx.thrift.User$Client.recv_regedit_p(User.java:141) at net.gx.thrift.User$Client.regedit_p(User.java:125)
编译环境,intellij IDEA 2016.2.3;jdk1.8