小林的debug日志

Posted JohnnyLin00

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了小林的debug日志相关的知识,希望对你有一定的参考价值。

Java项目,Spring 配置文件applicationContex.xml文件任意,需要时在主程序使用如下调用即可获得Ioc容器

ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");

SQL语句debug

    ->   KEY `user_id` (`user_id`),
    ->   CONSTRAINT `user_id_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`)
    -> ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COMMENT='逻辑文件夹表';
ERROR 1022 (23000): Can't write; duplicate key in table 'dir'

CONSTRAINT user_id_ibfk_1与stock的外键约束名重复。

改成不重名的即可。

项目

ERROR [main] - Error while adding the mapper ‘interface com.online.dao.UserDao’ to configuration.
org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is ‘com/online/dao/UserDao.xml’. Cause: org.apache.ibatis.builder.BuilderException: Wrong namespace. Expected ‘com.online.dao.UserDao’ but found ‘com.online.dao’.
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:122)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:94)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.loadXmlResource(MapperAnnotationBuilder.java:181)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:128)
at org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:72)
at org.apache.ibatis.session.Configuration.addMapper(Configuration.java:775)
at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:80)
at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean 0 ( A b s t r a c t B e a n F a c t o r y . j a v a : 323 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . D e f a u l t S i n g l e t o n B e a n R e g i s t r y . g e t S i n g l e t o n ( D e f a u l t S i n g l e t o n B e a n R e g i s t r y . j a v a : 222 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . d o G e t B e a n ( A b s t r a c t B e a n F a c t o r y . j a v a : 321 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . g e t B e a n ( A b s t r a c t B e a n F a c t o r y . j a v a : 202 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . c o n f i g . D e p e n d e n c y D e s c r i p t o r . r e s o l v e C a n d i d a t e ( D e p e n d e n c y D e s c r i p t o r . j a v a : 276 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . D e f a u l t L i s t a b l e B e a n F a c t o r y . d o R e s o l v e D e p e n d e n c y ( D e f a u l t L i s t a b l e B e a n F a c t o r y . j a v a : 1287 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . D e f a u l t L i s t a b l e B e a n F a c t o r y . r e s o l v e D e p e n d e n c y ( D e f a u l t L i s t a b l e B e a n F a c t o r y . j a v a : 1207 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . a n n o t a t i o n . A u t o w i r e d A n n o t a t i o n B e a n P o s t P r o c e s s o r 0(AbstractBeanFactory.java:323) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1287) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1207) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor 0(AbstractBeanFactory.java:323)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)atorg.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1287)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1207)atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessorAutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:116)

以上是关于小林的debug日志的主要内容,如果未能解决你的问题,请参考以下文章

小林的debug日志

小林Debug日志 —— Spring Bug篇

2 万字 + 30 张图 |MySQL 日志:undo logredo logbinlog 有什么用?

2 万字 + 30 张图 |MySQL 日志:undo logredo logbinlog 有什么用?

Chrome开发者工具Debug入门

找出OData service出错根源的小技巧