java.lang.IllegalStateException,跪求解决方法!
有限的几个用户使用时,没有出现;如果用户很多,比如几十个用户,才出现的。websphere输出的日志信息是:java.lang.IllegalStateException: Cannot forward. Response already committed.
Servlet的源代码如下:
private void getItemDetail(HttpServletRequest req) throws
javax.servlet.ServletException, java.io.IOException {
BasicDB db = new BasicDB();
String applyid = req.getParameter("oid");
long acceptid=-1;
String type = req.getParameter("type");
ItemModel item = new ItemModel();
DataModel dm_detail = new DataModel();
Connection conn = db.getConnection();
ItemAdjust itemAdjust = new ItemAdjust(conn);
AcceptJobADO aj = new AcceptJobADO();
try {
if (userid != null && !"".equals(userid)) {
UserManageFactory umFactory = UserManageFactory.newInstance();
umFactory.setConnection(conn);
UserAccount uai = umFactory.getUserAccount();
UserModel um = uai.getUser(uai.getUserID(userid));
request.getSession().setAttribute(Constant.USER_LOGIN_SESSION,
um);
}
aj.setConnection(conn);
if(applyid!=null&&(!applyid.equals(""))){
acceptid = aj.getAcceptIdByApplyId(Long.parseLong(applyid));
}
conn.commit();
item = itemAdjust.getItemDetail(acceptid+"");
SupplySleepDAO sd = new SupplySleepDAO(db);
HashMap jobs = sd.getJobSupplyInfo(acceptid);
SupplyItemModel sim = sd.getItemModelByProcessId(acceptid);
req.setAttribute("jobs", jobs);
req.setAttribute("supplymodel",sim);
conn.commit();
db.release();
}
catch (Exception e) {
try {
conn.rollback();
db.release();
}
catch (Exception e1) {}
this.logger.error("查询详情出错!,原因是:" + e.getMessage());
throw new javax.servlet.ServletException("查询详情出错!,原因是:" +
e.getMessage());
}
finally {
if (db != null) {
try {
db.release();
}
catch (Exception e) {
this.logger.error("关闭数据库连接出错!");
}
}
}
req.setAttribute("item", item);
req.setAttribute("type", type);
String url = "/eosp_admin/modules/supplySleep/itemDetail.jsp";
this.callNextPage(url);
}
其中:callNextPage封装的是用 <jsp:forward >方法。