千山暮雪CN
2018-04-01 21:56
public class messageDao {
//private String url = "jdbc:oracle:thin:@localhost:1521:orcl"; // URL地址
public List<Message> queryMessageList(String command, String description) {
DBaccess dbaccess = new DBaccess();
List<Message> messageList = new ArrayList<Message>();
SqlSession sqlsession = null;
try {
sqlsession = dbaccess.getSqlSession();
// 通过SqlSession 对象去执行sql语句
messageList = sqlsession.selectList("Message.queryMessageList");
} catch (IOException e) {
e.printStackTrace();
} finally {
if (sqlsession != null) {
System.out.println("连接成功,准备关闭!2");
sqlsession.close();
} else {
System.out.println("失败222!");
}
}
return messageList;
}
好嘛,谢谢你的回答
抱歉,我也不知道怎样解决
控制台输出的错误信息是
连接成功,准备关闭!1
连接成功,准备关闭!2
四月 01, 2018 9:46:26 下午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [ListServlet] in context with path [/MicroMessage] threw exception [Servlet execution threw an exception] with root cause
java.lang.AbstractMethodError: Method oracle/jdbc/driver/T4CPreparedStatement.isClosed()Z is abstract
at oracle.jdbc.driver.T4CPreparedStatement.isClosed(T4CPreparedStatement.java)
at org.apache.ibatis.executor.BaseExecutor.closeStatement(BaseExecutor.java:285)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:65)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:326)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:136)
at been.messageDao.queryMessageList(messageDao.java:30)
at service.ListService.queryMessageList(ListService.java:16)
at servlet.ListServlet.doGet(ListServlet.java:46)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
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.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:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2555)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2544)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
页面提示的错误是500
type Exception report
message Servlet execution threw an exception
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause
java.lang.AbstractMethodError: Method oracle/jdbc/driver/T4CPreparedStatement.isClosed()Z is abstract oracle.jdbc.driver.T4CPreparedStatement.isClosed(T4CPreparedStatement.java) org.apache.ibatis.executor.BaseExecutor.closeStatement(BaseExecutor.java:285) org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:65) org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:326) org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:136) been.messageDao.queryMessageList(messageDao.java:30) service.ListService.queryMessageList(ListService.java:16) servlet.ListServlet.doGet(ListServlet.java:46) javax.servlet.http.HttpServlet.service(HttpServlet.java:624) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.82 logs.
通过自动回复机器人学Mybatis---基础版
107410 学习 · 786 问题
相似问题