You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Allan Kamau <hu...@yahoo.com> on 2001/05/22 08:57:09 UTC

Error in Including resources in JSP

Hi all,I get errors when I include a cocoon processed .xml file in .jsp file in Tomcat-3.2.1The "resource.xml" calls an xml generating servlet that I have written. If I call the "resource.xml?month=5&year=2001" on my browser it works just fine.However when I use I get "java.lang.IllegalStateException  writer is already being used for this request"if I use On requesting the .jsp I get an "java.lang.NullPointerException"  Now I think the problem is that the .xml being generated by cocoon is tring to obtain a new PrintWriter object. If this is the case how can I solve it. I have tried passing the "out" object from jsp to the servlet including in the "resource.xml" by using 'request.setAttribute("out",out)' but I am unable to obtain it in the servlet using '... out=request.getAttribute("out")' Below is the code for the "resource.xml?month=5&year=2001"
  "http://localhost:8080/projsp/XML/jsp/monthDays.jsp?month="+request.getParameter("month")+""+request.getParameter("year") 
 Below it the direct error output I get if I use the "" from the .jspCocoon 1.8.2                                                                        Error found handling the request.        java.lang.IllegalStateException: Writer is already being used for this request                at org.apache.tomcat.facade.HttpServletResponseFacade.getOutputStream(HttpServletResponseFacade.java:158)                at org.apache.cocoon.response.HttpServletResponseFacade.getOutputStream(HttpServletResponseFacade.java:85)                at org.apache.cocoon.Engine.handle(Engine.java:483)                at org.apache.cocoon.Cocoon.service(Cocoon.java:183)                at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)                at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)                at org.apache.tomcat.core.Handler.service(Handler.java:286)                at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)                at org.apache.tomcat.facade.RequestDispatcherImpl.include(RequestDispatcherImpl.java:345)                at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:414)                at diary.jsp._0002fdiary_0002fjsp_0002fdefault_00038_0002ejspdefault8_jsp_13._jspService(_0002fdiary_0002fjsp_0002fdefault_00038_0002ejspdefault8_jsp_13.java:65)                at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)                at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)                at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)                at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)                at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)                at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)                at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)                at org.apache.tomcat.core.Handler.service(Handler.java:286)                at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)                at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)                at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)                at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)                at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)                at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)                at java.lang.Thread.run(Thread.java:484)								Finally Thanks in advance.Allan Kamau.


---------------------------------
Do You Yahoo!?
Yahoo! Auctions $2 Million Sweepstakes  -  Got something to sell?

Re: Error when Including resources in JSP

Posted by Allan Kamau <hu...@yahoo.com>.
Well I still haven't got any responses to my problem
below.

--- Allan Kamau <hu...@yahoo.com> wrote:
> Hi all,I get errors when I include a cocoon
> processed .xml file in .jsp file in Tomcat-3.2.1The
> "resource.xml" calls an xml generating servlet that
> I have written. If I call the
> "resource.xml?month=5&year=2001" on my browser it
> works just fine.However when I use I get
> "java.lang.IllegalStateException  writer is already
> being used for this request"if I use On requesting
> the .jsp I get an "java.lang.NullPointerException" 
> Now I think the problem is that the .xml being
> generated by cocoon is tring to obtain a new
> PrintWriter object. If this is the case how can I
> solve it. I have tried passing the "out" object from
> jsp to the servlet including in the "resource.xml"
> by using 'request.setAttribute("out",out)' but I am
> unable to obtain it in the servlet using '...
> out=request.getAttribute("out")' Below is the code
> for the "resource.xml?month=5&year=2001"
>  
>
"http://localhost:8080/projsp/XML/jsp/monthDays.jsp?month="+request.getParameter("month")+""+request.getParameter("year")
> 
>  Below it the direct error output I get if I use the
> "" from the .jspCocoon 1.8.2                        
>                                                Error
> found handling the request.       
> java.lang.IllegalStateException: Writer is already
> being used for this request                at
>
org.apache.tomcat.facade.HttpServletResponseFacade.getOutputStream(HttpServletResponseFacade.java:158)
>                at
>
org.apache.cocoon.response.HttpServletResponseFacade.getOutputStream(HttpServletResponseFacade.java:85)
>                at
> org.apache.cocoon.Engine.handle(Engine.java:483)    
>            at
> org.apache.cocoon.Cocoon.service(Cocoon.java:183)   
>             at
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>                at
>
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
>                at
>
org.apache.tomcat.core.Handler.service(Handler.java:286)
>                at
>
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
>                at
>
org.apache.tomcat.facade.RequestDispatcherImpl.include(RequestDispatcherImpl.java:345)
>                at
>
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:414)
>                at
>
diary.jsp._0002fdiary_0002fjsp_0002fdefault_00038_0002ejspdefault8_jsp_13._jspService(_0002fdiary_0002fjsp_0002fdefault_00038_0002ejspdefault8_jsp_13.java:65)
>                at
>
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
>                at
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>                at
>
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
>                at
>
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
>                at
>
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
>                at
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>                at
>
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
>                at
>
org.apache.tomcat.core.Handler.service(Handler.java:286)
>                at
>
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
>                at
>
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
>                at
>
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
>                at
>
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
>                at
>
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
>                at
>
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
>                at
> java.lang.Thread.run(Thread.java:484)								Finally
> Thanks in advance.Allan Kamau.
> 
> 
> ---------------------------------
> Do You Yahoo!?
> Yahoo! Auctions $2 Million Sweepstakes  -  Got
> something to sell?


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/