File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes Error while exporting to PDF/Excel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Error while exporting to PDF/Excel" Watch "Error while exporting to PDF/Excel" New topic
Author

Error while exporting to PDF/Excel

Kiran Bagul
Greenhorn

Joined: Jan 17, 2010
Posts: 2
Hi All,
I am using EJB3 and Weblogic 10 server.
While exporting the data to PDF, this error is thrown on the screen while exporting to PDF on IE screen
Caused by: java.io.NotSerializableException: java.io.ByteArrayOutputStream

full stacktrace is :

Error 500--Internal Server Error
weblogic.utils.AssertionError: ***** ASSERTION FAILED *****
at weblogic.rmi.internal.CBVWrapper.copy(CBVWrapper.java:57)
at com.danzas.wms.service.item.ejb.ItemAvailabilitySessionEJB_tqtjo6_ItemAvailabilitySessionLocalImpl_CBV.exportItemAvailabilityData(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:69)
at $Proxy52.exportItemAvailabilityData(Unknown Source)
at com.danzas.wms.report.export.action.ExportBeanAction.getItemAvailabilityReport(Unknown Source)
at com.danzas.wms.report.export.action.ExportBeanAction.execute(Unknown Source)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3498)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: java.io.NotSerializableException: java.io.ByteArrayOutputStream
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at weblogic.rmi.extensions.server.CBVOutputStream.writeObject(CBVOutputStream.java:80)
at weblogic.rmi.internal.CBVWrapper.copy(CBVWrapper.java:49)
... 27 more

same error is thrown when i am exporting to Excel with POI jar. with the description
Caused by: java.io.NotSerializableException: org.apache.poi.hssf.usermodel.HSSFWorkbook

All the jars are in the classpath.

It would be great if someone can give any insight to this issue.

I appreciate your time and help.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42951
    
  72
How, exactly, are you going about exporting your data? POI doesn't use serialization. What library are you using for the PDF export - iText? That doesn't use serialization, either.
Kiran Bagul
Greenhorn

Joined: Jan 17, 2010
Posts: 2
For excel generation i'm using POI 3.0 jar and for PDF its itext jar.
From database i'm fetching the records and exporting to Excel or PDF. Its a web application. The methods for converting are called from the method which return actionforward for JSP page.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42951
    
  72
That doesn't really answer my question. Somehow serialization gets involved, and some objects simply aren't serializable. Are you maybe putting objects in the session?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error while exporting to PDF/Excel