无法从request中获取存放在session中的验证码

想要用阿里云短信服务平台,登录微信小程序。
其中
登录:

 public ResponseData login(User user,HttpServletRequest request){
  
}


发送验证码:

public ResponseData sendMsg(User user,HttpServletRequest request){
  
}


其中把验证码存进session

       JSONObject json = new JSONObject();
        json.put("tel", tel);
        json.put("valid-time", seconds);
        json.put("create-time", System.currentTimeMillis());
        json.put("tel-code", codes); 
        HttpSession httpSession = request.getSession();
        httpSession.setAttribute("CodeTel", json);

想去出的时候,获取不到

JSONObject json  =(JSONObject) request.getSession().getAttribute("CodeTel");

运行结果及报错内容

存的进去,取不出来

HttpServletRequest 是同一个类吗
启用了session吗
是同一个域名的吗

报错是什么样呢