代码块:
listsql.add("select round((1 - (a.value/b.value))*100,2) from v$sysstat a,v$sysstat b where a.name='parse count (hard)' and b.name='parse count (total)'"); listsql.add("select round((1-sum(misses+immediate_misses)/sum(gets+immediate_gets))*100,2) from v$latch"); listsql.add("select round((1-parse.value/total.value)*100,2) from v$sysstat parse,v$sysstat total where parse.NAME='parse time cpu' and total.NAME='CPU used by this session'"); List<DB_jiemi> list1=HttpClientHelper.send(); List<DB_jiemi> list=new ArrayList<DB_jiemi>(); for (int i = 0; i < list1.size(); i++) { if(ip.equals(list1.get(i).getIP())) list.add(list1.get(i)); } Map map = new HashMap<>(); String url="jdbc:oracle:thin:@"+list.get(0).getIP()+":"+list.get(0).getPORT()+":"+list.get(0).getDB_SERVERNAME(); String user=list.get(0).getDB_USER_S(); String password=list.get(0).getDB_PWD_S(); String drive="oracle.jdbc.driver.OracleDriver"; Connection con = dbUtil.getConnection(url,user,password,drive); for (int i = 0; i < listsql.size(); i++) { PreparedStatement pst = con.prepareStatement(listsql.get(i)); ResultSet rs = pst.executeQuery(); while(rs.next()) { map.put("DBcheck",rs); } pst.close(); rs.close(); } con.close(); return map; }
报错:
Resolved exception caused by handler execution: org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: 关闭的语句; nested exception is com.fasterxml.jackson.databind.JsonMappingException: 关闭的语句 (through reference chain: java.util.HashMap["DBcheck"]->oracle.jdbc.driver.OracleResultSetImpl["statement"]->oracle.jdbc.driver.OraclePreparedStatementWrapper["sqlKind"])
这个异常怎么解决?
不知道你这个问题是否已经解决, 如果还没有解决的话: