Hi Mathew, POI uses GAE restricted classes. Please refer to http://code.google.com/p/googleappengine/wiki/WillItPlayInJava Alternate way is to use jxl library.
Thanks George On Sun, Jan 29, 2012 at 7:17 AM, Matthew Johnson <ijustmakecof...@gmail.com>wrote: > I'm working on an export to XLS service using Apache POI 3.6, and I've > encountered a NoClassDefFoundError exception when using the autosize column > feature. > > The code: > > Sheet sheet = wb.createSheet("Viewpath Timesheet (date range)"); > PrintSetup printSetup = sheet.getPrintSetup(); > printSetup.setLandscape(true); > sheet.setFitToPage(true); > sheet.setHorizontallyCenter(true); > > //Set first four columns width to autosize. > for (int i = 0; i <= 4; i++) { > sheet.autoSizeColumn(i); //Commenting this line out resolves the > error. > } > > Produces... > > WARNING: /export/timesheet > javax.servlet.ServletException: java.lang.NoClassDefFoundError: > java.awt.font.FontRenderContext is a restricted class. Please see the > Google App Engine developer's guide for more details. > at > org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862) > at > org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791) > at org.apache.jsp.export.timesheet_jsp._jspService(timesheet_jsp.java:406) > ... > Caused by: java.lang.NoClassDefFoundError: java.awt.font.FontRenderContext > is a restricted class. Please see the Google App Engine developer's guide > for more details. > at > com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51) > at > org.apache.poi.hssf.usermodel.HSSFSheet.autoSizeColumn(HSSFSheet.java:1694) > at > org.apache.poi.hssf.usermodel.HSSFSheet.autoSizeColumn(HSSFSheet.java:1662) > at org.apache.jsp.export.timesheet_jsp.toXls(timesheet_jsp.java:154) > at org.apache.jsp.export.timesheet_jsp._jspService(timesheet_jsp.java:396) > > ...Whaa..? Like a good baby-java dev, I checked the GAE developers guide > as directed, but couldn't find anything useful. I upgraded to POI 3.7 for > kicks, but the error remained. Anyone have experience with POI + Excel > Spreadsheets + GAE? Anyone? ...Bueller? > > Cheers, > Matthew > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > google-appengine-java@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine-java+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.