org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory'

spring整合mybatis的时候,传统dao模式test报错

发现是在pojo类user对应的user.xml中配置路径写错了

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [SqlMapConfig.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: 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 'queryvo'.  Cause: java.lang.ClassNotFoundException: Cannot find class: queryvo

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:753)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    at cn.edu.zju.mybatis.dao.impl.UserDaoImplTest.setUp(UserDaoImplTest.java:25)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [SqlMapConfig.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: 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 'queryvo'.  Cause: java.lang.ClassNotFoundException: Cannot find class: queryvo
    at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:434)
    at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:340)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
    ... 34 more
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: 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 'queryvo'.  Cause: java.lang.ClassNotFoundException: Cannot find class: queryvo
    at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:109)
    at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:92)
    at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:428)
    ... 37 more
Caused by: 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 'queryvo'.  Cause: java.lang.ClassNotFoundException: Cannot find class: queryvo
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:120)
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
    at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:322)
    at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107)
    ... 39 more
Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'queryvo'.  Cause: java.lang.ClassNotFoundException: Cannot find class: queryvo
    at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:103)
    at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:66)
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:135)
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:128)
    at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:118)
    ... 42 more
Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'queryvo'.  Cause: java.lang.ClassNotFoundException: Cannot find class: queryvo
    at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:117)
    at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:130)
    at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:101)
    ... 46 more
Caused by: java.lang.ClassNotFoundException: Cannot find class: queryvo
    at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:190)
    at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:89)
    at org.apache.ibatis.io.Resources.classForName(Resources.java:256)
    at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:113)
    ... 48 more

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory'

原文地址:https://www.cnblogs.com/richardwlee/p/10464278.html

时间: 2024-10-27 08:39:22

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory'的相关文章

org.springframework.beans.factory.BeanCreationException: Error creating bean with name

这个问题在别人电脑上面没有出现,但我的电脑就出现了,在网上找各种解决方法:有的说是asm.jar冲突,有的说要配置byName,有的说是路径问题但路径明显是正确的. 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.B

【报错】org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;webSocketHandlerMapping&#39; defined in class path resource

环境:maven+eclipse+jdk1.8 [tomcat使用的是maven自带的插件,实质原因就是出在tomcat版本问题] 背景:在进行SSM集成WebSocket的时候,项目启动报org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webSocketHandlerMapping' defined in class path resource错误,详细如下 org.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;org.mybatis.spring.mapper.MapperScannerConfigurer#0&#39; defined in class path resource

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mybatis.spring.mapper.MapperScannerConfigurer#0' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exc

错误/异常:org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;sessionFactory&#39; defined in ServletContext resource [/WEB-INF/classes/beans_common.xml]...的解决方法

1.异常/错误视图 错误/异常描述:sessionFactory 初始化失败. 说明:我用的是SSH框架.JDK-1.8:Tomcat-7.0 我用到的jar包: 2.解决方法 我 出现在这个问题的原因是:jar包的问题(应该是冲突),我删除了hibernate-core-4.1.12.Final.jar这个jar包,问题就解决了. 其他原因: 1.保证jar包没有问题的情况下,还出现这个问题,那么就是你的Spring配置文件配置错了,请仔细检查,改回来即可. 2.保证jar包没有问题,Spri

org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;jpaMappingContext之解决办法

错误产生背景:将之前用Eclipse写的Blog项目迁移到Idea上面.Ecilpse项目一直是没有问题的. 错误原因分析:原因是项目依赖中引入的jpa,另外也与Idea比较智能也有关系 解决办法: 第一,在启动类中加上如下注解代码 @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class,JpaRepositoriesAutoConfiguration.class,HibernateJpaAutoConfigurat

spring测试出错:Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0&#39;:

解决办法 这里找不到根路径,也就找不到Spring-config.xml的配置,所以加上更改根路径的注解@WebAppConfiguration(“src/main/resources”)就解决了 1 @RunWith(SpringJUnit4ClassRunner.class) 2 @WebAppConfiguration("src/main/resources") //加上这个注解完美解决 3 @ContextConfiguration(locations = {"cla

【实战问题】【14】org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name &#39;xxMapper&#39;

问题: SpringBoot启动时报错: Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException:Error creating bean with name 'userDaoMapper' defined in file [E:\WebProject\... 解决方案: pom.xml文件引入了两个Mybatis依赖包.一个是整合SpringBoot的,一个是整合Spring的jar包.两个一

Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException:

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'daoSupport': Injection of resou

Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field

1 错误描述 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.sc.oa.test.timer.dao.TimerDaoTest': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationExcep