Spring MyBatis Integration Problem Error parsing Mapper XML. Cause:java.lang.NullPointerException

Source: Internet
Author: User

14:30:40,872 DEBUG sqlsessionfactorybean:431-parsed configuration file: ' Class path resource [mybatis/ Mybatis-config.xml] '
14:30:40,883 WARN Xmlwebapplicationcontext:489-exception encountered during context initialization-cancelling refresh Attempt
Org.springframework.beans.factory.BeanCreationException:Error creating bean with Name ' Org.mybatis.spring.mapper.mapperscannerconfigurer#0 ' defined in file

[E:\IdeaProjects\xgexpress\target\xgexpress\WEB-INF\classes\spring\spring-context.xml]: Initialization of beans Failed Nested exception is org.springframework.beans.factory.BeanCreationException:Error creating beans with Name ' Sqlsessionfactory ' defined in file

[E:\IdeaProjects\xgexpress\target\xgexpress\WEB-INF\classes\spring\spring-context.xml]: Invocation of Init method Failed Nested exception is org.springframework.core.NestedIOException:Failed to parse mapping resource:

' File [E:\IdeaProjects\xgexpress\target\xgexpress\WEB-INF\classes\mybatis\mybatis-config.xml] ';

Nested exception is Org.apache.ibatis.builder.BuilderException:Error parsing Mapper XML. Cause:java.lang.NullPointerException
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.

Docreatebean (abstractautowirecapablebeanfactory.java:547)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean ( abstractautowirecapablebeanfactory.java:475)
At Org.springframework.beans.factory.support.AbstractBeanFactory1.getObject (abstractbeanfactory.java:302)
At Org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton ( defaultsingletonbeanregistry.java:228)
At Org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (abstractbeanfactory.java:298)
At Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:198)
At Org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors ( postprocessorregistrationdelegate.java:116)
At Org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors ( abstractapplicationcontext.java:611)
At Org.springframework.context.support.AbstractApplicationContext.refresh (abstractapplicationcontext.java:464)
At Org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext (Contextloader.java : 403)
At Org.springframework.web.context.ContextLoader.initWebApplicationContext (contextloader.java:306)
At Org.springframework.web.context.ContextLoaderListener.contextInitialized (contextloaderlistener.java:106)
At Org.apache.catalina.core.StandardContext.listenerStart (standardcontext.java:4973)
At Org.apache.catalina.core.StandardContext.startInternal (standardcontext.java:5467)
At Org.apache.catalina.util.LifecycleBase.start (lifecyclebase.java:150)
At Org.apache.catalina.core.ContainerBase.addChildInternal (containerbase.java:901)
At Org.apache.catalina.core.ContainerBase.addChild (containerbase.java:877)
At Org.apache.catalina.core.StandardHost.addChild (standardhost.java:632)
At ORG.APACHE.CATALINA.STARTUP.HOSTCONFIG.MANAGEAPP (hostconfig.java:1763)
At Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
At Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:57)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43)
At Java.lang.reflect.Method.invoke (method.java:606)
At Org.apache.tomcat.util.modeler.BaseModelMBean.invoke (basemodelmbean.java:301)
At Com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke (defaultmbeanserverinterceptor.java:819)
At Com.sun.jmx.mbeanserver.JmxMBeanServer.invoke (jmxmbeanserver.java:801)
At Org.apache.catalina.mbeans.MBeanFactory.createStandardContext (mbeanfactory.java:618)
At Org.apache.catalina.mbeans.MBeanFactory.createStandardContext (mbeanfactory.java:565)
At Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
At Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:57)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43)
At Java.lang.reflect.Method.invoke (method.java:606)
At Org.apache.tomcat.util.modeler.BaseModelMBean.invoke (basemodelmbean.java:301)
At Com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke (defaultmbeanserverinterceptor.java:819)
At Com.sun.jmx.mbeanserver.JmxMBeanServer.invoke (jmxmbeanserver.java:801)
At Javax.management.remote.rmi.RMIConnectionImpl.doOperation (rmiconnectionimpl.java:1487)
At javax.management.remote.rmi.RMIConnectionImpl.access300 (rmiconnectionimpl.java:97)
At Javax.management.remote.rmi.RMIConnectionImplPrivilegedOperation.run (rmiconnectionimpl.java:1328)
At Javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation (rmiconnectionimpl.java:1420)
At Javax.management.remote.rmi.RMIConnectionImpl.invoke (rmiconnectionimpl.java:848)
At Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
At Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:57)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43)
At Java.lang.reflect.Method.invoke (method.java:606)
At Sun.rmi.server.UnicastServerRef.dispatch (unicastserverref.java:322)
At Sun.rmi.transport.Transport1.run (transport.java:177)
At Sun.rmi.transport.Transport1.run (transport.java:174)
At java.security.AccessController.doPrivileged (Native Method)
At Sun.rmi.transport.Transport.serviceCall (transport.java:173)
At Sun.rmi.transport.tcp.TCPTransport.handleMessages (tcptransport.java:556)
At Sun.rmi.transport.tcp.TCPTransportConnectionHandler.run0 (tcptransport.java:811)
At Sun.rmi.transport.tcp.TCPTransportConnectionHandler.run (tcptransport.java:670)
At Java.util.concurrent.ThreadPoolExecutor.runWorker (threadpoolexecutor.java:1145)
At Java.util.concurrent.ThreadPoolExecutorWorker.run (threadpoolexecutor.java:615)
At Java.lang.Thread.run (thread.java:745)

Reason:

When configuring

  <property  name= "Configlocation" value= "Classpath:mybatis/mybatis-config.xml"  ></ Property ;           

<property name= " Mapperlocations "value = "Classpath:mybatis/**/*.xml" ></property ;

Scan two times the Mybatis-config.xml file was not scanned at the folder level, but the file was scanned together, not knowing if it was a mybatis bug.

The configuration file changes to

Can

Spring MyBatis Integration Problem Error parsing Mapper XML. Cause:java.lang.NullPointerException

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.