客户端调用获取商户提现产品手续费的接口,出现异常org.apache.thrift.TApplicationException: Internal error processing getMerchantFeeVO
接下来,分析服务端的日志:
如下info文件的日志:
可疑的是从db获取CP05产品信息时返回0行。
再看error日志文件,发现了NPE异常:
2019-03-04 09:59:17,660 ERROR [pool-4-thread-20] (ProcessFunction.java:47) - Internal error processing getMerchantFeeVO java.lang.NullPointerException at com.emaxcard.manage.common.cache.RedisUtil.isDistinguishBankCardType(RedisUtil.java:536) ~[manage_module-1.0-SNAPSHOT.jar:?] at com.emaxcard.manage.common.cache.RedisUtil.getRate(RedisUtil.java:440) ~[manage_module-1.0-SNAPSHOT.jar:?] at com.emaxcard.manage.common.cache.RedisUtil.merchantRedis(RedisUtil.java:150) ~[manage_module-1.0-SNAPSHOT.jar:?] at com.emaxcard.manage.rpc.service.impl.MerchantRedisServiceImpl.getMerchantFeeVO(MerchantRedisServiceImpl.java:44) ~[manage_server.jar:?] at com.emaxcard.manage.rpc.service.MerchantRedisService$Processor$getMerchantFeeVO.getResult(MerchantRedisService.java:719) ~[manage_thrift-1.0-SNAPSHOT.jar:?] at com.emaxcard.manage.rpc.service.MerchantRedisService$Processor$getMerchantFeeVO.getResult(MerchantRedisService.java:699) ~[manage_thrift-1.0-SNAPSHOT.jar:?] at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:38) [libthrift-0.11.0.jar:0.11.0] at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39) [libthrift-0.11.0.jar:0.11.0] at org.apache.thrift.TMultiplexedProcessor.process(TMultiplexedProcessor.java:134) [libthrift-0.11.0.jar:0.11.0] at org.apache.thrift.server.AbstractNonblockingServer$FrameBuffer.invoke(AbstractNonblockingServer.java:518) [libthrift-0.11.0.jar:0.11.0] at org.apache.thrift.server.Invocation.run(Invocation.java:18) [libthrift-0.11.0.jar:0.11.0] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_181] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_181] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
如下是堆栈里的isDistinguishBankCardType方法代码,可以看出,product对象是null,后文引用它的属性时,自然出现了NPE。
public boolean isDistinguishBankCardType(String productCode) { //根据产品code获取产品 Product product = productDao.selectByCodeEnable(productCode); if ("DPTPAY".equals(product.getTrxType())) { return false; } else if ("PAYMNT".equals(product.getTrxType())) { if (product.getName().indexOf(com.emaxcard.manage.common.utils.Constants.QUICKPAY2) >= 0 || product.getName().indexOf(com.emaxcard.manage.common.utils.Constants.B2B) >= 0 || product.getName().indexOf(com.emaxcard.manage.common.utils.Constants.QUAGRP) >= 0) { return false; } } return true; }
也就是说,服务端程序处理出现未经捕获的Runtime异常,自然,客户端调用这个RPC接口就抛出了Internal error processing**
又见thrift异常之TApplicationException: Internal error processing..