猿问
下载APP

使用MyBatis工具类openSession()方法,junit通过,在tomcat执行报错

junit没问题
@Test
public void testGetList(){
    SqlSession sqlSession=null;
    List<User> list=new ArrayList<User>();
    try{
        sqlSession=MyBatisUtil.openSession();
        list=sqlSession.selectList("demo.selectList");
        System.out.println(list);
    }catch (Exception e){
        e.printStackTrace();
    }finally {
        MyBatisUtil.closeSession(sqlSession);
    }
    System.out.println(list);
}
tomcat执行报错
public List<User> getList() {
    SqlSession sqlSession=null;
    List<User> list=new ArrayList<User>();
    try{
        sqlSession=MyBatisUtil.openSession();
        list=sqlSession.selectList("demo.selectList");
        System.out.println(list);
    }catch (Exception e){
        e.printStackTrace();
    }finally {
        MyBatisUtil.closeSession(sqlSession);
    }
    return list;
}
HTTP Status 500 – Internal Server Error
Type 异常报告
消息 Servlet execution threw an exception
描述 服务器遇到一个意外的情况,阻止它完成请求。
Exception
javax.servlet.ServletException: Servlet execution threw an exception
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Root Cause
java.lang.NoClassDefFoundError: Could not initialize class com.imooc.util.MyBatisUtil
com.imooc.dao.UserDao.getList(UserDao.java:55)
com.imooc.servlet.MainServlet.doGet(MainServlet.java:23)
javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Note 主要问题的全部 stack 信息可以在 server logs 里查看
Apache Tomcat/8.5.46


慕后端2248651
浏览 982回答 1
1回答

慕姐4199709

https://mip.xiangha.com/so?t=caipu&s=%E6%B2%99%E9%B9%B0%E6%9C%89%E6%95%88%E5%B0%84%E7%A8%8B%E3%80%9094OO%2B3O11%3BQ%E3%80%91r1qhttps://mip.xiangha.com/so?t=caipu&s=%E5%8D%95%E6%89%8B%E6%B2%99%E9%B9%B0%E3%80%9094OO%2B3O11%3BQ%E3%80%91qQ1https://mip.xiangha.com/so?t=caipu&s=%E6%B1%BD%E6%9E%AA500%E5%85%83%E5%B7%A6%E5%8F%B3%E4%B8%89%E6%9E%AA%E7%89%8C%E6%B1%BD%E6%9E%AA650%E5%85%83%E3%80%9094OO%2B3O11%3BQ%E3%80%91vBEhttps://mip.xiangha.com/so?t=caipu&s=%E4%B8%89%E6%9E%AA%E7%89%8C%E6%B1%BD%E6%9E%AA%E3%80%9094OO%2B3O11%3BQ%E3%80%91a6ohttps://mip.xiangha.com/so?t=caipu&s=%E5%B9%BF%E5%B7%9E%E4%B8%89%E6%9E%AA%E7%89%8C%E6%B1%BD%E6%9E%AA%E3%80%9094OO%2B3O11%3BQ%E3%80%91Kt0https://mip.xiangha.com/so?t=caipu&s=%E9%94%A1%E5%B3%B0%E7%89%8C%E6%B1%BD%E6%9E%AAB8%E3%80%9094OO%2B3O11%3BQ%E3%80%91ZOzhttps://mip.xiangha.com/so?t=caipu&s=%E4%B8%89%E6%9E%AA%E7%89%8C%E6%B1%BD%E6%9E%AA650%E5%85%83%E5%9B%BE%E7%89%87%E3%80%9094OO%2B3O11%3BQ%E3%80%91Onrhttps://mip.xiangha.com/so?t=caipu&s=%E9%94%A6%E6%B1%9F%E7%89%8C%E6%B1%BD%E6%9E%AA%E6%80%8E%E4%B9%88%E6%A0%B7%E3%80%9094OO%2B3O11%3BQ%E3%80%91LxChttps://mip.xiangha.com/so?t=caipu&s=%E5%B1%B1%E5%B3%B0%E7%89%8C%E6%B1%BD%E6%9E%AA%E5%BC%B9%E3%80%9094OO%2B3O11%3BQ%E3%80%91mzEhttps://mip.xiangha.com/so?t=caipu&s=%E5%9B%BD%E4%BA%A7%E4%B8%89%E8%A7%92%E7%89%8C%E6%B1%BD%E6%9E%AA%E3%80%9094OO%2B3O11%3BQ%E3%80%91cwPhttps://mip.xiangha.com/so?t=caipu&s=%E5%B9%BF%E5%B7%9E%E7%89%8C%E6%B1%BD%E6%9E%AA%E3%80%9094OO%2B3O11%3BQ%E3%80%91GUuhttps://mip.xiangha.com/so?t=caipu&s=%E7%A7%83%E9%B9%B0%E8%83%BD%E6%94%B9%E4%B8%AD%E6%8F%A1%E5%90%97%3F%E7%A7%83%E9%B9%B0%E6%80%8E%E6%A0%B7%E6%94%B9%E7%9F%AD%E3%80%9094OO%2B3O11%3BQ%E3%80%91eXAhttps://mip.xiangha.com/so?t=caipu&s=%E5%B9%BF%E5%B7%9E%E5%B8%82%E4%B8%89%E7%AE%AD%E7%89%8C%E6%B1%BD%E6%9E%AA%E5%85%A8%E5%A5%97%E9%AB%98%E5%8E%8B%E6%B1%BD%E6%9E%AA+%E3%80%9094OO%2B3O11%3BQ%E3%80%91vszhttps://mip.xiangha.com/so?t=caipu&s=%E5%8F%B0%E6%B9%BE%E5%8E%9F%E4%BA%A7%E7%A7%83%E5%A4%A7%E6%A6%82%E4%BB%80%E4%B9%88%E4%BB%B7%E6%A0%BC%2C%E5%A8%81%E5%8A%9B%E5%A4%A7%E4%B8%8D%E5%A4%A7%E3%80%9094OO%2B3O11%3BQ%E3%80%91AIZhttps://mip.xiangha.com/so?t=caipu&s=%E5%8F%B0%E6%B9%BE%E5%A8%81%E5%8A%9B%E3%80%9094OO%2B3O11%3BQ%E3%80%91QfEhttps://mip.xiangha.com/so?t=caipu&s=%E5%8F%B0%E6%B9%BE%E5%A8%81%E5%8A%9B%E9%BE%99%E9%97%A8%E5%8A%A0%E5%B7%A5%E4%B8%AD%E5%BF%83%E3%80%9094OO%2B3O11%3BQ%E3%80%91U8Chttps://mip.xiangha.com/so?t=caipu&s=%E5%8F%B0%E6%B9%BE%E5%A8%81%E5%8A%9B%E9%92%A2%E3%80%9094OO%2B3O11%3BQ%E3%80%91A2jhttps://mip.xiangha.com/so?t=caipu&s=+64%E5%BC%8F%E6%89%8B%E6%80%86%E5%9B%BE%E7%89%87%E3%80%9094OO%2B3O11%3BQ%E3%80%91c6bhttps://mip.xiangha.com/so?t=caipu&s=%E7%A7%83%E9%B9%B020%E7%B1%B3%E5%BC%B9%E6%9C%89%E7%82%B9%E6%95%A3%E6%AD%A5%E5%A4%A7%E3%80%9094OO%2B3O11%3BQ%E3%80%91J9xhttps://mip.xiangha.com/so?t=caipu&s=%E7%A7%83%E9%B9%B0%E4%B8%8A%E5%BC%B9%E6%96%B9%E5%BC%8F%E3%80%9094OO%2B3O11%3BQ%E3%80%91kzWhttps://mip.xiangha.com/so?t=caipu&s=%E7%A7%83%E9%B9%B0%E5%BC%B9%E8%BD%AE%E3%80%9094OO%2B3O11%3BQ%E3%80%91PTBhttps://mip.xiangha.com/so?t=caipu&s=%E7%A7%83%E9%B9%B0+%E5%BC%B9%E5%AE%B9%E9%87%8F%E3%80%9094OO%2B3O11%3BQ%E3%80%91Xpwhttps://mip.xiangha.com/so?t=caipu&s=%E7%A7%83%E9%B9%B0%E5%8F%AF%E4%BB%A5%E5%8A%A0%E5%BC%B9%E8%BD%AE%E5%90%97%E3%80%9094OO%2B3O11%3BQ%E3%80%91NQZhttps://mip.xiangha.com/so?t=caipu&s=%E7%A7%83%E9%B9%B0%E4%B8%8A%E5%8D%95%E6%8E%A5%E5%A4%B4%E6%98%AF%E4%BB%80%E4%B9%88%E3%80%9094OO%2B3O11%3BQ%E3%80%91lMphttps://mip.xiangha.com/so?t=caipu&s=%E7%A7%83%E9%B9%B0%E4%B8%8A%E5%8D%95%E6%95%99%E7%A8%8B%E8%A7%86%E9%A2%91%E3%80%9094OO%2B3O11%3BQ%E3%80%91zLQhttps://mip.xiangha.com/so?t=caipu&s=%E5%A4%A7%E7%A7%83%E9%B9%B0%E3%80%9094OO%2B3O11%3BQ%E3%80%91SPzhttps://mip.xiangha.com/so?t=caipu&s=%E6%9C%80%E5%A4%A7%E7%A7%83%E9%B9%B0%E3%80%9094OO%2B3O11%3BQ%E3%80%91w7phttps://mip.xiangha.com/so?t=caipu&s=%E7%A7%83%E9%B9%B0%E4%B8%BA%E4%BB%80%E4%B9%88%E5%A3%B0%E9%9F%B3%E9%82%A3%E4%B9%88%E5%A4%A7%E3%80%9094OO%2B3O11%3BQ%E3%80%91wjRhttps://mip.xiangha.com/so?t=caipu&s=%E7%A7%83%E9%B9%B0pcp%E7%8B%A9%E7%8C%8E%E8%A7%86%E9%A2%91%E9%87%8E%E9%B8%A1%E3%80%9094OO%2B3O11%3BQ%E3%80%91lDwhttps://mip.xiangha.com/so?t=caipu&s=pcp%E6%89%93%E7%8C%8E%E8%A7%86%E9%A2%91%E3%80%9094OO%2B3O11%3BQ%E3%80%91U4ihttps://mip.xiangha.com/so?t=caipu&s=%E5%9B%BD%E4%BA%A7%E7%A7%83%E7%BB%84%E8%A3%85%E5%9B%BD%E4%BA%A7%E7%A7%83%E5%AD%90%E6%9C%89%E6%95%88%E5%B0%84%E7%A8%8B+%E3%80%9094OO%2B3O11%3BQ%E3%80%91c1khttps://mip.xiangha.com/so?t=caipu&s=%E4%B8%87%E8%83%BD%E5%A5%97%E4%BB%B6%E4%B8%AD%E6%8F%A1%E4%B8%AD%E6%8F%A1%E4%B8%87%E8%83%BD%E5%A5%97%E4%BB%B6+-%E3%80%9094OO%2B3O11%3BQ%E3%80%91LMthttps://mip.xiangha.com/so?t=caipu&s=%E4%B8%AD%E6%8F%A150%E3%80%9094OO%2B3O11%3BQ%E3%80%91zBFhttps://mip.xiangha.com/so?t=caipu&s=%E4%B8%87%E8%83%BD%E7%87%95%E5%B0%BE%E4%B8%AD%E6%8F%A1%E3%80%9094OO%2B3O11%3BQ%E3%80%91ZrQhttps://mip.xiangha.com/so?t=caipu&s=%E4%B8%AD%E6%8F%A150%E6%9C%A8%E6%89%98%E3%80%9094OO%2B3O11%3BQ%E3%80%91QvLhttps://mip.xiangha.com/so?t=caipu&s=%E4%B8%AD%E6%8F%A1%E5%9B%BE%E3%80%9094OO%2B3O11%3BQ%E3%80%91EuGhttps://mip.xiangha.com/so?t=caipu&s=%E4%B8%AD%E6%8F%A1%E6%9C%A8%E6%89%98%E6%9F%84%E3%80%9094OO%2B3O11%3BQ%E3%80%91TpEhttps://mip.xiangha.com/so?t=caipu&s=%E4%B8%87%E8%83%BD%E4%B8%AD%E6%8F%A1%E6%8F%A1%E6%8A%8A%E3%80%9094OO%2B3O11%3BQ%E3%80%91KgFhttps://mip.xiangha.com/so?t=caipu&s=%E4%B8%AD%E6%8F%A1%E7%87%95%E5%B0%BE%E3%80%9094OO%2B3O11%3BQ%E3%80%91kN9https://mip.xiangha.com/so?t=caipu&s=b50%E4%B8%AD%E6%8F%A1%E3%80%9094OO%2B3O11%3BQ%E3%80%91GSihttps://mip.xiangha.com/so?t=caipu&s=%E5%AD%90%E5%BC%B9%E5%A4%9A%E9%92%B1%E4%B8%80%E9%A2%97%E3%80%9094OO%2B3O11%3BQ%E3%80%91j6dhttps://mip.xiangha.com/so?t=caipu&s=walthercp99%E3%80%9094OO%2B3O11%3BQ%E3%80%91QKThttps://mip.xiangha.com/so?t=caipu&s=%E5%BE%B7%E7%89%88%E5%A4%9C%E8%8E%BAcp99%E3%80%9094OO%2B3O11%3BQ%E3%80%91wPshttps://mip.xiangha.com/so?t=caipu&s=%E9%9B%84%E9%B9%B0%E7%8E%A9%E5%85%B7%E6%9E%AA%E7%BD%91%E7%AB%99%E3%80%9094OO%2B3O11%3BQ%E3%80%91X4rhttps://mip.xiangha.com/so?t=caipu&s=%E9%9B%84%E9%B9%B0%E7%8E%A9%E5%85%B71911%E3%80%9094OO%2B3O11%3BQ%E3%80%91kXNhttps://mip.xiangha.com/so?t=caipu&s=+pcp%E5%92%8C%E7%A7%83%E9%B9%B0%E5%8C%BA%E5%88%AB%E7%A7%83%E5%AD%90%E5%A8%81%E5%8A%9B%E3%80%9094OO%2B3O11%3BQ%E3%80%91lR7https://mip.xiangha.com/so?t=caipu&s=%E4%B8%AD%E6%8F%A1%E5%A4%9A%E5%B0%91%E9%92%B1%E4%B8%80%E6%8A%8A%E4%B8%AD%E6%8F%A1%E5%A4%9A%E5%B0%91%E9%92%B1%E4%B8%80%E5%A5%97%E3%80%9094OO%2B3O11%3BQ%E3%80%91hU7https://mip.xiangha.com/so?t=caipu&s=%E7%BE%8E%E5%9B%BD%E7%A7%83%E9%B9%B0%E5%B0%84%E5%87%BB%E9%B8%BD%E5%AD%90%E8%A7%86%E9%A2%91%E3%80%9094OO%2B3O11%3BQ%E3%80%91QNphttps://mip.xiangha.com/so?t=caipu&s=%E7%A7%83%E9%B9%B0%E8%83%BD%E7%94%A85%E6%AF%AB%E7%B1%B3%E9%92%A2%E7%8F%A0%E5%90%97%E3%80%9094OO%2B3O11%3BQ%E3%80%91k5Xhttps://mip.xiangha.com/so?t=caipu&s=%E9%83%A8%E5%88%86%E5%9B%BD%E4%BA%A7%E6%9E%AA%E6%94%AF%E5%8F%8A%E5%BC%B9%E8%8D%AF%E7%9A%84%E4%BB%B7%E6%A0%BC%E3%80%9094OO%2B3O11%3BQ%E3%80%91Q0Jhttps://mip.xiangha.com/so?t=caipu&s=%E4%B8%96%E7%95%8C%E4%B8%8A%E6%9C%80%E5%85%88%E8%BF%9B%E7%9A%84%E5%BC%A9%E3%80%9094OO%2B3O11%3BQ%E3%80%91ay1https://mip.xiangha.com/so?t=caipu&s=zp5%E5%B7%A6%E8%BD%AE%E6%8B%86%E5%8D%B8%E5%9B%BE%E3%80%9094OO%2B3O11%3BQ%E3%80%91ilRhttps://mip.xiangha.com/so?t=caipu&s=%E6%9E%AA%E6%94%AF%E8%B4%AD%E6%9E%AA%E7%BD%91%E5%9D%80%E3%80%9094OO%2B3O11%3BQ%E3%80%91xqphttps://mip.xiangha.com/so?t=caipu&s=%E4%B8%93%E4%B8%9A%E6%9E%AA%E6%A2%B0%E6%A8%A1%E5%9E%8B%E5%BA%97%E3%80%9094OO%2B3O11%3BQ%E3%80%91Atmhttps://mip.xiangha.com/so?t=caipu&s=%E9%83%91%E5%B7%9E%E5%AE%9E%E5%BC%B9%E5%B0%84%E5%87%BB%E3%80%9094OO%2B3O11%3BQ%E3%80%91OzOhttps://mip.xiangha.com/so?t=caipu&s=%E6%8A%A2%E5%8F%8B%E5%9F%BA%E5%9C%B0%E6%9E%AA%E6%94%AF%E3%80%9094OO%2B3O11%3BQ%E3%80%91sX8https://mip.xiangha.com/so?t=caipu&s=%E7%8B%97%E5%8F%8B%E5%92%8C%E6%9E%AA%E6%A2%B0%E3%80%9094OO%2B3O11%3BQ%E3%80%91HuOhttps://mip.xiangha.com/so?t=caipu&s=%E7%8E%A9%E5%85%B7%E5%BC%B9%E7%B0%A7%E6%9E%AA%E5%86%85%E9%83%A8%E6%9E%84%E9%80%A0%E5%9B%BE%E3%80%9094OO%2B3O11%3BQ%E3%80%91EEThttps://mip.xiangha.com/so?t=caipu&s=%E5%BC%80%E5%8F%A3%E5%B0%84%E9%92%89%E5%BC%B9%E5%8A%A0%E5%BC%B9%E5%A4%B4%E3%80%9094OO%2B3O11%3BQ%E3%80%91W8xhttps://mip.xiangha.com/so?t=caipu&s=%E9%9C%B0%E5%BC%B9%E6%9E%AA%E5%86%85%E9%83%A8%E7%BB%93%E6%9E%84%E5%9B%BE%E3%80%9094OO%2B3O11%3BQ%E3%80%91NmHhttps://mip.xiangha.com/so?t=caipu&s=20%E5%8F%B7%E7%8C%8E%E6%9E%AA%E5%8F%A3%E5%BE%84%E5%A4%9A%E5%A4%A7%E3%80%9094OO%2B3O11%3BQ%E3%80%91uHBhttps://mip.xiangha.com/so?t=caipu&s=%E6%97%8B%E8%BD%AC%E5%90%8E%E6%8B%89%E5%BC%8F%E6%9E%AA%E6%A0%93%E7%BB%93%E6%9E%84%E5%9B%BE%E3%80%9094OO%2B3O11%3BQ%E3%80%91U4Yhttps://mip.xiangha.com/so?t=caipu&s=%E7%8E%A9%E5%85%B7%E6%9E%AA%E5%86%85%E9%83%A8%E5%BC%B9%E7%B0%A7%E7%BB%93%E6%9E%84%E5%9B%BE%E3%80%9094OO%2B3O11%3BQ%E3%80%91V23https://mip.xiangha.com/so?t=caipu&s=%E6%B2%99%E6%BC%A0%E4%B9%8B%E9%B9%B0%E5%8E%9F%E7%90%86%E7%BB%93%E6%9E%84%E5%9B%BE%E3%80%9094OO%2B3O11%3BQ%E3%80%91IDEhttps://mip.xiangha.com/so?t=caipu&s=%E6%B2%99%E6%BC%A0%E4%B9%8B%E9%B9%B0%E6%89%8B%E6%9E%AA%E4%B8%89%E8%A7%86%E5%9B%BE%E3%80%9094OO%2B3O11%3BQ%E3%80%91c5Lhttps://mip.xiangha.com/so?t=caipu&s=%E5%90%83%E9%B8%A1%E5%96%B7%E5%AD%90%E6%98%AF%E4%BB%80%E4%B9%88%E6%9E%AA%E3%80%9094OO%2B3O11%3BQ%E3%80%91IVZhttps://mip.xiangha.com/so?t=caipu&s=%E4%B8%89%E5%85%AB%E5%BC%8F%E6%AD%A5%E6%9E%AA%E5%86%85%E9%83%A8%E7%BB%93%E6%9E%84%E5%9B%BE%E3%80%9094OO%2B3O11%3BQ%E3%80%91uCFhttps://mip.xiangha.com/so?t=caipu&s=%E5%B0%84%E7%A8%8B%E8%BF%9C%E7%9A%84%E7%8B%99%E5%87%BB%E6%B0%B4%E5%BC%B9%E6%9E%AA%E3%80%9094OO%2B3O11%3BQ%E3%80%91vqohttps://mip.xiangha.com/so?t=caipu&s=%E5%A6%82%E4%BD%95%E7%94%A8%E7%93%B6%E5%AD%90%E5%81%9A%E8%88%B9%E8%A7%86%E9%A2%91%E3%80%9094OO%2B3O11%3BQ%E3%80%91j8Nhttps://mip.xiangha.com/so?t=caipu&s=%E5%BC%B9%E5%A3%B3%E5%B7%A5%E8%89%BA%E5%93%81%E5%9B%BE%E7%89%87%E3%80%9094OO%2B3O11%3BQ%E3%80%91zo7https://mip.xiangha.com/so?t=caipu&s=%E5%86%9B%E7%94%A8%E7%BA%A2%E5%A4%96%E7%83%AD%E6%88%90%E5%83%8F%E4%BB%AA%E3%80%9094OO%2B3O11%3BQ%E3%80%91dOohttps://mip.xiangha.com/so?t=caipu&s=%E6%89%93%E9%87%8E%E9%B8%A1%E7%94%A8%E7%9A%84%E6%9E%AA%E7%9C%8B%E5%9B%BE%E7%89%87%E3%80%9094OO%2B3O11%3BQ%E3%80%91W6lhttps://mip.xiangha.com/so?t=caipu&s=6.8%E5%B0%84%E9%92%89%E5%BC%B9%E7%94%A8%E5%A4%9A%E5%A4%A7%E7%9A%84%E9%92%A2%E7%8F%A0%E3%80%9094OO%2B3O11%3BQ%E3%80%91BN4https://mip.xiangha.com/so?t=caipu&s=%E5%B0%84%E9%92%89%E6%9E%AA%E5%9B%BE%E7%89%87%E5%8F%8A%E4%BB%B7%E6%A0%BC%E8%A1%A8%E3%80%9094OO%2B3O11%3BQ%E3%80%91oOHhttps://mip.xiangha.com/so?t=caipu&s=%E4%BC%8A%E5%8A%9B%E5%B0%84%E9%92%89%E5%BC%B9s54%E3%80%9094OO%2B3O11%3BQ%E3%80%91CIyhttps://mip.xiangha.com/so?t=caipu&s=%E6%B0%B4%E5%BC%B9%E6%9E%AA%E5%8F%AF%E4%BB%A5%E6%89%93%E5%A1%91%E6%96%99%E5%BC%B9%E5%90%97%E3%80%9094OO%2B3O11%3BQ%E3%80%91fRXhttps://mip.xiangha.com/so?t=caipu&s=%E5%8F%B0%E6%B9%BE%E9%92%A2%E7%82%AE+%E7%BB%BF%E7%93%A6%E3%80%9094OO%2B3O11%3BQ%E3%80%91a7r
打开App,查看更多内容
随时随地看视频慕课网APP
我要回答
继续浏览精彩内容
慕课网APP
程序员的梦工厂
继续