Closed gituser786 closed 5 years ago
Hi @gituser786 , Probably, this issue does not belong this project. Could you provide small reproduce project via GitHub repository? (same with https://github.com/mybatis/spring-boot-starter/issues/38#issuecomment-330018346)
Hi gituser786, I have a some issue like your's, have u solve this issue? My issue is that when i use idea to run my springboot project, it's running ok but when i run with jar, it fill to run
I had a similar problem. I solved it changing my XML file, specifically field resultType="MyClass" to resultType="com.my.package.entities.MyClass" and removing sessionFactory.setTypeAliasesPackage("com.my.package.entities"); for avoid to duplicate entities in Mybatis context.
@RollsBean and @deoxyseia , Could you provide a reproduce project on GitHub?
If you run a spring boot application using executable jar, you should be used the SpringBootVFS
.
For details, please see mybatis/spring-boot-starter#38.
@kazuki43zoo @deoxyseia the answer is correct.
same problem. I define typeAliase com.. aliase xx in mybatis-config.xml
and in application.properties mybatis.config-locations=classpath:mybatis-config.xml why Could not resolve type alias xx???
@iver3on Could you provide a reproduce project via GitHub? And I think that this issue does not belong this project. I will suggest creating a new issue on mybatis-spring-boot-starter if you cannot a resolve this issue.
@gituser786 @RollsBean @deoxyseia @iver3on
This issue transferred from mybatis/mybatipse project. Could you feedback for this issue? (Could provide a small reproduce project?) If not feedback, I will close this issue.
@gituser786 @RollsBean @deoxyseia @iver3on
I've closed this issue because no feedback. If there is problem, please reopen this.
I just created a mini project that reproduces a similar issue. Here is the git repo. https://github.com/chris-peng-1244/ibatis-resolve-type-alias
The project works fine in IntelliJ, but if I execute java -jar xxxx.jar
it complained that BookDO couldn't be resolved.
The reason that this project followed some very unorthorgnal file structures and naming conventions is that:
Hope the demo helps clarify the problems a little better.
@chris-peng-1244
Please use the SpringBootVFS
as follow:
SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
factoryBean.setVfs(SpringBootVFS.class);
// ...
@kazuki43zoo It works, thank you so much!
Thank @kazuki43zoo
Thanks @kazuki43zoo, could you please elaborate why this is the solution? Couldn't find any documentation about it
@adrixgc Please see http://www.mybatis.org/spring-boot-starter/mybatis-spring-boot-autoconfigure/#Using_the_SpringBootVFS. Is OK?
@adrixgc Please see http://www.mybatis.org/spring-boot-starter/mybatis-spring-boot-autoconfigure/#Using_the_SpringBootVFS. Is OK?
nothing changes.. spring boot can not find type alias but complete class name with package..
@adrixgc Please see http://www.mybatis.org/spring-boot-starter/mybatis-spring-boot-autoconfigure/#Using_the_SpringBootVFS. Is OK?
nothing changes.. spring boot can not find type alias but complete class name with package..
oh! it works. i just put the package location in setTypeAliasesPackage method, not just in setTypeAliasesPackage method.
已经指定包名,全名称了 为什么还是会报错
<update id="updateGenTableColumn" parameterType="com.cainaer.gen.domain.GenTableColumn">
Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'GenTableColumn'. Cause: java.lang.ClassNotFoundException: Cannot find class: GenTableColumn
@xiao-ma-nong
This issue is closed already. If you have a problem, please create a new issue with reproduce project via GitHub.
I am using spring boot 1.5.4 & mybatis-spring 1.3.0 along with mybatis-spring-boot-starter. Whenever I am running my standalone application via eclipse I am able to run. when I run the executable jar file in command line, I am getting below error. Error creating bean with name 'classNameMapper' defined in class path resource [mybatis-context.xml]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [mybatis-context.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'class path resource [com/../..//mapper/MyMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'MyClass'. Cause: java.lang.ClassNotFoundException: Cannot find class: MyCLass
Please help me