错误信息如下:
2015-9-4 9:41:01 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [spring] in context with path [/last] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.last.dao.impl.UserDaoIMP.selectUser] with root cause
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.last.dao.impl.UserDaoIMP.selectUser
at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:189)
at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:43)
at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:58)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:51)
at $Proxy6.selectUser(Unknown Source)
at com.last.service.UserService.selectUser(UserService.java:21)
at com.last.controller.LoginController.handleRequest(LoginController.java:27)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:844)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
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:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:957)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2516)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2505)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:619)
UserDaoIMP.xml
代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.last.IMP.UserDaoIMP">
<select id="selectUser" parameterType="com.last.vo.UserVO" resultType="com.last.vo.UserVO">
select * from user where name=#{name} and pwd=#{pwd}
</select>
<insert id="insertUser" parameterType="com.last.vo.UserVO" flushCache="true">
insert into user(name,pwd) values(#{name},#{pwd})
</insert>
<update id="updateUser" parameterType="com.last.vo.UserVO">
update user set name=#{name} where id=#{id}
</update>
<delete id="deleteUser" parameterType="int">
delete from user where id=#{id}
</delete>
</mapper>
UserDaoIMP.java
代码如下:
package com.last.dao.impl;
import com.last.vo.UserVO;
public interface UserDaoIMP {
public UserVO selectUser(UserVO uservo);
public int insertUser(UserVO uservo);
public int updateUser(UserVO uservo);
public int deleteUserById(int id);
}
LoginController.java
代码如下:
package com.last.controller;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
import com.last.service.UserService;
import com.last.vo.UserVO;
public class LoginController implements Controller {
private UserService userService;
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
// TODO Auto-generated method stub
String name=request.getParameter("userName");
String password=request.getParameter("password");
//System.out.println("name-----"+name+"----password-----"+password);
UserVO uservo=new UserVO();
uservo.setName(name);
uservo.setPwd(password);
Map<String, Object> model=new HashMap<String, Object>();
if(userService.selectUser(uservo)!=null){
uservo=userService.selectUser(uservo);
System.out.println("能查到信息");
model.put("uservo", uservo);
return new ModelAndView("WEB-INF/Main.jsp",model);
}else{
System.out.println("查不到信息");
model.put("error", "用户名或密码错误");
return new ModelAndView("WEB-INF/Login.jsp",model);
}
}
public void setUserService(UserService userService) {
this.userService = userService;
}
public UserService getUserService() {
return userService;
}
}
------解决思路----------------------
很明显啊,

错误信息如下:
2015-9-4 9:41:01 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [spring] in context with path [/last] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.last.dao.impl.UserDaoIMP.selectUser] with root cause
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.last.dao.impl.UserDaoIMP.selectUser
中的
com.last.dao.impl.UserDaoIMP和下面xml文件中的
com.last.IMP.UserDaoIMP不一致
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.last.IMP.UserDaoIMP">
<select id="selectUser" parameterType="com.last.vo.UserVO" resultType="com.last.vo.UserVO">
select * from user where name=#{name} and pwd=#{pwd}
</select>
<insert id="insertUser" parameterType="com.last.vo.UserVO" flushCache="true">
insert into user(name,pwd) values(#{name},#{pwd})
</insert>
<update id="updateUser" parameterType="com.last.vo.UserVO">
update user set name=#{name} where id=#{id}
</update>
<delete id="deleteUser" parameterType="int">
delete from user where id=#{id}
</delete>
</mapper>