paascloud/paascloud-master · error · UacBizException
UAC10011022
UAC10011022
Error message
UAC10011022
What it means
UacBizException with code UAC10011022 is thrown by SmsProducer.sendSmsCodeMq when JSON.toJSONString(request) fails while serializing the SMS request built from a SmsMessage (phone number, template param, outId). The exception is logged as "发送短信验证码 smsMessage转换为json字符串失败" and rethrown, preventing the SMS verification-code message from reaching the SEND_SMS_TOPIC MQ topic.
Solutions
- Read the logged stack trace for the underlying serialization cause
- Ensure templateParam is a simple Map<String,String> or a JSON string, not a self-referencing object
- Simplify the request DTO to plain fields and avoid getter side effects
- Pin/align the fastjson version used by the project
Example fix
// before request.setTemplateParam(complexNestedObject); // after request.setTemplateParam(JSON.toJSONString(complexNestedObject));
Defensive patterns
Strategy: try-catch
Validate before calling
try { JSON.parseObject(JSON.toJSONString(request), SendSmsRequest.class); } catch (Exception e) { /* invalid request */ } Try / catch
try { msgBody = JSON.toJSONString(request); } catch (Exception e) { log.error("sms request serialization failed, mobile={}", smsMessage.getMobileNo(), e); throw new UacBizException(ErrorCodeEnum.UAC10011022); } Prevention
- Pass templateParam as a pre-serialized JSON string or simple Map<String,String>
- Avoid getters with side effects on SMS request DTOs
- Unit-test serialization of SmsMessage variants including null outId
- Keep fastjson version aligned across producer and consumer modules
When it happens
Trigger: Calling sendSmsCodeMq with a SmsMessage whose constructed Aliyun request object cannot be serialized by fastjson — e.g. templateParam containing structures fastjson cannot handle, or a getter on the request throwing during serialization.
Common situations: Template param JSON with special characters or nested maps triggering fastjson issues; custom fields added to the request DTO with throwing getters; fastjson version upgrades changing serialization behavior.
Understand the failure class
Background: "JSON serialization failed", "not JSON serializable", "Failed to serialize": why JSON marshaling errors happen and how to fix them — this error's family across 46 libraries.
Related errors
AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10).
Data as JSON: /api/errors/66a58121cc169836.
Report an issue: GitHub.
Appendix: source
Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/mq/producer/SmsProducer.java:61
PcSendSmsRequest request = new PcSendSmsRequest();
Map<String, String> map = Maps.newHashMap();
// 模板参数
String smsParamName = templetEnum.getSmsParamName();
// 模板编码
String templetCode = templetEnum.getTempletCode();
//替换模板验证码
map.put(smsParamName, smsMessage.getSmsCode());
String param = JSON.toJSONString(map);
request.setPhoneNumbers(smsMessage.getMobileNo());
request.setTemplateCode(templetCode);
request.setTemplateParam(param);
request.setOutId(smsMessage.getOutId());
msgBody = JSON.toJSONString(request);
} catch (Exception e) {
log.error("发送短信验证码 smsMessage转换为json字符串失败", e);
throw new UacBizException(ErrorCodeEnum.UAC10011022);
}
String topic = AliyunMqTopicConstants.MqTopicEnum.SEND_SMS_TOPIC.getTopic();
String tag = AliyunMqTopicConstants.MqTagEnum.REGISTER_USER_AUTH_CODE.getTag();
String key = RedisKeyUtil.createMqKey(topic, tag, smsMessage.getMobileNo(), msgBody);
return new MqMessageData(msgBody, topic, tag, key);
}
}
View on GitHub (pinned to 781281a950)