亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用MyBatis工具類openSession()方法,junit通過,在tomcat執行報錯

使用MyBatis工具類openSession()方法,junit通過,在tomcat執行報錯

慕后端2248651 2019-11-02 13:39:55
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
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關注
  • 1738 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號