«Недопустимое исключение времени выполнения, возникающее при обработке delivery_sm», получающее ошибку при вызове метода внутри onAcceptDeliverSm () в jsmpp - PullRequest
0 голосов
/ 04 мая 2020

Я пишу SMPP-слушатель из Spring boot и использую jsmpp в качестве библиотеки SMPP. Я получаю сообщение и авторизируюсь в содержимом сообщения в delivery_sm. Но я не могу вызвать метод при получении delivery_sm и получении исключения. В чем может быть проблема?

Код слушателя:

public class MessageReceiverListenerImpl implements MessageReceiverListener {

    @Autowired
    private MessageSender messageSender;


    @Override
    public void onAcceptDeliverSm(DeliverSm deliverSm) {

        String destinationAddress = deliverSm.getDestAddress();
        String sourceAddress = deliverSm.getSourceAddr();
        int sequenceNumber = deliverSm.getSequenceNumber();

        if (deliverSm.isSmscDeliveryReceipt()){
            try {
                DeliveryReceipt deliveryReceipt = deliverSm.getShortMessageAsDeliveryReceipt();
                int getDelivered = deliveryReceipt.getDelivered();
                Date getDoneDate = deliveryReceipt.getDoneDate();
                String getError = deliveryReceipt.getError();
                DeliveryReceiptState deliveryReceiptState = deliveryReceipt.getFinalStatus();
                int deliveryStateValue = deliveryReceiptState.value();
                String getId = deliveryReceipt.getId();
                Date getSubmitDate = deliveryReceipt.getSubmitDate();
                int getSubmit = deliveryReceipt.getSubmitted();
                String getText = deliveryReceipt.getText();

                logger.info("3,{},destinationAddress: {},sourceAddress: {},sequenceNumber: {},getDelivered: {},getDoneDate : {}," +
                        "getError: {},deliveryStateValue: {},getId: {},getSubmitDate: {},getSubmit: {},getText: {}", dtf.format(LocalDateTime.now()),
                        destinationAddress,sourceAddress,sequenceNumber,getDelivered,getDoneDate,getError,deliveryStateValue,getId,getSubmitDate,
                        getSubmit,getText);
            } catch (InvalidDeliveryReceiptException e) {
                logger.error(e.getMessage());
            }
        }else {
            int dataCoding = deliverSm.getDataCoding();
            String message = new String(deliverSm.getShortMessage(), StandardCharsets.US_ASCII);
            logger.info("5,{},sourceAddr: {},destAddr: {},message: {},sequnceNumber: {}",dtf.format(LocalDateTime.now()),sourceAddress,
                    destinationAddress,message,sequenceNumber);

            messageSender.sendTextMessage(destinationAddress,sourceAddress,"Thank you! Message received");


        }

    }
}

Вызов метода при получении delivery_sm

@Async("asyncExecutor")
    public void sendTextMessage(String source, String destination, String message){
        LocalDateTime now = LocalDateTime.now();
        try {
            String status = accessBase.getSession().submitShortMessage(null, TypeOfNumber.ALPHANUMERIC, NumberingPlanIndicator.UNKNOWN,
                    source, TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, destination, new ESMClass(), (byte) 0,
                    (byte) 0, null, null, new RegisteredDelivery(SMSCDeliveryReceipt.DEFAULT),
                    (byte) 0, new GeneralDataCoding(), (byte) 0, message.getBytes());

            logger.info("5,{},{},{},{},{},{}",dtf.format(now),source,destination,status,message.replaceAll("\\n"," "),"");
        } catch (PDUException | ResponseTimeoutException | InvalidResponseException | NegativeResponseException | IOException e) {
            logger.error(e.getMessage());
        }
    }

Ошибка при получении

May  4 17:50:52 ip-10-1-0-29 wap-push: 2020-05-04 17:50:52.747  INFO 19137 --- [pool-2-thread-3] l.a.w.u.MessageReceiverListenerImpl      : 5,2020/05/04 17:50:52,sourceAddr: 94xxxxxxxx,destAddr: 94xxxxxxxxx,message: Test message ,sequnceNumber: 28386
May  4 17:50:52 ip-10-1-0-29 wap-push: 2020-05-04 17:50:52.751 ERROR 19137 --- [pool-2-thread-3] org.jsmpp.session.SMPPSession            : Invalid runtime exception thrown when processing deliver_sm
May  4 17:50:52 ip-10-1-0-29 wap-push: java.lang.NullPointerException: null
May  4 17:50:52 ip-10-1-0-29 wap-push: at lk.adeona.wappush.utilities.MessageReceiverListenerImpl.onAcceptDeliverSm(MessageReceiverListenerImpl.java:98) ~[classes!/:0.0.1-SNAPSHOT]
May  4 17:50:52 ip-10-1-0-29 wap-push: at org.jsmpp.session.SMPPSession.fireAcceptDeliverSm(SMPPSession.java:461) ~[jsmpp-2.3.7.jar!/:2.3.7]
May  4 17:50:52 ip-10-1-0-29 wap-push: at org.jsmpp.session.SMPPSession.access$300(SMPPSession.java:94) ~[jsmpp-2.3.7.jar!/:2.3.7]
May  4 17:50:52 ip-10-1-0-29 wap-push: at org.jsmpp.session.SMPPSession$ResponseHandlerImpl.processDeliverSm(SMPPSession.java:480) ~[jsmpp-2.3.7.jar!/:2.3.7]
May  4 17:50:52 ip-10-1-0-29 wap-push: at org.jsmpp.session.state.SMPPSessionBoundRX.processDeliverSm0(SMPPSessionBoundRX.java:109) [jsmpp-2.3.7.jar!/:2.3.7]
May  4 17:50:52 ip-10-1-0-29 wap-push: at org.jsmpp.session.state.SMPPSessionBoundTRX.processDeliverSm(SMPPSessionBoundTRX.java:42) [jsmpp-2.3.7.jar!/:2.3.7]
May  4 17:50:52 ip-10-1-0-29 wap-push: at org.jsmpp.session.PDUProcessTask.run(PDUProcessTask.java:91) [jsmpp-2.3.7.jar!/:2.3.7]
May  4 17:50:52 ip-10-1-0-29 wap-push: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_242]
May  4 17:50:52 ip-10-1-0-29 wap-push: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_242]
May  4 17:50:52 ip-10-1-0-29 wap-push: at java.lang.Thread.run(Thread.java:748) [na:1.8.0_242]
May  4 17:50:52 ip-10-1-0-29 wap-push: 2020-05-04 17:50:52.752 ERROR 19137 --- [pool-2-thread-3] o.j.session.state.SMPPSessionBoundRX     : Failed processing deliver_sm
May  4 17:50:52 ip-10-1-0-29 wap-push: org.jsmpp.extra.ProcessRequestException: Invalid runtime exception thrown when processing deliver_sm
May  4 17:50:52 ip-10-1-0-29 wap-push: at org.jsmpp.session.SMPPSession$ResponseHandlerImpl.processDeliverSm(SMPPSession.java:486) ~[jsmpp-2.3.7.jar!/:2.3.7]
May  4 17:50:52 ip-10-1-0-29 wap-push: at org.jsmpp.session.state.SMPPSessionBoundRX.processDeliverSm0(SMPPSessionBoundRX.java:109) ~[jsmpp-2.3.7.jar!/:2.3.7]
May  4 17:50:52 ip-10-1-0-29 wap-push: at org.jsmpp.session.state.SMPPSessionBoundTRX.processDeliverSm(SMPPSessionBoundTRX.java:42) [jsmpp-2.3.7.jar!/:2.3.7]
May  4 17:50:52 ip-10-1-0-29 wap-push: at org.jsmpp.session.PDUProcessTask.run(PDUProcessTask.java:91) [jsmpp-2.3.7.jar!/:2.3.7]
May  4 17:50:52 ip-10-1-0-29 wap-push: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_242]
May  4 17:50:52 ip-10-1-0-29 wap-push: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_242]
May  4 17:50:52 ip-10-1-0-29 wap-push: at java.lang.Thread.run(Thread.java:748) [na:1.8.0_242]
...