用户登录报200,用户注册报500

来源:6-9 用户模块所有功能自测试

慕UI937661

2019-02-18

用户登录:
{
“status”: 1,
“msg”: “用户名不存在”
}

用户注册时:
<!doctype html>

HTTP Status 500 – Internal Server Error

HTTP Status 500 – Internal Server Error


Type Exception Report

Message Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException:

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException:

Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column ‘username’ cannot be null

The error may involve com.mmall.dao.UserMapper.insert-Inline

The error occurred while setting parameters

SQL: insert into mmall_user (id, username, password, email, phone, question, answer, role, create_time, update_time) values (?, ?, ?, ?, ?, ?, ?, ?, now(), now())

Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column ‘username’ cannot be null

; SQL []; Column ‘username’ cannot be null; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column ‘username’ cannot be null

写回答

1回答

geelylucky

2019-02-18

亲爱的同学,你好,我是geely老师的助教。

错误信息很明显哦,你给的username是一个null,导致无法插入数据哦。

0
4
geelylucky
回复
慕UI937661
同学,你应该检查一下从controller到dao的整个调用链,可以通过debug的方式单步调试找到问题。
2019-02-19
共4条回复

从0开始 独立完成企业级Java电商网站服务端开发

前后端分离,数据库接口设计,架构设计,功能开发,上线运维

9476 学习 · 8804 问题

查看课程