当前位置:网站首页>Grain Academy p98 trample pit e.globalexceptionhandler: null

Grain Academy p98 trample pit e.globalexceptionhandler: null

2022-07-25 23:24:00 Cyclo-

Report a mistake

2022-07-15 15:49:50.651 ERROR 10152 --- [nio-8001-exec-1] c.a.s.e.GlobalExceptionHandler           : null
2022-07-15 15:49:50.654 ERROR 10152 --- [nio-8001-exec-1] c.a.s.e.GlobalExceptionHandler           : GuliException(code=20002, msg= Failed to add course classification )

GuliException(code=20002, msg= Failed to add course classification )
	at com.atguigu.eduservice.service.impl.EduSubjectServiceImpl.saveSubject(EduSubjectServiceImpl.java:38)
	at com.atguigu.eduservice.service.impl.EduSubjectServiceImpl$$FastClassBySpringCGLIB$$e3ec89f4.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:685)
	at com.atguigu.eduservice.service.impl.EduSubjectServiceImpl$$EnhancerBySpringCGLIB$$51228585.saveSubject(<generated>)
	at com.atguigu.eduservice.controller.EduSubjectController.addSubject(EduSubjectController.java:39)

Code functions

Realize reading local excel, Upload the data to the database

error analysis

 Insert picture description here
The error message above is also Thrown from here , But my level is limited , Unable to analyze anything , So try to output the original error .
The above catch modify

catch (Exception e){
    
            e.printStackTrace();
        }

You can see the following error report

com.alibaba.excel.exception.ExcelAnalysisException: 
### Error updating database.  Cause: java.sql.SQLException: Field 'gmt_create' doesn't have a default value
### The error may involve com.atguigu.eduservice.mapper.EduSubjectMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO edu_subject  ( id, title, parent_id )  VALUES  ( ?, ?, ? )
### Cause: java.sql.SQLException: Field 'gmt_create' doesn't have a default value
; Field 'gmt_create' doesn't have a default value; nested exception is java.sql.SQLException: Field 'gmt_create' doesn't have a default value

 Insert picture description here

modify bug

When modifying or creating Give them default values , We have encapsulated the automatic assignment handler
 Insert picture description here
The autofill class encapsulated here
 chart 2

原网站

版权声明
本文为[Cyclo-]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/206/202207252314556463.html