title: Getting java.lang.OutOfMemoryError: GC overhead limit exceeded in Jboss
body: <p>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 <code>java.lang.OutOfMemoryError: GC overhead limit exceeded</code> error. </p>
  
  <p>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 <code>-Xmx</code> value to 2g then the script worked fine.</p>
  
  <p>I tried increasing <code>-Xmx</code> value in Jboss also but some have it is again throwing <code>java.lang.OutOfMemoryError: GC overhead limit exceeded" error</code>.</p>
  
  <p>Below is the full stacktrace.</p>
  
  <pre><code>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.&lt;init&gt;(RowRecordsAggregate.java:103)
          at org.apache.poi.hssf.model.InternalSheet.&lt;init&gt;(InternalSheet.java:208)
          at org.apache.poi.hssf.model.InternalSheet.createSheet(InternalSheet.java:163)
          at org.apache.poi.hssf.usermodel.HSSFWorkbook.&lt;init&gt;(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)
  </code></pre>
  
  <p>Method where I'm getting the issue is</p>
  
  <pre><code>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 &amp;&amp; !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 &amp;&amp; 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;
  }
  </code></pre>