Mabatis_配置中出现的error

1. 不区分大小写

<mapper namespace="Message">

<resultMap type="com.imooc.bean.Message" id="MessageResult">
    <id column="id" jdbcType="INTEGER" property="id"/>
    <result column="COMMAND" jdbcType="VARCHAR" property="command"/>
    <result column="DESCRIPTION" jdbcType="VARCHAR" property="description"/>
    <result column="CONTENT" jdbcType="VARCHAR" property="content"/>
  </resultMap>

<select id="queryMessageList" parameterType="com.imooc.bean.Message" resultMap="MessageResult">
    select ID,COMMAND,DESCRIPTION,CONTENT from MESSAGE
  </select>
</mapper>

2017-05-17 11:25:34,859 [main] DEBUG [Message.queryMessageList] - ==>  Preparing: select ID,COMMAND,DESCRIPTION,CONTENT from MESSAGE
2017-05-17 11:25:34,892 [main] DEBUG [Message.queryMessageList] - ==> Parameters:
2017-05-17 11:25:34,917 [main] DEBUG [Message.queryMessageList] - <==      Total: 5
Message [id=1, command=查看, description=精彩内容, content=精彩内容]
Message [id=2, command=段子, description=精彩段子, content=如果你的月薪是3000块钱,请记得分成五份,一份用来买书,一份给家人,一份给女朋友买化妆品和衣服,一份请朋友们吃饭,一份作为同事的各种婚丧嫁娶的份子钱。剩下的2999块钱藏起来,不要告诉任何人]
Message [id=3, command=新闻, description=今日头条, content=7月17日,马来西亚一架载有298人的777客机在乌克兰靠近俄罗斯边界坠毁。另据国际文传电讯社消息,坠毁机型为一架波音777客机,机载约280名乘客和15个机组人员。
乌克兰空管部门随后证实马航MH17航班坠毁。乌克兰内政部幕僚表示,这一航班在顿涅茨克地区上空被击落。马来西亚航空公司确认,该公司从阿姆斯特丹飞往吉隆坡的MH17航班失联,并称最后与该客机取得联系的地点在乌克兰上空。图为马航客机坠毁现场。]
Message [id=4, command=娱乐, description=娱乐新闻, content=昨日,邓超在微博分享了自己和孙俪的书法。夫妻同样写幸福,但差距很大。邓超自己都忍不住感慨字丑:左边媳妇写的。右边是我写的。看完我再也不幸福了。]
Message [id=6, command=彩票, description=中奖号码, content=查啥呀查,你不会中奖的!]

2. jdbcType打错了

<mapper namespace="Message">

<resultMap type="com.imooc.bean.Message" id="MessageResult">
    <id column="id" jdbcType="INTEGER" property="id"/>
    <result column="COMMAND" jdbcType="VARCHAR" property="command"/>
    <result column="DESCRIPTION" jdbcType="VARCHAR" property="description"/>
    <result column="CONTENT" jdbcType="VARCHER" property="content"/>
  </resultMap>

<select id="queryMessageList" parameterType="com.imooc.bean.Message" resultMap="MessageResult">
    select ID,COMMAND,DESCRIPTION,CONTENT from MESSAGE
  </select>
</mapper>

Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:
### Error building SqlSession.
### The error may exist in com/imooc/config/sqlxml/Message.xml
### The error occurred while processing mapper_resultMap[MessageResult]
### Cause: 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 JdbcType. Cause: java.lang.IllegalArgumentException: No enum constant org.apache.ibatis.type.JdbcType.VARCHER
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:52)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:36)
	at com.imooc.DB.DBAccess.getSqlSession(DBAccess.java:17)
	at com.imooc.Dao.MessageDao.query(MessageDao.java:28)
	at com.imooc.Dao.MessageDao.main(MessageDao.java:15)
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 JdbcType. Cause: java.lang.IllegalArgumentException: No enum constant org.apache.ibatis.type.JdbcType.VARCHER
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:120)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:98)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:50)
	... 4 more
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving JdbcType. Cause: java.lang.IllegalArgumentException: No enum constant org.apache.ibatis.type.JdbcType.VARCHER
	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:369)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:118)
	... 6 more
Caused by: org.apache.ibatis.builder.BuilderException: Error resolving JdbcType. Cause: java.lang.IllegalArgumentException: No enum constant org.apache.ibatis.type.JdbcType.VARCHER
	at org.apache.ibatis.builder.BaseBuilder.resolveJdbcType(BaseBuilder.java:73)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildResultMappingFromContext(XMLMapperBuilder.java:382)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:280)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:252)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:244)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:116)
	... 9 more
Caused by: java.lang.IllegalArgumentException: No enum constant org.apache.ibatis.type.JdbcType.VARCHER
	at java.lang.Enum.valueOf(Enum.java:238)
	at org.apache.ibatis.type.JdbcType.valueOf(JdbcType.java:25)
	at org.apache.ibatis.builder.BaseBuilder.resolveJdbcType(BaseBuilder.java:71)
	... 14 more

3.mapper的SQL ID写错了

public static  List<Message> query() {
        DBAccess dbaccess = new DBAccess();
        List<Message> messageList = new ArrayList<Message>();
        SqlSession session =null;
        try {
            Message m =new Message();
            session = dbaccess.getSqlSession();
            messageList = session.selectList("Message.queryMessageList",m);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } finally{
            if(session != null){
                session.close();
            }
        }
        if (messageList == null) System.out.println("message is null");
        return messageList;
        
    }

  <select id="MessageList" parameterType="com.imooc.bean.Message" resultMap="MessageResult">
    select ID,COMMAND,DESCRIPTION,CONTENT from MESSAGE
  </select>
Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for Message.queryMessageList
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for Message.queryMessageList
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
	at com.imooc.Dao.MessageDao.query(MessageDao.java:29)
	at com.imooc.Dao.MessageDao.main(MessageDao.java:15)
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for Message.queryMessageList
	at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:875)
	at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:708)
	at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:701)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
	... 3 more
时间: 2024-10-08 13:56:21

Mabatis_配置中出现的error的相关文章

【翻译自mos文章】在使用Linux大页内存的配置中,使用drop_cache时导致的ORA-600 [KGHLKREM1]问题

在使用Linux大页内存的配置中,使用drop_cache时导致的ORA-600 [KGHLKREM1]问题 来源于: ORA-600 [KGHLKREM1] On Linux Using Parameter drop_cache On hugepages Configuration (文档 ID 1070812.1) 适用于: Oracle Database - Enterprise Edition - Version 10.2.0.1 and later Generic Linux ***C

Hbase配置中出现的问题总结

在create table的时候出现如下问题 1. ERROR: java.io.IOException: Table Namespace Manager not ready yet, try again later 解决方案:这个问题是从单机配置到多机配置的时候出的问题,修改conf/hbase-env.sh 注释掉export HBASE_MANAGES_ZK=true 2. java.net.SocketTimeoutException: Call to datanode1/172.16.

Redis主从配置异常解决:Error condition on socket for SYNC: Connection refused

Redis主从配置异常解决:Error condition on socket for SYNC: Connection refused 在docker中搭建的redis主从集群时,从服务器上的redis日志报错: 32677:S 08 Feb 16:14:38.947 * Connecting to MASTER 172.168.10.70:6379 32677:S 08 Feb 16:14:38.948 * MASTER <-> SLAVE sync started 32677:S 08

Apollo配置中心源码分析

Apollo配置中心源码分析 1. apollo的核心代码分享 SpringApplication启动的关键步骤 在SpringApplication中,会加载所有实现了Init方法的类 protected void applyInitializers(ConfigurableApplicationContext context) { for (ApplicationContextInitializer initializer : getInitializers()) { Class<?> r

maven中mvn-v出现Error: JAVA_HOME not found in your environment. Please set the JAVA_HOME var

maven命令中mvn-v出现Error: JAVA_HOME not found in your environment. Please set the JAVA_HOME var遇到这样的问题,上网查了很多方法,各种各样的解决方法,反正都没有解决到我的问题.最后,暴力式解决:一顿操作猛如虎,管他是否250. 然后...解决了..... 解决方法: 之前配置Java环境变量的时候,只是配置到Java_HOME就停止了,反正就能用了,JRE_HOME的,CLASSPATH的全是没有配置. 将这些

modelsim中,错误 Error: already declared in this scope ()

仿真软件modelsim中,错误 Error: already declared in this scope () 在定义这个信号前其它模块接口信号中调用了这个信号,modelsim仿真报错,通过把信号定义挪到调用模块前面问题解决. 可能是modelsim有要求,在块里边出现之前,必须先做声明.modelsim中,错误 Error: already declared in this scope (),布布扣,bubuko.com

web.xml的配置中&lt;context-param&gt;配置作用

<context-param>的作用: web.xml的配置中<context-param>配置作用1. 启动一个WEB项目的时候,容器(如:Tomcat)会去读它的配置文件web.xml.读两个节点: <listener></listener> 和 <context-param></context-param> 2.紧接着,容器创建一个ServletContext(上下文),这个WEB项目所有部分都将共享这个上下文. 3.容器将&l

nginx location在配置中的优先级

location表达式类型 ~     表示执行一个正则匹配,区分大小写 ~*    表示执行一个正则匹配,不区分大小写 ^~    表示普通字符匹配.使用前缀匹配.如果匹配成功,则不再匹配其他location. =     进行普通字符精确匹配.也就是完全匹配. @     “@” 定义一个命名的 location,使用在内部定向时,例如 error_page, try_files location优先级说明 在nginx的location和配置中location的顺序没有太大关系.正loca

Action 名称搜索顺序&amp;Action配置中的各项默认值

Action 名称的搜索顺序  一级一级往上,若命名空间包存在,但Action不存在,则跑到默认命名空间. Action 配置中的各项默认值    默认类class:ActionSupport    默认方法method:action的 execute    默认result name :success