Reputation: 19
I'm trying to deploy a web application using Struts-2 which reads data from two Excel sheets around 40mb files and update it, I'm deploying it into Jboss-5 but I'm getting java.lang.OutOfMemoryError: GC overhead limit exceeded
error.
The same script when I run my simple Java application through Netbeans; initially I faced the same issue but I increased Java heap memory by increasing -Xmx
value to 2g then the script worked fine.
I tried increasing -Xmx
value in Jboss also but some have it is again throwing java.lang.OutOfMemoryError: GC overhead limit exceeded" error
.
Below is the full stacktrace.
java.lang.OutOfMemoryError: GC overhead limit exceeded
at org.apache.poi.hssf.record.aggregates.ValueRecordsAggregate.addMultipleBlanks(ValueRecordsAggregate.java:159)
at org.apache.poi.hssf.record.aggregates.RowRecordsAggregate.<init>(RowRecordsAggregate.java:103)
at org.apache.poi.hssf.model.InternalSheet.<init>(InternalSheet.java:208)
at org.apache.poi.hssf.model.InternalSheet.createSheet(InternalSheet.java:163)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:296)
at com.zaxis.tm.utils.ExcelParser.readXldata(ExcelParser.java:84)
at com.zaxis.tm.action.UploadFile.execute(UploadFile.java:231)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
Method where I'm getting the issue is
public boolean readXldata(String path,UpdateBean term) {
logger.info("%%%%%%%%%%%%%%%% Inside Reading Export main Fle %%%%%%%%%%%%%%%%");
ExportBean video = null;
HSSFRow myRow = null;
boolean status = false;
ProcessMethods methds = new ProcessMethods();
try{
if(myFileSystem == null){
myFileSystem = new NPOIFSFileSystem(new File(path));
}
if (myWorkBook == null){
myWorkBook = new HSSFWorkbook(myFileSystem.getRoot(),true);
}
if (mySheet == null){
mySheet = myWorkBook.getSheetAt(0);
}
if(mySheet.isColumnHidden(2)){
mySheet.setColumnHidden(2, false);
}
Iterator rowIter = mySheet.rowIterator();
int start = term.getStart_index();
logger.info("TARGET LANG START INDEX ::" +start+ "LAST INDEX ::" +term.getEnd_index());
while(rowIter.hasNext()){
flag = 0;
myRow = (HSSFRow) rowIter.next();
int id = 0;
try{
id = new Double(myRow.getCell(0).toString().trim()).intValue();
logger.info("ID ::" +myRow.getCell(0));
}catch(NumberFormatException nex){
logger.info("\nNUMBER FORMAT EXCEPTION WHIILE READING CONTENT ENTRY IN FILE ::");
continue;
}
}else{
logger.info("\nNUMBER FORMAT EXCEPTION WHIILE READING CONTENT ENTRY IN FILE ::");
continue;
}
video = new ExportBean();
video.setConcept(id);
int Rownum =myRow.getRowNum();
video.setRowno_ex(Rownum);
int LastRow = mySheet.getPhysicalNumberOfRows() - 7 ;
if(myRow.getCell(1)!=null && !myRow.getCell(1).toString().equals("")){
video.setEntryclass(myRow.getCell(1).toString().trim());
}
flag=0;
logger.info("LAST ROW NUMBER ::" +LastRow+" ROW NUMBER ::" +Rownum+ "FLAG ::" +flag);
if(term.getEnglish_term().equalsIgnoreCase(video.getEng_term())){
flag = 1;
if(!term.getTarget_term().equalsIgnoreCase(video.getTar_term())){
logger.info("Termlist English term is same to Export main english term");
logger.info("Termlist English term" +term.getTarget_term()+" is not same to Export main english term");
if(this.Update_Row(video,term)){
logger.info(" ############ ROW NO::"+ video.getRowno_ex() + "SUCCESSFULLY UPDATED #######");
status = true;
return status;
}else{
logger.info(" ############ UPDATION FAILED #########");
return status;
}
}
}else if (LastRow == Rownum && flag == 0){
logger.info("Reached to end of the row");
if(Insert_Row(video,term)){
logger.info("Insertion done successfully at row "+ mySheet.getLastRowNum());
return status=true;
}else{
logger.info("Failed to insert values at the last row");
return status;
}
}
logger.info("Termlist Eng term is not same to main term " +video.getEng_term()+ " Continue with the process.......");
continue;
}
myFileSystem.close();
} catch (Exception e) {
e.printStackTrace();
}
return status;
}
Upvotes: 1
Views: 12365
Reputation: 761
GC overhead limit exceeded means that the JVM is spending too much time garbage collecting, this usually means that you don't have enough memory. So you might have a memory leak, you should start jconsole or jprofiler and connect it to your jboss and monitor the memory usage while it's running.
Something that can also help in troubleshooting this is to temporarily increase the memory (Xmx) to as much as you can spare. because if you can delay the out of memory you will have more time to find a potential leak
Upvotes: 2