日常bug整理--xxtz

2017-12-12

建SQLite数据库表时,遇到外键关联报错:foreign key mismatch

解决:发现是个粗心问题,关联的外键没有作为主键,原因是关联的外键由INT改为varchar字符型,取消主键自增的同时把主键也取消了尴尬

 


2017-12-12

mybatis配置SQLite的是时候数据源不正确

SSM项目启动时报错:the JDBC Driver has been forcibly unregistered.

参考:

http://blog.csdn.net/hj7jay/article/details/51686418    数据库阿里连接池 druid配置详解


 

2017-12-14

 

Mybatis访问sqlite数据库时,查询和插入没有效果,原因:

 

①SSM框架访问的sqlite数据库db文件和sqlite客户端工具sqlite expert professional访问的db文件不是同一个

 

②另外sqlite插入语句又主键自增的可设null值再插入数据库,自动会自增

 

1 Message msg = new Message();
2 msg.setMsgno(null);

 

 

<insert id="addMsg" parameterType="Message">
insert into message(msgno,specno,senddate,notes) values(
#{msgno},
#{specno},
#{senddate},
#{notes}
)
</insert>

 


 

2017-12-14

报错

[WARN] Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: Could not write content: No serializer found for class org.springframework.validation.DefaultMessageCodesResolver and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: java.util.HashMap["content"]->org.springframework.validation.support.BindingAwareModelMap["org.springframework.validation.BindingResult.toolObj"]->org.springframework.validation.BeanPropertyBindingResult["messageCodesResolver"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class org.springframework.validation.DefaultMessageCodesResolver and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: java.util.HashMap["content"]->org.springframework.validation.support.BindingAwareModelMap["org.springframework.validation.BindingResult.toolObj"]->org.springframework.validation.BeanPropertyBindingResult["messageCodesResolver"])
2017-12-14 10:27:44,755 [http-bio-8090-exec-2] [org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver]-[WARN] Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: Could not write content: No serializer found for class org.springframework.validation.DefaultMessageCodesResolver and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: java.util.HashMap["content"]->org.springframework.validation.support.BindingAwareModelMap["org.springframework.validation.BindingResult.toolObj"]->org.springframework.validation.BeanPropertyBindingResult["messageCodesResolver"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class org.springframework.validation.DefaultMessageCodesResolver and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: java.util.HashMap["content"]->org.springframework.validation.support.BindingAwareModelMap["org.springframework.validation.BindingResult.toolObj"]->org.springframework.validation.BeanPropertyBindingResult["messageCodesResolver"])
2017-12-14 10:27:44,755 [http-bio-8090-exec-2] [org.springframework.web.servlet.DispatcherServlet]-[DEBUG] Null ModelAndView returned to DispatcherServlet with name 'springmvc': assuming HandlerAdapter completed request handling
2017-12-14 10:27:44,755 [http-bio-8090-exec-1] [org.springframework.web.servlet.DispatcherServlet]-[DEBUG] Null ModelAndView returned to DispatcherServlet with name 'springmvc': assuming HandlerAdapter completed request handling
2017-12-14 10:27:44,756 [http-bio-8090-exec-2] [org.springframework.web.servlet.DispatcherServlet]-[DEBUG] Successfully completed request
2017-12-14 10:27:44,756 [http-bio-8090-exec-1] [org.springframework.web.servlet.DispatcherServlet]-[DEBUG] Successfully completed request
2017-12-14 10:27:44,757 [http-bio-8090-exec-2] [org.springframework.beans.factory.support.DefaultListableBeanFactory]-[DEBUG] Returning cached instance of singleton bean 'sqlSessionFactory'

 

解决,把Model换成Map<String,Object>

 

 


 

2017-12-18

java插入sqlite时间总是为

1899-12-30

 

解决

senddate=DateUtil.getDateToString(DateUtil.getStringToDate("s"));

 

posted @ 2017-12-14 09:32  林夕Emma  阅读(921)  评论(0编辑  收藏  举报