spring mybatis 整合问题Error parsing Mapper XML. Cause: java.lang.NullPointerException

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 bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean 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)

原因:

当配置

<property name="configLocation" value="classpath:mybatis/mybatis-config.xml"></property>

<property name="mapperLocations" value="classpath:mybatis/**/*.xml"></property>

会扫描两遍mybatis-config.xml文件 并没有按照文件夹级别扫描,而是文件也一起扫描了,不知道是不是mybatis的bug.

配置文件更改为

即可

时间: 2024-10-07 10:43:53

spring mybatis 整合问题Error parsing Mapper XML. Cause: java.lang.NullPointerException的相关文章

亲測,Eclipse报&amp;quot;An error has occurred,See error log for more details. java.lang.NullPointerException&amp;quot;

Eclipse报"An error has occurred,See error log for more details. java.lang.NullPointerException", 我先说说我是怎么报这个错的吧,我是想打开Android项目res目录中layout目录里面的.xml布局文件的时候,就会报这个错. 然后我到网上搜索了一下,一般都是那几个答案,有一些答案不行,被骂的狗血淋头,所以我都不敢尝试用网上的方法.仅仅试用了一种"在"開始"--

亲测,Eclipse报&quot;An error has occurred,See error log for more details. java.lang.NullPointerException&quot;

Eclipse报"An error has occurred,See error log for more details. java.lang.NullPointerException", 我先说说我是怎么报这个错的吧,我是想打开Android项目res文件夹中layout文件夹里面的.xml布局文件的时候,就会报这个错. 然后我到网上搜索了一下,一般都是那几个答案,有一些答案不行,被骂的狗血淋头,所以我都不敢尝试用网上的方法.只试用了一种"在"开始"-

an error has occurred. see error log for more details. java.lang.nullpointerexception 问题解决

解决办法:修改项目工作空间. 修改工作空间,以前打开myEclipse时知道怎么改!现在只有找配置文件了! 步骤: MyEclipse 5.1.1 GA----->Eclipse----->configuration------>.settings---->org.eclipse.ui.ide.prefs文件 #Tue Jul 28 09:10:40 CST 2009 RECENT_WORKSPACES_PROTOCOL=2 MAX_RECENT_WORKSPACES=5 SHOW

tomcat部属项目时报错:An internal error occurred during Add Deployment.java.lang.NullPointerException

在tomcat上部部署时报错: An internal error occurred during Add Deployment. java.lang.NullPointerException 查了一下说出现这种错误一般是是因为down的项目与本机的JDK版本不一致所致. 查了一下发现导入的类库报错,删除后重新选择jdk就好了 右键项目名→Properties→Java Build Path→Libraries→选中JRE System Library[Sun JDK 1.5.0.22]→Edi

eclipse报An error has occurred,See error log for more details. java.lang.NullPointerException错误

eclipse报An error has occurred,See error log for more details. java.lang.NullPointerException错误,解决办法: 在"开始"-->"运行"---->"cmd"进入命令提示行后,再进入eclipse安装目录的eclipse文件夹,         然后输入eclipse -clean即可

An error has occurred. See error log for more details. java.lang.NullPointerException

昨天晚上下班eclipse都还好好的,今天早上一上班,eclipse老是弹窗显示An error has occurred. See error log for more details. java.lang.NullPointerException 的错误提示.在网上一搜,说各种情况的都有,但是我看错误提示应该是日志有什么问题.我就把apache-tomcat-8.0.23的logs目录下文件全都删除,问题解决. 具体目录如下:E:\develop_tools\apache-tomcat-8.

An internal error occurred during: &quot;Setup check&quot;. java.lang.NullPointerException

在Eclipse的workspace下有个.metadata文件夹,Eclipse出现异常的log文件就在这个目录下. 最近出现了这样的错误: 查看日志文件发现:     !ENTRY org.eclipse.core.jobs 4 2 2011-08-03 09:33:32.843!MESSAGE An internal error occurred during: "Updating indexes".     !STACK 0Java.lang.OutOfMemoryError:

使用myeclipse tomcat插件部署web项目时报错 an internal error occurred during add deployment . java.lang.nullpointerexception

问题描述: 使用myeclipse10的tomcat插件部署web项目时,首次部署.实际部署到了tomcat/webapps目录下且tomcat启动成功,但是eclipse报错"An internal error occurred during: "Add Deployment"  : 且eclipse中看不到部署的项目.重新部署按钮也无法点击,如图: myeclipse中看不到部署的项目: myeclipse中可以看到部署的项目如下(作为看不到项目的对比): 再次试图部署项

eclipse myeclipse修改工作区间 an error has occurred. see error log for more details. java.lang.nullpointerexception 问题解决

解决办法:修改项目工作空间. 修改工作空间,以前打开myEclipse时知道怎么改!现在只有找配置文件了! 步骤: MyEclipse 5.1.1 GA----->Eclipse----->configuration------>.settings---->org.eclipse.ui.ide.prefs文件 #Tue Jul 28 09:10:40 CST 2009 RECENT_WORKSPACES_PROTOCOL=2 MAX_RECENT_WORKSPACES=5 SHOW