seata causes the insert statement to appear The error occurred while setting parameters

created at 02-23-2022 views: 8

problem

I am the seata RM side, the called side, when called by the business initiator, the following error occurs in the insert statement. log at the bottom

At first I have been looking for the cause of the The error occurred while setting parameters and so on, but found nothing, because I have no problem running it locally.

I wrote a new test method, which is simply an insert, and the parameters are written to death, so whoever adjusts it is the same. In this way, if the influence of the parameters is excluded, the result is still the same. If I adjust it myself, I will succeed, and the business initiator will report an error. Suspected to be the reason for seata.

I have been looking at the above error report, wasting a lot of time, I should look directly at the bottom NullPointerException.

Caused by: java.lang.NullPointerException
    at io.seata.rm.AbstractResourceManager.branchRegister(AbstractResourceManager.java:68)
    ... 137 more

Open this file and see that these two methods are the same, that is, the error is reported here.

public Long branchRegister(BranchType branchType, String resourceId, String clientId, String xid, String applicationData, String lockKeys) throws TransactionException {
        try {
            BranchRegisterRequest request = new BranchRegisterRequest();
            request.setXid(xid);
            request.setLockKey(lockKeys);
            request.setResourceId(resourceId);
            request.setBranchType(branchType);
            request.setApplicationData(applicationData);
            // 👇It is suspected that the result of the request here is empty, resulting in a null pointer
            BranchRegisterResponse response = (BranchRegisterResponse)RmNettyRemotingClient.getInstance().sendSyncRequest(request);
            if (response.getResultCode() == ResultCode.Failed) {
                throw new RmTransactionException(response.getTransactionExceptionCode(), String.format("Response[ %s ]", response.getMsg()));
            } else {
                return response.getBranchId();
            }
        } catch (TimeoutException var9) {
            throw new RmTransactionException(TransactionExceptionCode.IO, "RPC Timeout", var9);
        } catch (RuntimeException var10) {
            throw new RmTransactionException(TransactionExceptionCode.BranchRegisterFailed, "Runtime", var10);
        }
    }

reason

In the end, it was found that it was a configuration problem of seata, and the network was blocked. Because my company's connection to seata is divided into public network and intranet, the public network connection I used at the beginning was no problem. Later, I coordinated with the business initiator to change the intranet connection, and forgot telnet. Causes the network to fail without knowing it. emmm, simple mistake. . .

created at:02-23-2022
edited at: 02-23-2022: