java网站,关于jdbc连接池的问题报错,紧急,请大神指点!!!解决不了又要被老板骂了。
[align=center]项目启动后按F5一直刷新网站主页,
1.刚开始刷新后异常的信息为:java.sql.SQLException: We are already in the process of making 11 connections and the number of simultaneous builds has been throttled to 10
2.刷新一段时候后异常的信息为:java.sql.SQLException: Couldn't get connection because we are at maximum connection count (200/200) and there are none
3.最后报内存溢出异常。[/align]
代码我检查了没问题,pst,rs,conn该关闭的都关闭了,访问主页的19个查询方法也是平级的概念。
@RequestMapping(value = { "indexInfo" }, method = { RequestMethod.GET,
RequestMethod.POST })
public ModelAndView indexInfo(HttpServletRequest request,
HttpServletResponse response, HttpSession session, ModelMap modelMap)
throws Exception {
List<Map<String, Object>> maps = browseByPicNewsType(7);
StringBuffer sb = new StringBuffer();
StringBuffer sb1 = new StringBuffer();
StringBuffer sb2 = new StringBuffer();
for (Map<String, Object> map : maps) {
sb.append("../");
sb.append(map.get("IMAGEPATH"));
sb.append("|");
sb1.append("../news_pic/picInfo.do?id=");
sb1.append(map.get("ID"));
sb1.append("|");
sb2.append(map.get("TITLE"));
sb2.append("|");
}
modelMap.put("news_pic_imgpath", sb.substring(0, sb.length() - 1));
modelMap.put("news_pic_url", sb1.substring(0, sb1.length() - 1));
modelMap.put("news_pic_title", sb2.substring(0, sb2.length() - 1));
objList = new ArrayList();
HashMap optionMap = new HashMap();
optionMap.put("value", "content");
optionMap.put("text", "文章");
objList.add(optionMap);
optionMap = new HashMap();
optionMap.put("value", "pics");
optionMap.put("text", "图片");
objList.add(optionMap);
// 经信动态
List<Map<String, Object>> jingxindongtai = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=9 order by createdate desc limit 0,9");
modelMap.put("jingxindongtai", jingxindongtai);
// 领导讲话
List<Map<String, Object>> lingdaojianghua = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=4 order by createdate desc limit 0,10");
modelMap.put("lingdaojianghua", lingdaojianghua);
// 政策文件
List<Map<String, Object>> zhengcewenjian = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=10 order by createdate desc limit 0,10");
modelMap.put("zhengcewenjian", zhengcewenjian);
// 机关党建
List<Map<String, Object>> jiguandangjian = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=37 order by createdate desc limit 0,10");
modelMap.put("jiguandangjian", jiguandangjian);
// 县区工作
List<Map<String, Object>> xianqugongzuo = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=40 order by createdate desc limit 0,10");
modelMap.put("xianqugongzuo", xianqugongzuo);
// 综合信息
List<Map<String, Object>> zonghexinxi = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=2 order by createdate desc limit 0,10");
modelMap.put("zonghexinxi", zonghexinxi);
// 经信知识
List<Map<String, Object>> jingxinzhishi = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=64 order by createdate desc limit 0,10");
modelMap.put("jingxinzhishi", jingxinzhishi);
// 政策法规
List<Map<String, Object>> zhengcefagui = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=3 order by createdate desc limit 0,10");
modelMap.put("zhengcefagui", zhengcefagui);
// 政策法规 国资委
List<Map<String, Object>> zhengcefaguigzw = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=160 order by createdate desc limit 0,15");
modelMap.put("zhengcefaguigzw", zhengcefaguigzw);
// 国资动态
List<Map<String, Object>> guozidongtai = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=22 order by createdate desc limit 0,10");
modelMap.put("guozidongtai", guozidongtai);
// 国资动态 国资委
List<Map<String, Object>> guozidongtaigzw = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=161 order by createdate desc limit 0,15");
modelMap.put("guozidongtaigzw", guozidongtaigzw);
// 通知公告
List<Map<String, Object>> tongzhigonggao = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=6 order by createdate desc limit 0,10");
modelMap.put("tongzhigonggao", tongzhigonggao);
// 企业资讯
List<Map<String, Object>> qiyezixun = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=16 order by createdate desc limit 0,10");
modelMap.put("qiyezixun", qiyezixun);
// 企业动态
List<Map<String, Object>> qiyedongtai = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=17 order by createdate desc limit 0,10");
modelMap.put("qiyedongtai", qiyedongtai);
// 重点工程
List<Map<String, Object>> zhongdiangongcheng = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=18 order by createdate desc limit 0,10");
modelMap.put("zhongdiangongcheng", zhongdiangongcheng);
List<Map<String, Object>> rows = getAdminService()
.select(
" jxw_renwu",
"Id, name, content,phone,email,address, createdate, files, type,sortnum,showinfront",
"type=0 order by createdate");
// 经信人物
modelMap.put("renwu", rows);
List<Map<String, Object>> rowss = getAdminService()
.select(
" jxw_renwu",
"Id, name, content,phone,email,address, createdate, files, type,sortnum,showinfront",
"type=1 order by createdate");
// 经信企业
modelMap.put("qiye", rowss);
List<Map<String, Object>> zhuanti = getAdminService()
.select(
" jxw_renwu",
"Id, name, content,phone,email,address, createdate, files, type,sortnum,showinfront",
"type=2 order by createdate");
modelMap.put("zhuanti", zhuanti);
List<Map<String, Object>> images = getAdminService()
.select(
" jxw_picnews",
"ID,title,newType,browseImage,imgurl,sortnum,content,createDate,userName,infoSource",
"browseImage=1 order by sortnum limit 0,5");// sortnum
// asc
modelMap.put("images", images);
modelMap.put("selectOption", objList);
return new ModelAndView("index2.jsp", modelMap);
}
[解决办法]
楼主用的是oracle吗?
是不是驱动版本的问题啊
[解决办法]
<simultaneousBuildThrottle>69</simultaneousBuildThrottle>
<minimum-connection-count>20</minimum-connection-count>
<maximum-connection-count>200</maximum-connection-count>
这个设置的不合理,改为
<simultaneousBuildThrottle>20</simultaneousBuildThrottle>
<minimum-connection-count>5</minimum-connection-count>
<maximum-connection-count>50</maximum-connection-count>
[解决办法]
看看你写的数据库连接 释放自动释放
[解决办法]