shuzheng/zheng · error · RuntimeException

未注册的系统:%s

Error message

未注册的系统:%s

What it means

SSOController.index throws RuntimeException(String.format("未注册的系统:%s", appid)) when the supplied appid has no matching row in upms_system (countByExample returns 0). The auth center only serves SSO for client systems registered in the UPMS database.

Source

Thrown at zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/SSOController.java:79

    @Autowired
    UpmsSessionDao upmsSessionDao;

    @ApiOperation(value = "认证中心首页")
    @RequestMapping(value = "/index", method = RequestMethod.GET)
    public String index(HttpServletRequest request) throws Exception {
        String appid = request.getParameter("appid");
        String backurl = request.getParameter("backurl");
        if (StringUtils.isBlank(appid)) {
            throw new RuntimeException("无效访问!");
        }
        // 判断请求认证系统是否注册
        UpmsSystemExample upmsSystemExample = new UpmsSystemExample();
        upmsSystemExample.createCriteria()
                .andNameEqualTo(appid);
        int count = upmsSystemService.countByExample(upmsSystemExample);
        if (0 == count) {
            throw new RuntimeException(String.format("未注册的系统:%s", appid));
        }
        return "redirect:/sso/login?backurl=" + URLEncoder.encode(backurl, "utf-8");
    }

    @ApiOperation(value = "登录")
    @RequestMapping(value = "/login", method = RequestMethod.GET)
    public String login(HttpServletRequest request) {
        Subject subject = SecurityUtils.getSubject();
        Session session = subject.getSession();
        String serverSessionId = session.getId().toString();
        // 判断是否已登录,如果已登录,则回跳
        String code = RedisUtil.get(ZHENG_UPMS_SERVER_SESSION_ID + "_" + serverSessionId);
        // code校验值
        if (StringUtils.isNotBlank(code)) {
            // 回跳
            String backurl = request.getParameter("backurl");
            String username = (String) subject.getPrincipal();
            if (StringUtils.isBlank(backurl)) {

View on GitHub (pinned to 7005c0a775)

Solutions

  1. Register the client system in UPMS (insert into upms_system with name equal to the appid sent by the client).
  2. Make the client's configured appid exactly match the registered system name (case/whitespace included).
  3. Verify you are pointing at the right environment database that contains the system record.
  4. Catch the RuntimeException in an exception handler and render a clear 'unregistered system' page.

Example fix

// before
// client sends appid=mysys but DB has no row named 'mysys' -> 500
// after
INSERT INTO upms_system (name, title, description, ...) VALUES ('mysys', 'My System', '...', ...);
Defensive patterns

Strategy: validation

Validate before calling

UpmsSystemExample ex = new UpmsSystemExample();
ex.createCriteria().andNameEqualTo(appid);
if (upmsSystemService.countByExample(ex) == 0) {
    throw new IllegalStateException("System not registered: " + appid);
}

Type guard

boolean isRegisteredSystem(String appid) {
    UpmsSystemExample e = new UpmsSystemExample();
    e.createCriteria().andNameEqualTo(appid);
    return upmsSystemService.countByExample(e) > 0;
}

Try / catch

try {
    return ssoController.index(request);
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("未注册的系统")) {
        return "error/unregistered-system";
    }
    throw e;
}

Prevention

When it happens

Trigger: GET /sso/index?appid=foo where no upms_system row has name == 'foo', so count == 0.

Common situations: Typo or wrong-case appid in the client configuration; client system was never registered in the auth center's admin UI; environment (dev/staging/prod) database lacks the system record; system was renamed or deleted.

Related errors


AI-assisted analysis of shuzheng/zheng@7005c0a775 (2026-09-04). Data as JSON: /api/errors/bb9b2a805e4ae42e. Report an issue: GitHub.