小台的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 2018-08-31 10:25  taiyonghai  阅读(1506)  评论(0编辑  收藏  举报