-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spring Boot & mybatis-spring -org.apache.ibatis.type.TypeException: Could not resolve type alias #278
Comments
Hi @gituser786 , |
Hi gituser786, |
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? |
@kazuki43zoo @deoxyseia the answer is correct.
|
same problem. and in application.properties mybatis.config-locations=classpath:mybatis-config.xml |
@iver3on Could you provide a reproduce project via GitHub? |
@gituser786 @RollsBean @deoxyseia @iver3on This issue transferred from mybatis/mybatipse project. Could you feedback for this issue? (Could provide a small reproduce project?) |
@gituser786 @RollsBean @deoxyseia @iver3on I've closed this issue because no feedback. |
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 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. |
Please use the 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 |
nothing changes.. |
oh! it works. |
已经指定包名,全名称了
|
@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
The text was updated successfully, but these errors were encountered: