• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error while trying to construct excel sheet..!  RSS feed

 
Nitin Menon
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In my application, I am trying to read an excel sheet which weighs 5.61 MB.
I am using the poi-3.2-FINAL-20081019.jar file. The following are the codes :
My problem is, I am getting the following errors.
My code starts like this :

FileInputStream fileIn = new FileInputStream(properties.getExtractFilesPath() + "mailinglist_extract.xls");
POIFSFileSystem fs = new POIFSFileSystem(fileIn);
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheetAt(0);

Iterator<HSSFRow> it = sheet.rowIterator();

while (it.hasNext())
{
HSSFRow row = (HSSFRow) it.next();
""
""
(And the Loginc continues)
...
...
}

I got the following set of errors..!

org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance
at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:186)
at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:328)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:271)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:196)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:178)
at aero.omanair.sindbad.service.impl.MailingMemberServiceImpl.getTotalLineExcel(MailingMemberServiceImpl.java:366)
at aero.omanair.sindbad.service.impl.MailingMemberServiceImpl.updateMailingMemberTableFromExcelFile(MailingMemberServiceImpl.java:148)
at aero.omanair.sindbad.service.impl.MailingMemberServiceImpl.prepareMailingMembers(MailingMemberServiceImpl.java:125)
at aero.omanair.sindbad.service.impl.MailingMemberReadServlet.doPost(MailingMemberReadServlet.java:61)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.OutOfMemoryError: Java heap space
aero.omanair.sindbad.exception.SindbadException: An unexpected error occured while processing your request. Please try again later123
at aero.omanair.sindbad.service.impl.MailingMemberServiceImpl.getTotalLineExcel(MailingMemberServiceImpl.java:376)
at aero.omanair.sindbad.service.impl.MailingMemberServiceImpl.updateMailingMemberTableFromExcelFile(MailingMemberServiceImpl.java:148)
at aero.omanair.sindbad.service.impl.MailingMemberServiceImpl.prepareMailingMembers(MailingMemberServiceImpl.java:125)
at aero.omanair.sindbad.service.impl.MailingMemberReadServlet.doPost(MailingMemberReadServlet.java:61)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)
Jul 1, 2010 10:41:34 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet CVSProgressMonitorServlet threw exception
java.lang.OutOfMemoryError: Java heap space

Can anyone please help me..!
Thanks in advance..!
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try to increase the heap size ? (-Xms and -Xmx)
 
Nitin Menon
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah..!
I tried insreasing the XMX. from 512M to 1024M and now, it works..!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!