|
[align=center]项目启动后按F5一直刷新网站主页, @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);
}
连接池配置proxool.xml: |
|
|
请大神们指点指点,小弟不胜感激!定会请客吃饭。
|
|
|
我觉得是连接池的问题,java.sql.SQLException: We are already in the process of making 11 connections and the number of simultaneous builds has been throttled to 10
大神们来帮帮我! |
|
10分 |
楼主用的是oracle吗?
是不是驱动版本的问题啊 |
20分 |
<simultaneousBuildThrottle>69</simultaneousBuildThrottle>
<minimum-connection-count>20</minimum-connection-count> 这个设置的不合理,改为 |
10分 |
看看你写的数据库连接 释放自动释放
|
|
改为这个就合理了吗?4楼的朋友?异常还报吗? |
|
|
我用的mysql,谢谢,没看到proxool.xml里的驱动吧? |
|
|
5楼的朋友什么意思?上代码?我用的是jdbc 连接池,每次获取连接后我都会在方法下面关闭conn,pst,rs的。 |
|
10分 |
配置连接池,首先要看官方说明,各个属性取值在什么范围内波动,不是随便写个值就行了的。 |
|
还是上代码吧!
这是用连接池获取连接的类: package cn.com.rocan.db; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class DBUtil { public static Connection getConn() throws SQLException { Connection connection = null; connection = DriverManager.getConnection("proxool.jxw_db"); return connection; } } 这是Dao查询的: /** * 查询所有数据 * * @param tableName * 表明 * @param fields * 字段名["name,pass,desc"] * @param whereStr * 条件[id=1 and name=""user1""] * @return 结果 List<Map<String, Object>>类型。Map的Key为大写字母 * @throws Exception * 异常统一向页面抛 */ public List<Map<String, Object>> select(String tableName, String fields, String whereStr) throws Exception { Map<String, Object> map = null; List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); // String str[] = fields.split(","); StringBuilder sql = new StringBuilder(); Connection conn = null; PreparedStatement pst = null; ResultSet rs = null; // DatabaseUtil database = new DatabaseUtil(); conn = DBUtil.getConn(); sql.append("select ").append(fields).append(" from ").append(tableName); if ((whereStr != null) && (!"".equals(whereStr))) { sql.append(" where ").append(whereStr); } pst = conn.prepareStatement(sql.toString()); rs = pst.executeQuery(); // System.out.println("[SQL]:" + sql); log.debug("[SQL]:" + sql); // rs = DatabaseUtil.executeQuery(sql.toString(), pst, rs, conn); if (rs != null && (!"".equals(rs.toString()))) { ResultSetMetaData rsmd = rs.getMetaData(); while (rs.next()) { map = new HashMap<String, Object>(); for (int i = 1; i <= rsmd.getColumnCount(); i++) { map.put(rsmd.getColumnName(i).toUpperCase(), rs .getObject(rsmd.getColumnName(i))); } list.add(map); } } if (rs != null) { rs.close(); rs = null; } if (pst != null) { pst.close(); pst = null; } if (conn != null) { conn.close(); conn = null; } return list; } |
|
恩恩,谢谢大神指教,我改下,再测试测试 |
|
10分 |
换个连接池试试,会不会是BUG
|
、换 什么连接池??? |
|
|
C3P0或者DBCP
|
|
20分 |
设置一个 <house-keeping-sleep-time>50000</house-keeping-sleep-time>
会不会好些 |
|
第一个异常 数据库连接创建过快 第二个就没有数据库连接了
数据库连接 无法自动释放 或者 释放速度没有你 添加数据库连接速度快。 要不是要求单例性能的话 可以考虑 等比例夸大连接数 |
|
20分 |
没个项目 都有最大并发承载量,最多就是优化一下,让并发可以多些,无法做到 无限并发,所以你这根本是在压力测试呀
|
我用过存储过程,但还不是这个问题。谢谢你的回答。问题解决了。 |
|
你好 能否告诉一下 是什么问题吗?我也遇到了 |
|