springboot项目集成mybatis时报错"Cannot determine embedded database driver class for database type NONE"解决

本文解决了一个在SpringBoot项目中集成MyBatis后,从Eclipse正常运行转为通过打包成jar文件在命令行运行时出现的Cannot determine embedded database driver class for database type NONE错误。通过调整打包配置最终实现成功部署。

    自己在学习springboot过程中,在进行到集成mybatis时,在Eclipse工具中运行完全OK,进行restful调用响应正确,但当将该springboot项目按照网上打jar包方式进行打jar包操作之后,在window系统cmd窗口下使用java -jar xx.jar就报错-->错误为"Cannot determine embedded database driver class for database type NONE".

    最后确定错误原因是网上的那种打jar包方式不对,最后找到一篇文章按照此方式打成jar文件,运行成功!

    文章地址 : https://www.cnblogs.com/gynbk/p/7954100.html

[main] ERROR --- o.s.boot.web.embedded.tomcat.TomcatStarter: 61 Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'proxyServletConfig': Unsatisfied dependency expressed through field 'mediaServerService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mediaServerServiceImpl': Unsatisfied dependency expressed through field 'mediaServerMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mediaServerMapper' defined in file [D:\ChromeCoreDownloads\wvp-GB28181-pro-master (1)\wvp-GB28181-pro-master\target\classes\com\genersoft\iot\vmp\storager\dao\MediaServerMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/genersoft/iot/vmp/conf/MybatisConfig.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [com/alibaba/druid/spring/boot/autoconfigure/DruidDataSourceAutoConfigure.class]: Invocation of init method failed; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
最新发布
08-22
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userService': Unsatisfied dependency expressed through field 'userMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userMapper' defined in file [C:\java\testzds\target\classes\com\example\testzds\mapper\UserMapper.class]: Cannot resolve reference to bean 'sqlSessionTemplate' while setting bean property 'sqlSessionTemplate'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionTemplate' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionTemplate' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc
05-29
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值