小台的IT备忘录  
脑子越来越不好用,只能依靠烂笔头了~

我的spring boot + mybatis项目在idea里面执行正常,但发布测试环境打成可执行jar包后就启动失败,提示错误如下:

复制代码
[ ERROR] [2018-08-30 17:23:48] org.springframework.boot.SpringApplication [845] - Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bookingController': Unsatisfied dependency expressed through field 'service'; 

nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bookingService': Unsatisfied dependency expressed through field 'mapper'; 

nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'citiesMapper' defined in URL [jar:file:/D:/Code/YSL_TravelSupport_CodeSource
/trunk/src/YSL_TS_Java/start-bat/ysl-ts-core-service-hotel-1.0-SNAPSHOT.jar!/BOOT-INF/classes!/com/ysl/ts/core/service/hotel/mapper/ts_hotel/CitiesMapper.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/ysl/ts/core/service/hotel/config/HotelMybatisPlusConfig.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: 'class path resource [mapper/ts_hotel_order/HotelRefundMoneyTaskMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'class path resource [mapper/ts_hotel_order/HotelRefundMoneyTaskMapper.xml]'.
Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'HotelOrdersModel'.
Cause: java.lang.ClassNotFoundException: Cannot find class: HotelOrdersModel
复制代码

最后有一句写着:Cannot find class: HotelOrdersModel 找不到HotelOrdersModel类,打开这个mapper xml看到这里类在一个sql的resultType属性中使用

<select id="find" resultType="HotelOrdersModel">

这里不应该只写类名,而应该写全完整类名,就是包含包名的类名

<select id="find" resultType="com.ysl.ts.core.model.hotel.ts_hotel_order.HotelOrdersModel">

这样修改完成后再打包发布执行就解决了。

 

posted on   taiyonghai  阅读(1512)  评论(0编辑  收藏  举报
编辑推荐:
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
· C++代码改造为UTF-8编码问题的总结
· DeepSeek 解答了困扰我五年的技术问题
· 为什么说在企业级应用开发中,后端往往是效率杀手?
阅读排行:
· Deepseek官网太卡,教你白嫖阿里云的Deepseek-R1满血版
· 2分钟学会 DeepSeek API,竟然比官方更好用!
· .NET 使用 DeepSeek R1 开发智能 AI 客户端
· DeepSeek本地性能调优
· 一文掌握DeepSeek本地部署+Page Assist浏览器插件+C#接口调用+局域网访问!全攻略
历史上的今天:
2016-08-31 [转载]Reids配置文件详解
2016-08-31 Redis 外部访问设置
2016-08-31 Linux CentOS 7 防火墙/端口设置
 
点击右上角即可分享
微信分享提示