辛勤的小袁袁 2017-09-24 14:03 采纳率: 0%
浏览 3631

spring 整合mybatis 出错,求解决

2017-09-24 21:59:58 [DEBUG] - Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
2017-09-24 21:59:58 [DEBUG] - Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0'
2017-09-24 21:59:58 [DEBUG] - Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter.
2017-09-24 21:59:58 [DEBUG] - Eagerly caching bean 'sqlSessionFactory' to allow for resolving potential circular references
2017-09-24 21:59:58 [DEBUG] - Returning cached instance of singleton bean 'dataSource'
2017-09-24 21:59:58 [DEBUG] - Resolved classpath location [mapper/] to resources [URL [file:/H:/Project/apache-tomcat-8.0.32-windows-x64/apache-tomcat-8.0.32/webapps/wisdomrest/WEB-INF/classes/mapper/]]
2017-09-24 21:59:58 [DEBUG] - Looking for matching resources in directory tree [H:\Project\apache-tomcat-8.0.32-windows-x64\apache-tomcat-8.0.32\webapps\wisdomrest\WEB-INF\classes\mapper]
2017-09-24 21:59:58 [DEBUG] - Searching directory [H:\Project\apache-tomcat-8.0.32-windows-x64\apache-tomcat-8.0.32\webapps\wisdomrest\WEB-INF\classes\mapper] for files matching pattern [H:/Project/apache-tomcat-8.0.32-windows-x64/apache-tomcat-8.0.32/webapps/wisdomrest/WEB-INF/classes/mapper/**/*Mapper.xml]
2017-09-24 21:59:58 [DEBUG] - Searching directory [H:\Project\apache-tomcat-8.0.32-windows-x64\apache-tomcat-8.0.32\webapps\wisdomrest\WEB-INF\classes\mapper\menu] for files matching pattern [H:/Project/apache-tomcat-8.0.32-windows-x64/apache-tomcat-8.0.32/webapps/wisdomrest/WEB-INF/classes/mapper/**/*Mapper.xml]
2017-09-24 21:59:58 [DEBUG] - Resolved location pattern [classpath*:mapper/**/*Mapper.xml] to resources [file [H:\Project\apache-tomcat-8.0.32-windows-x64\apache-tomcat-8.0.32\webapps\wisdomrest\WEB-INF\classes\mapper\menu\menuMapper.xml]]
2017-09-24 21:59:58 [DEBUG] - Invoking afterPropertiesSet() on bean with name 'sqlSessionFactory'
2017-09-24 21:59:58 [DEBUG] - Parsed configuration file: 'class path resource [config/mybatis-config.xml]'
2017-09-24 21:59:58 [WARN] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring/applicationContext-db.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [H:\Project\apache-tomcat-8.0.32-windows-x64\apache-tomcat-8.0.32\webapps\wisdomrest\WEB-INF\classes\mapper\menu\menuMapper.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 'com.wisdom.menu.model.Menu'. Cause: java.lang.ClassNotFoundException: Cannot find class: com.wisdom.menu.model.Menu
2017-09-24 21:59:58 [DEBUG] - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@4719ac62: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,propertiesConfiguration,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,dataSource,sqlSessionFactory,org.mybatis.spring.mapper.MapperScannerConfigurer#0,sqlSessionTemplate,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.config.internalTransactionalEventListenerFactory,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,transactionManager,txAdvice,serviceMethods,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor]; root of factory hierarchy
2017-09-24 21:59:58 [DEBUG] - Invoking destroy method 'close' on bean with name 'dataSource'
2017-09-24 21:59:58 [DEBUG] - MBean: com.mchange.v2.c3p0:type=PooledDataSource,identityToken=1b617js9q1dzucff1r9hwem|5af7da9,name=1b617js9q1dzucff1r9hwem|5af7da9 unregistered.
2017-09-24 21:59:58 [DEBUG] - C3P0Registry mbean unregistered.
2017-09-24 21:59:58 [ERROR] - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring/applicationContext-db.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [H:\Project\apache-tomcat-8.0.32-windows-x64\apache-tomcat-8.0.32\webapps\wisdomrest\WEB-INF\classes\mapper\menu\menuMapper.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 'com.wisdom.menu.model.Menu'. Cause: java.lang.ClassNotFoundException: Cannot find class: com.wisdom.menu.model.Menu
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:753) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444) ~[spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326) ~[spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) [spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812) [catalina.jar:8.0.32]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255) [catalina.jar:8.0.32]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) [catalina.jar:8.0.32]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) [catalina.jar:8.0.32]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) [catalina.jar:8.0.32]
at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_74]
at java.lang.Thread.run(Unknown Source) [na:1.8.0_74]

  • 写回答

3条回答

  • 「已注销」 2017-09-25 00:57
    关注

    无法找到你的menu类,在你的menuMapper.xml里。检查一下你的menuMapper是不是有什么地方写的不对。(报错信息: Could not resolve type alias 'com.wisdom.menu.model.Menu'. Cause: java.lang.ClassNotFoundException: Cannot find class: com.wisdom.menu.model.Menu)

    评论

报告相同问题?

悬赏问题

  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler