You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2002/12/25 08:20:31 UTC

DO NOT REPLY [Bug 15657] New: - NotSerializableException while trying to write byte data in ServletOutputStream from Action Class

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15657>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15657

NotSerializableException while trying to write byte data in ServletOutputStream from Action Class

           Summary: NotSerializableException while trying to write byte data
                    in ServletOutputStream from Action Class
           Product: Struts
           Version: 1.1 Beta 1
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Utilities
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: nagarajan_sivashanmugam@satyam.com


I am getting "java.io.NotSerializableException: 
org.apache.struts.action.RequestProcessor" while trying to write byte data in 
ServletOutputStream from Action Class. In the stacktrace, i can see the 
exception occuring at line 1165 of RequestUtils.java.

In my application i need to write the binary data(i.e.,Image) in to the 
ServletOutputStream object of my Action Class. So, following are the steps i 
did to achieve it..

1. In execute() method of my Action class, i got the ServletOutputStream 
object from your HttpServletResponse object(which is passed as a parameter).

		ServletOutputStream output = p_response.getOutputStream();
		p_response.setContentType("image/png");
		output.write(chart.getImageBytes());

2. In my mapping.findForward() i will pass null instead of a valid forward 
string..In that case, i will get whatever the content i have set in the 
outputstream..

3. The above works mostly (80%) of times when i invoke the action..I am able 
to see the image in Browse (which i have written in to the ServletOutputStream 
of my Action class). But rarely, i am getting the below said exception. Could 
you please let me know the fix??

NOTE:
----
    The above said scenario works fine if i do the same in .jsp with scriplets
(bypassing struts framework) instead of doing it in Action class. I don't want 
to do this as my client requirement is to adhere to Struts Framework..


Detailed Exception log
----------------------
Mode:byFamily
Mode:byRow
Mode:byVariant
Mode:viewreport
<Dec 25, 2002 12:10:58 PM IST> <Error> <HTTP> <[WebAppServletContext
(2736248,gbomapp,/gbomapp)] Could not deserialize context a
ttribute
java.io.NotSerializableException: org.apache.struts.action.RequestProcessor
        at java.io.ObjectOutputStream.outputObject
(ObjectOutputStream.java:1148)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
        at java.io.ObjectOutputStream.outputClassFields
(ObjectOutputStream.java:1827)
        at java.io.ObjectOutputStream.defaultWriteObject
(ObjectOutputStream.java:480)
        at java.io.ObjectOutputStream.outputObject
(ObjectOutputStream.java:1214)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
        at weblogic.servlet.internal.AttributeWrapper.getObject
(AttributeWrapper.java:92)
        at weblogic.servlet.internal.AttributeWrapper.getObject
(AttributeWrapper.java:64)
        at weblogic.servlet.internal.WebAppServletContext.getAttribute
(WebAppServletContext.java:306)
        at org.apache.struts.util.RequestUtils.selectApplication
(RequestUtils.java:1165)
        at org.apache.struts.action.ActionServlet.process
(ActionServlet.java:1061)
        at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:439)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet
(ServletStubImpl.java:265)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet
(ServletStubImpl.java:200)
        at weblogic.servlet.internal.WebAppServletContext.invokeServlet
(WebAppServletContext.java:2495)
        at weblogic.servlet.internal.ServletRequestImpl.execute
(ServletRequestImpl.java:2204)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>
<Dec 25, 2002 12:10:59 PM IST> <Error> <HTTP> <[WebAppServletContext
(2736248,gbomapp,/gbomapp)] Servlet failed with Exception
java.lang.ClassCastException: org.apache.struts.util.PropertyMessageResources
        at org.apache.struts.util.RequestUtils.selectApplication
(RequestUtils.java:1169)
        at org.apache.struts.action.ActionServlet.process
(ActionServlet.java:1061)
        at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:439)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet
(ServletStubImpl.java:265)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet
(ServletStubImpl.java:200)
        at weblogic.servlet.internal.WebAppServletContext.invokeServlet
(WebAppServletContext.java:2495)
        at weblogic.servlet.internal.ServletRequestImpl.execute
(ServletRequestImpl.java:2204)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>