java.util.NoSuchElementException 我就是我 2021-06-24 14:36 413阅读 0赞 使用thrift rpc做开发,今天突然遇到一个问题: Exception in thread "main" java.util.NoSuchElementException: Could not create a validated object, cause: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple; at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1233) at cn.edu.nuc.thriftRpcTest.ThriftServiceClientProxyFactory$2.invoke(ThriftServiceClientProxyFactory.java:87) at com.sun.proxy.$Proxy5.echo(Unknown Source) at rpc.client.ClientService.test(ClientService.java:13) at rpc.client.Client.main(Client.java:20) 服务器启动正常,客户端调用的时候始终报上面的错。开始以为thrift相关的问题,以及common-pool的问题。。。最后,终于发现是slf4j的jar包冲突问题,解决方法: 在libthrift的引用中把slf4j-api去掉,因为这个版本太低了(1.5) <dependency> <groupId>org.apache.thrift</groupId> <artifactId>libthrift</artifactId> <version>0.9.2</version> <exclusions> <exclusion> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </exclusion> </exclusions> </dependency>
还没有评论,来说两句吧...