帮助别人就是帮助自己! 如果这里解决了您的问题,请您点一下推荐

MyBatis:XML fragments parsed from previous mappers does not contain value for

我用MBG1.3.1反映射出*Mapper.xml、*Mapper.java、*.java、*Example.java四个文件,*代表我映射的数据库名,在我调用MyBatis最新的借口注入方法实现CRUD的时候,项目报错了,上网找不到这错误的来源,个人尝试了很多方式都无法解决,所以希望大家帮下忙,小弟感谢不尽。
  以下是他报错的代码:java.lang.IllegalArgumentException: XML fragments parsed from previous mappers does not contain value for com.yi.mapper.TestMapper.Base_Column_List
  org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:593)
  org.apache.ibatis.builder.xml.XMLStatementBuilder$IncludeNodeHandler.handleNode(XMLStatementBuilder.java:155)
  org.apache.ibatis.builder.xml.XMLStatementBuilder.parseDynamicTags(XMLStatementBuilder.java:85)
  org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:43)
  org.apache.ibatis.session.Configuration.parseStatementNodes(Configuration.java:513)
  org.apache.ibatis.session.Configuration.buildStatementsForNamespace(Configuration.java:502)
  org.apache.ibatis.session.Configuration.buildStatementsFromId(Configuration.java:467)
  org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:391)
  org.apache.ibatis.binding.MapperMethod.setupCommandType(MapperMethod.java:160)
  org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:48)
  org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:37)
  $Proxy8.insert(Unknown Source)
  com.yi.dao.impl.BaseDaoImpl.insert(BaseDaoImpl.java:36)
  com.yi.service.TestService.insert(TestService.java:34)
  com.yi.service.TestService$$FastClassByCGLIB$$50374319.invoke(<generated>)
  net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
  org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
  org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
  org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
  org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
  com.yi.service.TestService$$EnhancerByCGLIB$$dd23696.insert(<generated>)
  com.yi.action.TestAction.insert(TestAction.java:41)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  java.lang.reflect.Method.invoke(Method.java:597)
  com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440)
  com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279)
  com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)
  com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)
  com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
  com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
  com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249)
  org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
  com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
  com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
  com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
  com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
  com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
  com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
  com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
  com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
  com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
  com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
  com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148)
  com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
  org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93)
  com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
  org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
  com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
  com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
  com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
  com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128)
  com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
  org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)
  com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
  org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
  com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
  com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
  com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
  com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
  com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
  com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
  com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148)
  com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
  org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
  com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
  com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128)
  com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
  com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
  com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
  org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
  org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)
  org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
  org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)
  org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)



根据它报错的位置,我找到了*Mapper.xml代码报错的位置:Java code<sql id="Base_Column_List" >
  <!--
  WARNING - @mbggenerated
  This element is automatically generated by MyBatis Generator, do not modify.
  This element was generated on Wed Jun 29 17:57:35 CST 2011.
  -->
  id, name
  </sql>

但看不出有什么异样
Java code
这就是我BaseDaoImpl.java:36的代码, return session.getMapper(TestMapper.class).insert(record); 错误的原因不是这里,而是在xml文件里面,但我不知道他是怎么错
Java Web 5 次浏览 2011-06-30 23:10

5 个回答

在线=回答
2011-06-30 23:16 推荐: 0 次
求解答啊
2011-06-30 23:34 推荐: 0 次
你会这个吗?http://topic.csdn.net/u/20110630/15/f46fc7b1-30ec-452e-9eaf-e8d33ac0d6cf.html?seed=154935100&r=74137322#r_74137322
2011-06-30 23:38 推荐: 0 次
这个好像是MyBatis3的BUG吧!我查了下源码,Configuration类中,只有getSqlFragments()方法,没有set方法。所以服务启动加载时,sqlFragments还是默认的值。希望你找到解决的方法。
2011-08-30 23:39 推荐: 0 次
帮lz顶一下。
2011-08-30 23:49 推荐: 0 次