Hi
I am using POI to generate the excel report.
Following is the code which i am using to dump the data in excel sheet.
My query is fetching more than 13000 records. I am passing the workbook object
in request. The next page is servlet which set the content type and prints the
workbook.
But i am getting this error message after 10 mins or so. <May 3, 2005 12:42:36
PM GMT+05:30> <Warning> <WebLogicServer> <BEA-000337> <ExecuteThread: '14' for
queue: 'weblogic.kernel.Default' has been busy for "819" seconds working on the
request "Http Request: /TestProject/ExportExcel.jsp", which is more than the
configured time (StuckThreadMaxTime) of "600" seconds.>
How to resolve this problem? I think its OutofMemory exception.
HSSFWorkbook hwb = new HSSFWorkbook();
HSSFCellStyle style;
//Create sheet with appropriate name.
HSSFSheet sheet1 = hwb.createSheet("ExportToExcel");
//Create 0th row in the sheet for header
style =hwb.createCellStyle();
HSSFFont fontObj = hwb.createFont();
fontObj.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
style.setFont(fontObj);
HSSFRow row = sheet1.createRow((short)0);
row = sheet1.createRow((short)0);
//Printing header and setting columnwidth.
for(int i=0;i<headerFields.size();i++){
sheet1.setDefaultColumnWidth((short)10);
HSSFCell testCell = row.createCell((short)i);
testCell.setCellStyle(style);
testCell.setCellValue((String)headerFields.get(i));
}
int rowCount = 1;
pstmt = con.prepareStatement(strFinalQuery.toString());
pstmt.setQueryTimeout(GFBConstants.QUERY_TIME_OUT);
rs = pstmt.executeQuery();
while(rs !=null && rs.next())
{
HSSFRow rowInfo = sheet1.createRow((short)rowCount);
isRecordNotFound = false;
int cellCount = 0;
for(int i=0; i<fields.size();i++){
String strVal = null;
sheet1.setDefaultColumnWidth((short)10);
HSSFCell testCell =
rowInfo.createCell((short)(cellCount));
testCell.setEncoding(HSSFCell.ENCODING_UTF_16);
strVal = rs.getString(i+1);
if(strVal == null)
strVal = "";
//Printing the data and setting column width.
testCell.setCellValue(strVal);
cellCount++;
}
rowCount++;
}
pageContext.getRequest().setAttribute("DATA", hwb);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/