又見thrift異常之TApplicationException: Internal error processing..

客戶端調用獲取商戶提現產品手續費的接口,出現異常org.apache.thrift.TApplicationException: Internal error processing getMerchantFeeVOjava

 

接下來,分析服務端的日誌:apache

以下info文件的日誌:ui

可疑的是從db獲取CP05產品信息時返回0行。spa

再看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。code

    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**server

相關文章
相關標籤/搜索