5

次のコードを使用して、ISO8583 要求を端末に送信しようとしています。

try {
        XMLParser packager = new XMLParser(this.xmlFile);


        final ISOMsg isoMsg = new ISOMsg();
        isoMsg.setPackager(packager);
        isoMsg.setMTI("0800");
        isoMsg.set(3, "xxxxxx");
        isoMsg.set(7, "xxxxxxxxxx");    //MMDDhhmmss
        isoMsg.set(11, "xxxxxx");
        isoMsg.set(12, "084500");       //Time of the message HHmmss
        isoMsg.set(13, "0621");         //Date MMDD
        isoMsg.set(41, "xxxxxxxx");
        isoMsg.set(62,"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
        isoMsg.set(63,"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
        BaseChannel channel = new BaseChannel() {};
        channel.setLogger(logger, "server-request-channel");
        channel.setHeader(isoMsg.pack());
        channel.setHost("xx.xx.xx.xx", xxxxx);
        ISOMUX isoMux = new ISOMUX(channel) {
            @Override
            protected String getKey(ISOMsg m) throws ISOException {
                return super.getKey(m);
            }
        };

        isoMux.setLogger(logger, "server-request-mux");
        new Thread(isoMux).start();
        ISORequest req = new ISORequest(isoMsg);
        isoMux.queue(req);
        req.setLogger(logger, "server-request-logger");
        ISOMsg response = req.getResponse(50 * 1000);

        if (response != null) {
                System.out.println("Req ["+ new String(isoMsg.pack()) + "]");
                System.out.println("Res ["+ new String(response.pack()) + "]");
            }else{
                System.out.println("Timeout");
            }
        }catch (Exception e) {
            e.printStackTrace();
        }
    }

コードを実行した後、次の例外が発生します。

<log realm="server-request-mux" at="Fri Aug 14 00:26:43 WAT 2015.995">
    <muxreceiver>
        <exception name="null">
            java.lang.NullPointerException
            at org.jpos.iso.BaseChannel.createISOMsg(BaseChannel.java:561)
            at org.jpos.iso.BaseChannel.createMsg(BaseChannel.java:558)
            at org.jpos.iso.BaseChannel.receive(BaseChannel.java:585)
            at org.jpos.iso.ISOMUX$Receiver.run(ISOMUX.java:263)
            at java.lang.Thread.run(Thread.java:856)
        </exception>
    </muxreceiver>
</log>

例外の原因となっている行を見つけるためにブレークポイントを追加したところ、次のステートメントに遭遇するたびに例外が発生することがわかりました。

ISORequest req = new ISORequest(isoMsg);

私は ISO8583 jpos 金融プログラミングに比較的慣れておらず、Android プラットフォームでアプリを構築したいと考えています。

この例外を克服するにはどうすればよいですか?

4

1 に答える 1