1

javaのaxis2-1.6.2にWebサービスクライアントを実装しましたが、最初に呼び出したときに応答があり、その後2回目にエラーが発生しました

java.lang.NullPointerException
 at org.apache.axis2.client.OperationClient.prepareMessageContext(OperationClient.java:293)
        at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:180)
        at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
 at org.apache.axis2.ccws.CustomerCareServiceStub.subscriberRetrieveLite(CustomerCareServiceStub.java:2380)
        at Prepost.SubscriberRetrieveBalance.subscriberRetrieveLite(SubscriberRetrieveBalance.java:111)
        at Prepost.CheckUser.doGet(CheckUser.java:149)

これは、すべてのリクエストで同じ一意のパラメーターを設定する API 実装クラス コンストラクターです。

public SubscriberRetrieveBalance(String url, String strCON_TimeOut, String strSO_TimeOut) {
    try {
        this.url = url;
        stub = new CustomerCareServiceStub(url);
        ServiceClient sClient = stub._getServiceClient();
        Options options = sClient.getOptions();
        options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Constants.VALUE_TRUE);
        options.setProperty(AddressingConstants.WS_ADDRESSING_VERSION, AddressingConstants.Submission.WSA_NAMESPACE);
        //options.setTimeOutInMilliSeconds(2000);
        TransportInDescription transportIn = new TransportInDescription("HTTP");
        options.setTransportIn(transportIn);
        options.setProperty(HTTPConstants.SO_TIMEOUT, Integer.parseInt(strSO_TimeOut));
        options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, Integer.parseInt(strCON_TimeOut));
        sClient.setOptions(options);
    } catch (Exception e) {
        if (e.getMessage().equals("Can not find the external id")) {
            System.out.println("Exception ::" + e.getMessage());
        }
    }
}

それはサーブレットで呼び出され、パフォーマンスの問題のために、異なる2つの状態(url)に対してこのクラスのオブジェクトを作成し、それぞれの状態に対して最初のリクエストが来たときにこれらのオブジェクトをハッシュマップに保存し、次に新しいオブジェクトを作成し、そのオブジェクトを後続のリクエストに使用しますその状態

SubscriberRetrieveBalance objBal = null;
            BalanceBean bal = new BalanceBean();
            if (mapObj.isEmpty() || (mapObj.get(strIP) == null)) {

                objBal = new SubscriberRetrieveBalance(url, strCON_TimeOut, strSO_TimeOut);
                mapObj.put(strIP, objBal);
            } else {

                objBal = mapObj.get(strIP);
            }
            bal = objBal.subscriberRetrieveLite(strMsisdn, userId, token, strCircleId, strCircleName, strSessionId, strDlgId);

初めて応答を返し、次にその状態に属するすべての要求に対してnullpointer例外と上記のエラーを返します

このコードは、axis2-1.5 で正常に動作しています

API実装クラスの新しいオブジェクトが必要になるたびに、axis2-1.6.2バージョンに変更はありますか

提案してください。

4

0 に答える 0