怎么报错了

来源:4-1 动态 SQL 拼接(上)

qq_柒分醉_03927370

2017-05-24 17:00

五月 24, 2017 4:58:46 下午 org.apache.catalina.core.AprLifecycleListener init

信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_92\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.8.0_92/bin/server;C:/Program Files/Java/jre1.8.0_92/bin;C:/Program Files/Java/jre1.8.0_92/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Java\jdk1.7.0_75\bin:C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\mysql\bin;D:\maven\apache-maven-3.5.0\bin;D:\maven\bin;;D:\用户目录\我的文档\Tencent Files\939950390\FileRecv\eclipse-jee-kepler-R-win32-x86_64\eclipse;;.

五月 24, 2017 4:58:46 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin

警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:MicroMessage' did not find a matching property.

五月 24, 2017 4:58:46 下午 org.apache.coyote.AbstractProtocol init

信息: Initializing ProtocolHandler ["http-bio-8080"]

五月 24, 2017 4:58:46 下午 org.apache.coyote.AbstractProtocol init

信息: Initializing ProtocolHandler ["ajp-bio-8009"]

五月 24, 2017 4:58:46 下午 org.apache.catalina.startup.Catalina load

信息: Initialization processed in 778 ms

五月 24, 2017 4:58:46 下午 org.apache.catalina.core.StandardService startInternal

信息: Starting service Catalina

五月 24, 2017 4:58:46 下午 org.apache.catalina.core.StandardEngine startInternal

信息: Starting Servlet Engine: Apache Tomcat/7.0.53

五月 24, 2017 4:58:47 下午 org.apache.catalina.util.SessionIdGenerator createSecureRandom

信息: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [778] milliseconds.

五月 24, 2017 4:58:48 下午 org.apache.coyote.AbstractProtocol start

信息: Starting ProtocolHandler ["http-bio-8080"]

五月 24, 2017 4:58:48 下午 org.apache.coyote.AbstractProtocol start

信息: Starting ProtocolHandler ["ajp-bio-8009"]

五月 24, 2017 4:58:48 下午 org.apache.catalina.startup.Catalina start

信息: Server startup in 2031 ms

五月 24, 2017 4:58:54 下午 org.apache.catalina.core.StandardWrapperValve invoke

严重: Servlet.service() for servlet [ListServlet] in context with path [/MicroMessage] threw exception

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 class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias ' com.imooc.bean.Message'.  Cause: java.lang.ClassNotFoundException: Cannot find class:  com.imooc.bean.Message

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)

at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:54)

at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:38)

at com.imooc.db.DBAccess.getSqlSession(DBAccess.java:20)

at com.imooc.dao.MessageDao.queryMessageList(MessageDao.java:23)

at com.imooc.service.ListService.queryMessageList(ListService.java:14)

at com.imooc.servlet.ListServlet.doGet(ListServlet.java:35)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)

at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

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 class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias ' com.imooc.bean.Message'.  Cause: java.lang.ClassNotFoundException: Cannot find class:  com.imooc.bean.Message

at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:118)

at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:96)

at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:52)

... 26 more

Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias ' com.imooc.bean.Message'.  Cause: java.lang.ClassNotFoundException: Cannot find class:  com.imooc.bean.Message

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:360)

at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:116)

... 28 more

Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias ' com.imooc.bean.Message'.  Cause: java.lang.ClassNotFoundException: Cannot find class:  com.imooc.bean.Message

at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:118)

at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:265)

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)

... 31 more

Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias ' com.imooc.bean.Message'.  Cause: java.lang.ClassNotFoundException: Cannot find class:  com.imooc.bean.Message

at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:120)

at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:149)

at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:116)

... 35 more

Caused by: java.lang.ClassNotFoundException: Cannot find class:  com.imooc.bean.Message

at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:200)

at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:89)

at org.apache.ibatis.io.Resources.classForName(Resources.java:261)

at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:116)

... 37 more


写回答 关注

5回答

  • qq_頖縌乖乄絯_04017281
    2017-06-20 16:37:33

    command!=null &&!""   .   equals(command.trim(),少了方法的 . 

  • 慕仰7666017
    2017-06-05 08:37:45

    我也遇到相同问题,没找到错误。不知道怎么回事,求前辈解答

    qq_頖縌乖...

    如果加载了,和楼主一样的问题是因为少了点

    2017-06-20 16:37:16

    共 2 条回复 >

  • qq_永2B青年是wo_0
    2017-05-26 11:36:59

    那就不清楚了,按照提示再找找吧

  • qq_柒分醉_03927370
    2017-05-24 22:45:46

    <?xml version="1.0" encoding="UTF-8"?>

    <!--


           Copyright 2009-2012 the original author or authors.


           Licensed under the Apache License, Version 2.0 (the "License");

           you may not use this file except in compliance with the License.

           You may obtain a copy of the License at


              http://www.apache.org/licenses/LICENSE-2.0


           Unless required by applicable law or agreed to in writing, software

           distributed under the License is distributed on an "AS IS" BASIS,

           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

           See the License for the specific language governing permissions and

           limitations under the License.


    -->


    <!DOCTYPE mapper

        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"

        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">


    <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 WHERE 1= 1 

      <if test="command!=null &amp;&amp;!&quot;&quot;equals(command.trim())">

      and COMMAND = #{command} 

      </if>

      <if test="description!=null &amp;&amp;!&quot;&quot;equals(description.trim())">

      and DESCRIPTION like '%'  #{description}  '%'

      </if>

      </select>


    </mapper>


  • qq_永2B青年是wo_0
    2017-05-24 22:32:48

    The error may exist in com/imooc/config/sqlxml/Message.xml
    The error occurred while processing mapper_resultMap[MessageResult]
    Error parsing SQL Mapper Configuration======> Error parsing Mapper XML.
    =======>Error resolving class========>Could not resolve type alias ' com.imooc.bean.Message'.
    =======>  Cannot find class:  com.imooc.bean.Message

    qq_柒分醉...

    message.xml已贴出,没看出哪有错误

    2017-05-24 22:46:50

    共 1 条回复 >

通过自动回复机器人学Mybatis---基础版

微信公众号自动回复功能学习Mybatis,基础教程加案例实战方式学习

107412 学习 · 786 问题

查看课程

相似问题