Score
0
Watch 3K Star 6.4K Fork 3.1K

ThinkGem / JeeSite 4.xJavaAGPL-3.0

误操作,重复生成代码。删除后启动报错

Open
ben  Opened this issue

该问题是怎么引起的?

对一个表生成代码。之后idea启动时mybatis报错,大概意思是实体类重名,才意识到很久之前已经生成过了。

因此手动删除掉了最新生成的controller、service、entity、dao、dao.xml、2个网页,如上7个文件。可是重新编译后再次启动,依旧报错!

急急急,新手求教啊!

报错信息

启动时每一个dao映射都报失败,如下,原因即是实体类已被映射,因此sqlSession加载失败。

2019-09-29 16:43:56,985 WARN  [springframework.beans.factory.support.DefaultListableBeanFactory] - Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountCompanyhrDao' defined in file [D:\idea_workspace\schoolappserver\target\schoolappserver\WEB-INF\classes\com\thinkgem\jeesite\modules\account\dao\accounthr\AccountCompanyhrDao.class]: 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 file [D:\idea_workspace\schoolappserver\target\schoolappserver\WEB-INF\classes\spring-context.xml]:Invocation of init method failed; nested exception is org.apache.ibatis.type.TypeException: The alias 'UndersCompanyFile' is already mapped to the value 'com.thinkgem.jeesite.modules.unders.entity.companyfile.UndersCompanyFile'.

关键位置即最后一句:Invocation of init method failed; nested exception is org.apache.ibatis.type.TypeException: The alias 'UndersCompanyFile' is already mapped to the value 'com.thinkgem.jeesite.modules.unders.entity.companyfile.UndersCompanyFile'.

然后所有的dao映射均重复报此错误,等全部加载失败后,跟着报spring的BeanCreationException,意思跟上面一样,只是形式不一样,但也全部都是在指类重复,如下:

Caused by: org.apache.ibatis.type.TypeException: The alias 'UndersCompanyFile' is already mapped to the value 'com.thinkgem.jeesite.modules.unders.entity.companyfile.UndersCompanyFile'.
	at org.apache.ibatis.type.TypeAliasRegistry.registerAlias(TypeAliasRegistry.java:151)
	at org.apache.ibatis.type.TypeAliasRegistry.registerAlias(TypeAliasRegistry.java:144)
	at org.apache.ibatis.type.TypeAliasRegistry.registerAliases(TypeAliasRegistry.java:133)
	at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:419)
	at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:374)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1631)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1568)
	... 101 more

这两类报错结束后,tomcat停止,启动失败。

大神,求教啊!!!真的急死人了
是不是除了这7个代码生成的文件,还有哪里也需要删除啊?

total 2 participants

Comments (1)

前去 2019-10-17 16:22

D:\idea_workspace\schoolappserver\target\schoolappserver\WEB-INF\classes\spring-context.xml]:Invocation of init method failed; nested exception is org.apache.ibatis.type.TypeException:
请仔细阅读报错信息,7个文件删除没错,还需要删除target文件夹中的打包文件,maven clean即可

Sign in to comment

Assignees
Labels
Not set
Projects
Milestones
Branches
Planed to start
Not set
Planed to end
Not set
Top level
Priority

Help Search