同事日常bug之大战 mybaties的小怪
作者:互联网
beans.factory.UnsatisfiedDependencyException: Error creating bean with name"XXXconfig"…
场景: 原先web 服务 正常启动,后因数据库添加字段,需要手动去做添加 XXXmapper.XML,跟实体 (建议:去生成后后,往里面粘贴。)
先启动web端,上错误代码:
"C:\Program Files\Java\jdk1.8.0_144\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:D:\IntelliJ IDEA 2019.1.1\lib\idea_rt.jar=59784:D:\IntelliJ IDEA 2019.1.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_144\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_144\jre\lib\rt.jar;E:\qiyema_w\qym-web-end\cms\target\classes;D:\maven-java\repository_boot\org\springframework\boot\spring-boot-starter\2.1.1.RELEASE\spring-boot-starter-2.1.1.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\boot\spring-boot\2.1.1.RELEASE\spring-boot-2.1.1.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\boot\spring-boot-autoconfigure\2.1.1.RELEASE\spring-boot-autoconfigure-2.1.1.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\boot\spring-boot-starter-logging\2.1.1.RELEASE\spring-boot-starter-logging-2.1.1.RELEASE.jar;D:\maven-java\repository_boot\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\maven-java\repository_boot\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\maven-java\repository_boot\org\apache\logging\log4j\log4j-to-slf4j\2.11.1\log4j-to-slf4j-2.11.1.jar;D:\maven-java\repository_boot\org\apache\logging\log4j\log4j-api\2.11.1\log4j-api-2.11.1.jar;D:\maven-java\repository_boot\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;D:\maven-java\repository_boot\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;D:\maven-java\repository_boot\org\springframework\spring-core\5.1.3.RELEASE\spring-core-5.1.3.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\spring-jcl\5.1.3.RELEASE\spring-jcl-5.1.3.RELEASE.jar;D:\maven-java\repository_boot\org\yaml\snakeyaml\1.23\snakeyaml-1.23.jar;D:\maven-java\repository_boot\net\bytebuddy\byte-buddy\1.9.5\byte-buddy-1.9.5.jar;D:\maven-java\repository_boot\org\springframework\boot\spring-boot-starter-aop\2.1.1.RELEASE\spring-boot-starter-aop-2.1.1.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\spring-aop\5.1.3.RELEASE\spring-aop-5.1.3.RELEASE.jar;D:\maven-java\repository_boot\org\aspectj\aspectjweaver\1.9.2\aspectjweaver-1.9.2.jar;D:\maven-java\repository_boot\org\springframework\boot\spring-boot-starter-web\2.1.1.RELEASE\spring-boot-starter-web-2.1.1.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\boot\spring-boot-starter-json\2.1.1.RELEASE\spring-boot-starter-json-2.1.1.RELEASE.jar;D:\maven-java\repository_boot\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.7\jackson-datatype-jdk8-2.9.7.jar;D:\maven-java\repository_boot\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.7\jackson-datatype-jsr310-2.9.7.jar;D:\maven-java\repository_boot\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.7\jackson-module-parameter-names-2.9.7.jar;D:\maven-java\repository_boot\org\springframework\boot\spring-boot-starter-tomcat\2.1.1.RELEASE\spring-boot-starter-tomcat-2.1.1.RELEASE.jar;D:\maven-java\repository_boot\org\apache\tomcat\embed\tomcat-embed-core\9.0.13\tomcat-embed-core-9.0.13.jar;D:\maven-java\repository_boot\org\apache\tomcat\embed\tomcat-embed-el\9.0.13\tomcat-embed-el-9.0.13.jar;D:\maven-java\repository_boot\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.13\tomcat-embed-websocket-9.0.13.jar;D:\maven-java\repository_boot\org\hibernate\validator\hibernate-validator\6.0.13.Final\hibernate-validator-6.0.13.Final.jar;D:\maven-java\repository_boot\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;D:\maven-java\repository_boot\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;D:\maven-java\repository_boot\org\springframework\spring-web\5.1.3.RELEASE\spring-web-5.1.3.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\spring-webmvc\5.1.3.RELEASE\spring-webmvc-5.1.3.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\spring-expression\5.1.3.RELEASE\spring-expression-5.1.3.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\boot\spring-boot-devtools\2.1.1.RELEASE\spring-boot-devtools-2.1.1.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\boot\spring-boot-starter-security\2.1.1.RELEASE\spring-boot-starter-security-2.1.1.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\security\spring-security-config\5.1.2.RELEASE\spring-security-config-5.1.2.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\security\spring-security-core\5.1.2.RELEASE\spring-security-core-5.1.2.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\security\spring-security-web\5.1.2.RELEASE\spring-security-web-5.1.2.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\boot\spring-boot-starter-data-redis\2.1.1.RELEASE\spring-boot-starter-data-redis-2.1.1.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\data\spring-data-redis\2.1.3.RELEASE\spring-data-redis-2.1.3.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\data\spring-data-keyvalue\2.1.3.RELEASE\spring-data-keyvalue-2.1.3.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\data\spring-data-commons\2.1.3.RELEASE\spring-data-commons-2.1.3.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\spring-tx\5.1.3.RELEASE\spring-tx-5.1.3.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\spring-oxm\5.1.3.RELEASE\spring-oxm-5.1.3.RELEASE.jar;D:\maven-java\repository_boot\io\lettuce\lettuce-core\5.1.3.RELEASE\lettuce-core-5.1.3.RELEASE.jar;D:\maven-java\repository_boot\io\projectreactor\reactor-core\3.2.3.RELEASE\reactor-core-3.2.3.RELEASE.jar;D:\maven-java\repository_boot\org\reactivestreams\reactive-streams\1.0.2\reactive-streams-1.0.2.jar;D:\maven-java\repository_boot\io\netty\netty-common\4.1.31.Final\netty-common-4.1.31.Final.jar;D:\maven-java\repository_boot\io\netty\netty-transport\4.1.31.Final\netty-transport-4.1.31.Final.jar;D:\maven-java\repository_boot\io\netty\netty-buffer\4.1.31.Final\netty-buffer-4.1.31.Final.jar;D:\maven-java\repository_boot\io\netty\netty-resolver\4.1.31.Final\netty-resolver-4.1.31.Final.jar;D:\maven-java\repository_boot\io\netty\netty-handler\4.1.31.Final\netty-handler-4.1.31.Final.jar;D:\maven-java\repository_boot\io\netty\netty-codec\4.1.31.Final\netty-codec-4.1.31.Final.jar;D:\maven-java\repository_boot\org\apache\commons\commons-pool2\2.6.0\commons-pool2-2.6.0.jar;D:\maven-java\repository_boot\mysql\mysql-connector-java\8.0.13\mysql-connector-java-8.0.13.jar;D:\maven-java\repository_boot\org\mybatis\spring\boot\mybatis-spring-boot-starter\1.3.2\mybatis-spring-boot-starter-1.3.2.jar;D:\maven-java\repository_boot\org\springframework\boot\spring-boot-starter-jdbc\2.1.1.RELEASE\spring-boot-starter-jdbc-2.1.1.RELEASE.jar;D:\maven-java\repository_boot\com\zaxxer\HikariCP\3.2.0\HikariCP-3.2.0.jar;D:\maven-java\repository_boot\org\springframework\spring-jdbc\5.1.3.RELEASE\spring-jdbc-5.1.3.RELEASE.jar;D:\maven-java\repository_boot\org\mybatis\spring\boot\mybatis-spring-boot-autoconfigure\1.3.2\mybatis-spring-boot-autoconfigure-1.3.2.jar;D:\maven-java\repository_boot\org\mybatis\mybatis\3.4.6\mybatis-3.4.6.jar;D:\maven-java\repository_boot\org\mybatis\mybatis-spring\1.3.2\mybatis-spring-1.3.2.jar;D:\maven-java\repository_boot\com\github\pagehelper\pagehelper-spring-boot-starter\1.2.5\pagehelper-spring-boot-starter-1.2.5.jar;D:\maven-java\repository_boot\com\github\pagehelper\pagehelper-spring-boot-autoconfigure\1.2.5\pagehelper-spring-boot-autoconfigure-1.2.5.jar;D:\maven-java\repository_boot\com\github\pagehelper\pagehelper\5.1.4\pagehelper-5.1.4.jar;D:\maven-java\repository_boot\com\github\jsqlparser\jsqlparser\1.0\jsqlparser-1.0.jar;D:\maven-java\repository_boot\com\alibaba\druid-spring-boot-starter\1.1.14\druid-spring-boot-starter-1.1.14.jar;D:\maven-java\repository_boot\com\alibaba\druid\1.1.14\druid-1.1.14.jar;D:\maven-java\repository_boot\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\maven-java\repository_boot\org\apache\commons\commons-lang3\3.8.1\commons-lang3-3.8.1.jar;D:\maven-java\repository_boot\commons-io\commons-io\2.5\commons-io-2.5.jar;D:\maven-java\repository_boot\commons-fileupload\commons-fileupload\1.3.3\commons-fileupload-1.3.3.jar;D:\maven-java\repository_boot\eu\bitwalker\UserAgentUtils\1.19\UserAgentUtils-1.19.jar;D:\maven-java\repository_boot\com\alibaba\fastjson\1.2.56\fastjson-1.2.56.jar;D:\maven-java\repository_boot\org\springframework\spring-context-support\5.1.3.RELEASE\spring-context-support-5.1.3.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\spring-beans\5.1.3.RELEASE\spring-beans-5.1.3.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\spring-context\5.1.3.RELEASE\spring-context-5.1.3.RELEASE.jar;D:\maven-java\repository_boot\io\jsonwebtoken\jjwt\0.9.0\jjwt-0.9.0.jar;D:\maven-java\repository_boot\com\fasterxml\jackson\core\jackson-databind\2.9.7\jackson-databind-2.9.7.jar;D:\maven-java\repository_boot\com\fasterxml\jackson\core\jackson-core\2.9.7\jackson-core-2.9.7.jar;D:\maven-java\repository_boot\io\springfox\springfox-swagger2\2.9.2\springfox-swagger2-2.9.2.jar;D:\maven-java\repository_boot\io\springfox\springfox-spi\2.9.2\springfox-spi-2.9.2.jar;D:\maven-java\repository_boot\io\springfox\springfox-core\2.9.2\springfox-core-2.9.2.jar;D:\maven-java\repository_boot\io\springfox\springfox-schema\2.9.2\springfox-schema-2.9.2.jar;D:\maven-java\repository_boot\io\springfox\springfox-swagger-common\2.9.2\springfox-swagger-common-2.9.2.jar;D:\maven-java\repository_boot\io\springfox\springfox-spring-web\2.9.2\springfox-spring-web-2.9.2.jar;D:\maven-java\repository_boot\com\google\guava\guava\20.0\guava-20.0.jar;D:\maven-java\repository_boot\com\fasterxml\classmate\1.4.0\classmate-1.4.0.jar;D:\maven-java\repository_boot\org\springframework\plugin\spring-plugin-core\1.2.0.RELEASE\spring-plugin-core-1.2.0.RELEASE.jar;D:\maven-java\repository_boot\org\springframework\plugin\spring-plugin-metadata\1.2.0.RELEASE\spring-plugin-metadata-1.2.0.RELEASE.jar;D:\maven-java\repository_boot\org\mapstruct\mapstruct\1.2.0.Final\mapstruct-1.2.0.Final.jar;D:\maven-java\repository_boot\io\swagger\swagger-annotations\1.5.21\swagger-annotations-1.5.21.jar;D:\maven-java\repository_boot\io\swagger\swagger-models\1.5.21\swagger-models-1.5.21.jar;D:\maven-java\repository_boot\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;D:\maven-java\repository_boot\io\springfox\springfox-swagger-ui\2.9.2\springfox-swagger-ui-2.9.2.jar;D:\maven-java\repository_boot\com\github\oshi\oshi-core\3.9.1\oshi-core-3.9.1.jar;D:\maven-java\repository_boot\net\java\dev\jna\jna\4.5.2\jna-4.5.2.jar;D:\maven-java\repository_boot\net\java\dev\jna\jna-platform\4.5.2\jna-platform-4.5.2.jar;D:\maven-java\repository_boot\org\apache\poi\poi-ooxml\3.17\poi-ooxml-3.17.jar;D:\maven-java\repository_boot\org\apache\poi\poi\3.17\poi-3.17.jar;D:\maven-java\repository_boot\org\apache\commons\commons-collections4\4.1\commons-collections4-4.1.jar;D:\maven-java\repository_boot\org\apache\poi\poi-ooxml-schemas\3.17\poi-ooxml-schemas-3.17.jar;D:\maven-java\repository_boot\org\apache\xmlbeans\xmlbeans\2.6.0\xmlbeans-2.6.0.jar;D:\maven-java\repository_boot\stax\stax-api\1.0.1\stax-api-1.0.1.jar;D:\maven-java\repository_boot\com\github\virtuald\curvesapi\1.04\curvesapi-1.04.jar;D:\maven-java\repository_boot\org\apache\velocity\velocity\1.7\velocity-1.7.jar;D:\maven-java\repository_boot\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar;D:\maven-java\repository_boot\commons-lang\commons-lang\2.4\commons-lang-2.4.jar;D:\maven-java\repository_boot\org\quartz-scheduler\quartz\2.3.0\quartz-2.3.0.jar;D:\maven-java\repository_boot\com\mchange\mchange-commons-java\0.2.11\mchange-commons-java-0.2.11.jar;D:\maven-java\repository_boot\commons-beanutils\commons-beanutils\1.9.3\commons-beanutils-1.9.3.jar;D:\maven-java\repository_boot\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;D:\maven-java\repository_boot\commons-net\commons-net\3.1\commons-net-3.1.jar;D:\maven-java\repository_boot\org\apache\httpcomponents\httpclient\4.5\httpclient-4.5.jar;D:\maven-java\repository_boot\commons-codec\commons-codec\1.11\commons-codec-1.11.jar;D:\maven-java\repository_boot\org\apache\httpcomponents\httpmime\4.5\httpmime-4.5.jar;D:\maven-java\repository_boot\org\apache\httpcomponents\httpcore\4.4.1\httpcore-4.4.1.jar;D:\maven-java\repository_boot\org\projectlombok\lombok\1.18.12\lombok-1.18.12.jar" com.weinan.cms.CmsApplication
Application Version: ${ruoyi.version}
Spring Boot Version: 2.1.1.RELEASE
************
####....#.
#..###.....##....
#####################################################
#...#......#.##...#......#.##...#......#.##------------------#
###########################################------------------#
14:34:11.559 [main] INFO c.w.c.CmsApplication - [logStarting,50] - Starting CmsApplication on shixy1 with PID 9804 (E:\qiyema_w\qym-web-end\cms\target\classes started by shixy1 in E:\qiyema_w\qym-web-end)
14:34:11.562 [main] INFO c.w.c.CmsApplication - [logStartupProfileInfo,679] - The following profiles are active: dev
14:34:13.308 [main] INFO o.a.c.h.Http11NioProtocol - [log,173] - Initializing ProtocolHandler ["http-nio-9859"]
14:34:13.313 [main] INFO o.a.c.c.StandardService - [log,173] - Starting service [Tomcat]
14:34:13.313 [main] INFO o.a.c.c.StandardEngine - [log,173] - Starting Servlet Engine: Apache Tomcat/9.0.13
14:34:13.318 [main] INFO o.a.c.c.AprLifecycleListener - [log,173] - The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_144\bin;C:\windows\Sun\Java\bin;C:\windows\system32;C:\windows;C:\ProgramData\Oracle\Java\javapath;D:\app\shixy1\product\11.2.0\dbhome_1\bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\nodejs\;D:\maven-java\apache-maven-3.6.0\bin;D:\software\erl10.4\bin;D:\software\visualSVN Server\bin;D:\software\TortoiseSVN\bin;D:\software\git\Git\cmd;D:\mysql5.7\MySQL Server 5.7\bin;D:\software\git\TortoiseGit\bin;C:\Program Files\Java\jdk1.8.0_144\bin;E:\app\lenovo\product\11.2.0\client_1;C:\Users\shixy1\AppData\Local\Microsoft\WindowsApps;;D:\software\Microsoft VS Code\bin;.]
14:34:13.390 [main] INFO o.a.c.c.C.[.[.[/] - [log,173] - Initializing Spring embedded WebApplicationContext
14:34:14.241 [main] WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - [refresh,554] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'securityConfig': Unsatisfied dependency expressed through field 'userDetailsService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userDetailsServiceImpl': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysUserServiceImpl': Unsatisfied dependency expressed through field 'userMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysUserMapper' defined in file [E:\qiyema_w\qym-web-end\cms\target\classes\com\weinan\cms\project\system\mapper\SysUserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/weinan/cms/framework/config/MyBatisConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\qiyema_w\qym-web-end\cms\target\classes\mybatis\module\PolicyMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\qiyema_w\qym-web-end\cms\target\classes\mybatis\module\PolicyMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'VARCHAR'. Cause: java.lang.ClassNotFoundException: Cannot find class: VARCHAR
14:34:14.250 [main] INFO o.a.c.c.StandardService - [log,173] - Stopping service [Tomcat]
14:34:14.268 [main] ERROR o.s.b.SpringApplication - [reportFailure,858] - Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'securityConfig': Unsatisfied dependency expressed through field 'userDetailsService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userDetailsServiceImpl': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysUserServiceImpl': Unsatisfied dependency expressed through field 'userMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysUserMapper' defined in file [E:\qiyema_w\qym-web-end\cms\target\classes\com\weinan\cms\project\system\mapper\SysUserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/weinan/cms/framework/config/MyBatisConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\qiyema_w\qym-web-end\cms\target\classes\mybatis\module\PolicyMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\qiyema_w\qym-web-end\cms\target\classes\mybatis\module\PolicyMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'VARCHAR'. Cause: java.lang.ClassNotFoundException: Cannot find class: VARCHAR
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
at com.weinan.cms.CmsApplication.main(CmsApplication.java:18)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userDetailsServiceImpl': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysUserServiceImpl': Unsatisfied dependency expressed through field 'userMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysUserMapper' defined in file [E:\qiyema_w\qym-web-end\cms\target\classes\com\weinan\cms\project\system\mapper\SysUserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/weinan/cms/framework/config/MyBatisConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\qiyema_w\qym-web-end\cms\target\classes\mybatis\module\PolicyMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\qiyema_w\qym-web-end\cms\target\classes\mybatis\module\PolicyMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'VARCHAR'. Cause: java.lang.ClassNotFoundException: Cannot find class: VARCHAR
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1237)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1164)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593)
... 19 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysUserServiceImpl': Unsatisfied dependency expressed through field 'userMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysUserMapper' defined in file [E:\qiyema_w\qym-web-end\cms\target\classes\com\weinan\cms\project\system\mapper\SysUserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/weinan/cms/framework/config/MyBatisConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\qiyema_w\qym-web-end\cms\target\classes\mybatis\module\PolicyMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\qiyema_w\qym-web-end\cms\target\classes\mybatis\module\PolicyMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'VARCHAR'. Cause: java.lang.ClassNotFoundException: Cannot find class: VARCHAR
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1237)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1164)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593)
... 32 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysUserMapper' defined in file [E:\qiyema_w\qym-web-end\cms\target\classes\com\weinan\cms\project\system\mapper\SysUserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/weinan/cms/framework/config/MyBatisConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\qiyema_w\qym-web-end\cms\target\classes\mybatis\module\PolicyMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\qiyema_w\qym-web-end\cms\target\classes\mybatis\module\PolicyMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'VARCHAR'. Cause: java.lang.ClassNotFoundException: Cannot find class: VARCHAR
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1482)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1362)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1237)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1164)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593)
... 45 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/weinan/cms/framework/config/MyBatisConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\qiyema_w\qym-web-end\cms\target\classes\mybatis\module\PolicyMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\qiyema_w\qym-web-end\cms\target\classes\mybatis\module\PolicyMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'VARCHAR'. Cause: java.lang.ClassNotFoundException: Cannot find class: VARCHAR
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:627)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:607)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1237)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1164)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1467)
... 56 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\qiyema_w\qym-web-end\cms\target\classes\mybatis\module\PolicyMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\qiyema_w\qym-web-end\cms\target\classes\mybatis\module\PolicyMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'VARCHAR'. Cause: java.lang.ClassNotFoundException: Cannot find class: VARCHAR
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622)
... 69 common frames omitted
Caused by: org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\qiyema_w\qym-web-end\cms\target\classes\mybatis\module\PolicyMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\qiyema_w\qym-web-end\cms\target\classes\mybatis\module\PolicyMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'VARCHAR'. Cause: java.lang.ClassNotFoundException: Cannot find class: VARCHAR
at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:523)
at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:380)
at org.mybatis.spring.SqlSessionFactoryBean.getObject(SqlSessionFactoryBean.java:547)
at com.weinan.cms.framework.config.MyBatisConfig.sqlSessionFactory(MyBatisConfig.java:106)
at com.weinan.cms.framework.config.MyBatisConfig$$EnhancerBySpringCGLIB$$7eefedc8.CGLIB$sqlSessionFactory$0(<generated>)
at com.weinan.cms.framework.config.MyBatisConfig$$EnhancerBySpringCGLIB$$7eefedc8$$FastClassBySpringCGLIB$$1060c8fd.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363)
at com.weinan.cms.framework.config.MyBatisConfig$$EnhancerBySpringCGLIB$$7eefedc8.sqlSessionFactory(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 70 common frames omitted
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\qiyema_w\qym-web-end\cms\target\classes\mybatis\module\PolicyMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'VARCHAR'. Cause: java.lang.ClassNotFoundException: Cannot find class: VARCHAR
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:120)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:521)
... 83 common frames omitted
Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'VARCHAR'. Cause: java.lang.ClassNotFoundException: Cannot find class: VARCHAR
at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:118)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildResultMappingFromContext(XMLMapperBuilder.java:379)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:280)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:252)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:244)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:116)
... 85 common frames omitted
Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'VARCHAR'. Cause: java.lang.ClassNotFoundException: Cannot find class: VARCHAR
at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:120)
at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:149)
at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:116)
... 90 common frames omitted
Caused by: java.lang.ClassNotFoundException: Cannot find class: VARCHAR
at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:200)
at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:89)
at org.apache.ibatis.io.Resources.classForName(Resources.java:261)
at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:116)
... 92 common frames omitted
Process finished with exit code 1
原生成的XML 的映射关系是下列代码(这个是对的,JdbcType)
<result property="deleted" column="deleted" jdbcType="BOOLEAN" />
<result property="buttonTag" column="button_tag" jdbcType="INTEGER"/>
<result property="firstDeptId" column="first_dept_id" jdbcType="INTEGER"/>
<result property="regionId" column="region_id" jdbcType="INTEGER"/>
<result property="regionParentId" column="regionParentId" jdbcType="INTEGER"/>
后来同事 ,自己手动新添加的代码部分 (这个是不对的,javaType)
<result property="declareNum" column="declare_num" javaType="INTEGER"/>
<result property="isApprove" column="is_approve" javaType="INTEGER"/>
<result property="deleted" column="deleted" javaType="BOOLEAN" />
大家一看都知道 哪里出的问题。
JavaType 定义的是java 类里的属性类型;
JdbcType 定义的是数据库里的属性类型。
但然 我们看控制台返回的提示 也可以看出这个异常
把新同事写的 属性类型改过来即可
标签:mybaties,java,小怪,jar,boot,springframework,maven,org,bug 来源: https://blog.csdn.net/weixin_43618209/article/details/115028657