MyBatis Exception: Java.lang.ClassNotFoundException:org.mybatis.spring.SqlSessionFactoryBean

Source: Internet
Author: User

Problem Description:

January 15, 2014 3:43:13 pm Org.springframework.context.support.AbstractApplicationContext Preparerefresh
Info: Refreshing org[email protected]a530461:startup date [Wed Jan 15:43:13 CST 2014]; Root of context Hierarchy
January 15, 2014 3:43:13 pm Org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadbeandefinitions
Info: Loading XML Bean Definitions from class path resource [Spring-mybatis.xml]
January 15, 2014 3:43:14 pm Org.springframework.core.io.support.PropertiesLoaderSupport loadProperties
Information: Loading properties file from class path resource [Config.properties]
January 15, 2014 3:43:14 pm org.springframework.beans.factory.support.DefaultListableBeanFactory preinstantiatesingletons
Information: pre-instantiating singletons in Org.s[email protected]4f430ea5:defining beans [Datasource,sqlsessionfactory, Org.mybatis.spring.mapper.mapperscannerconfigurer#0,transactionmanager, Org.springframework.context.support.propertysourcesplaceholderconfigurer#0,userservice, Org.springframework.context.annotation.internalConfigurationAnnotationProcessor, Org.springframework.context.annotation.internalAutowiredAnnotationProcessor, Org.springframework.context.annotation.internalRequiredAnnotationProcessor, Org.springframework.context.annotation.internalCommonAnnotationProcessor, Org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; Root of Factory hierarchy
Exception in thread "main" Org.springframework.beans.factory.BeanCreationException:Error creating beans with Name ' UserService ': Injection of autowired dependencies failed; Nested exception is org.springframework.beans.factory.BeanCreationException:Could not autowire method:public void Service. Userserviceimpl.setuserinfo (DAO. Userinfomapper); Nested exception is org.springframework.beans.factory.CannotLoadBeanClassException:Cannot find class [ Org.mybatis.spring.SqlSessionFactoryBean] for beans with the name ' Sqlsessionfactory ' defined in class path resource [spring-m Ybatis.xml]; Nested exception isJava.lang.ClassNotFoundException:org.mybatis.spring.SqlSessionFactoryBean
At Org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues ( autowiredannotationbeanpostprocessor.java:287)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean ( abstractautowirecapablebeanfactory.java:1106)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean ( abstractautowirecapablebeanfactory.java:517)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean ( abstractautowirecapablebeanfactory.java:456)
At Org.springframework.beans.factory.support.abstractbeanfactory$1.getobject (abstractbeanfactory.java:294)
At Org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton ( defaultsingletonbeanregistry.java:225)
At Org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (abstractbeanfactory.java:291)
At Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:193)
At Org.springframework.context.support.AbstractApplicationContext.getBean (abstractapplicationcontext.java:1105)
At Test. Newtest.main (newtest.java:15)
caused by:org.springframework.beans.factory.BeanCreationException:Could not autowire method:public void service. Userserviceimpl.setuserinfo (DAO. Userinfomapper); Nested exception is org.springframework.beans.factory.CannotLoadBeanClassException:Cannot find class [ Org.mybatis.spring.SqlSessionFactoryBean] for beans with the name ' Sqlsessionfactory ' defined in class path resource [spring-m Ybatis.xml]; Nested exception is Java.lang.ClassNotFoundException:org.mybatis.spring.SqlSessionFactoryBean
At org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$ Autowiredmethodelement.inject (autowiredannotationbeanpostprocessor.java:600)
At Org.springframework.beans.factory.annotation.InjectionMetadata.inject (injectionmetadata.java:92)
At Org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues ( autowiredannotationbeanpostprocessor.java:284)
... 9 more
caused by:org.springframework.beans.factory.CannotLoadBeanClassException:Cannot Find class [ Org.mybatis.spring.SqlSessionFactoryBean] for beans with the name ' Sqlsessionfactory ' defined in class path resource [spring-m Ybatis.xml]; Nested exception is Java.lang.ClassNotFoundException:org.mybatis.spring.SqlSessionFactoryBean
At Org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass (abstractbeanfactory.java:1262 )
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType ( abstractautowirecapablebeanfactory.java:576)
At Org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean (abstractbeanfactory.java:1331)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType ( defaultlistablebeanfactory.java:337)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType ( defaultlistablebeanfactory.java:316)
At Org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors (Beanfactoryutils.java : 187)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates ( defaultlistablebeanfactory.java:856)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency ( defaultlistablebeanfactory.java:813)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency ( defaultlistablebeanfactory.java:730)
At org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$ Autowiredmethodelement.inject (autowiredannotationbeanpostprocessor.java:558)
... One more
caused By:java.lang.ClassNotFoundException:org.mybatis.spring.SqlSessionFactoryBean
At Java.net.urlclassloader$1.run (urlclassloader.java:366)
At Java.net.urlclassloader$1.run (urlclassloader.java:355)
At java.security.AccessController.doPrivileged (Native Method)
At Java.net.URLClassLoader.findClass (urlclassloader.java:354)
At Java.lang.ClassLoader.loadClass (classloader.java:425)
At Sun.misc.launcher$appclassloader.loadclass (launcher.java:308)
At Java.lang.ClassLoader.loadClass (classloader.java:358)
At Org.springframework.util.ClassUtils.forName (classutils.java:258)
At Org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass ( abstractbeandefinition.java:417)
At Org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass (Abstractbeanfactory.java : 1283)
At Org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass (abstractbeanfactory.java:1254 )
... More

Solution:

  Missing jar Package Mybatis-spring.jar

MyBatis Exception: Java.lang.ClassNotFoundException:org.mybatis.spring.SqlSessionFactoryBean

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.