Hello Teodor,

Thanks for the reply.

Is this ImageServlet.class available in jasperreports-0.5.2.jar OR do I need to add it in JAR separately ?

Kalpesh


-----Original Message-----
From: Teodor Danciu [mailto:teodord@users.sourceforge.net]
Sent: Tuesday, February 22, 2005 12:08 AM
To: Kalpesh Chordia
Cc: jasperreports-questions@lists.sourceforge.net
Subject: Re: [jasperreports-questions] Images not displaying in
websphere



Hi,

You should transform the images.jsp into a servlet because it sends
binary content directly to the response output stream.
This is a known issue with some JSP engines that are sensitive
to some white space characters existing in the actual JSP source file
and open the writer object before you actually start sending bytes
on the output stream object.

This is a typical error that tells you that you cannot generate
text output and binary output at the same time when responding to a http
request.
With a servlet instead of the JSP the problem should go away.
The servlet you need is in the "webapp" sample provided.

I hope this helps.
Teodor


Kalpesh Chordia wrote:

> I am getting following exception. I have added println statement in
> image.jsp for printing image name. Below code says that image 1 is
> appeared properly but not the image 0.

> [2/21/05 12:17:03:855 IST] 39f9e39f SystemOut     O imageName=>img_1
> [2/21/05 12:17:03:855 IST] 39e6a39f SystemOut     O imageName=>img_0
> [2/21/05 12:17:03:857 IST] 39f9e39f WebGroup      E SRVE0026E:
> [Servlet Error]-[OutputStream already obtained]:
> java.lang.IllegalStateException: OutputStream already obtained
>  at
> com.ibm.ws.webcontainer.srt.SRTServletResponse.getWriter(SRTServletResponse.java(Compiled
> Code))
>  at
> org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java(Inlined
> Compiled Code))
>  at
> org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java(Compiled
> Code))
>  at
> org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java(Compiled
> Code))
>  at
> org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java(Compiled
> Code))
>  at
> org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java(Inlined
> Compiled Code))
>  at
> org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java(Compiled
> Code))
>  at org.apache.jsp._image._jspService(_image.java:108)
>  at
> com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java(Compiled
> Code))
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled
> Code))
>  at
> com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java(Compiled
> Code))
>  at
> com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java(Compiled
> Code))
>  at
> com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java(Compiled
> Code))
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled
> Code))
>  at
> com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java(Compiled
> Code))
>  at
> com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java(Compiled
> Code))
>  at
> com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleServlet.java(Compiled
> Code))
>  at
> com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java(Inlined
> Compiled Code))
>  at
> com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java(Compiled
> Code))
>  at
> com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java(Compiled
> Code))
>  at
> com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java(Inlined
> Compiled Code))
>  at
> com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java(Compiled
> Code))
>  at
> com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java(Compiled
> Code))
>  at
> com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java(Compiled
> Code))
>  at
> com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java(Compiled
> Code))
>  at
> com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java(Compiled
> Code))
>  at
> com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java(Compiled
> Code))
>  at
> com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java(Compiled
> Code))
>  at
> com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java(Compiled
> Code))
>  at
> com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java(Compiled
> Code))
>  at
> com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java(Compiled
> Code))
>  at
> com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java(Compiled
> Code))
>  at com.ibm.ws.http.HttpConnection.run(HttpConnection.java(Compiled Code))
>  at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
>
>     -----Original Message-----
>     *From:* Kalpesh Chordia [mailto:kchordia@egain.com]
>     *Sent:* Friday, February 18, 2005 10:50 PM
>     *To:* 'Giulio Toffoli'; 'teodord@users.sourceforge.net'
>     *Cc:* jasperreports-questions@lists.sourceforge.net;
>     'teodord@hotmail.com'
>     *Subject:* RE: [jasperreports-questions] Images not displaying in
>     websphere
>
>     For the Parameter IMAGES_URI, I am setting the path of image.jsp .
>     exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI,
>     "../../../view/platform/report/image.jsp?image=");
>     
>     Instead of using Image.jsp, if I use ImageServlet.class, will it
>     help to fix the image displaying issue ?
>     
>     How do I use ImageServlet.class in my below jsp code ?
>     
>     Thanks,
>     Kalpesh
>     
>     
>
>         -----Original Message-----
>         *From:* Kalpesh Chordia [mailto:kchordia@egain.com]
>         *Sent:* Friday, February 18, 2005 10:29 PM
>         *To:* 'Giulio Toffoli';
>         jasperreports-questions@lists.sourceforge.net
>         *Subject:* RE: [jasperreports-questions] Images not displaying
>         in websphere
>
>         Hello Giulio,
>         
>         Thanks for your quick response. Could you please explain me
>         the problem and its solution in more details as this is very
>         urgent and I can not deliver it without fix.
>         
>         Thanks in advance.
>         Kalpesh
>         
>
>             -----Original Message-----
>             *From:* Giulio Toffoli [mailto:gt@businesslogic.it]
>             *Sent:* Friday, February 18, 2005 10:17 PM
>             *To:* jasperreports-questions@lists.sourceforge.net
>             *Subject:* Re: [jasperreports-questions] Images not
>             displaying in websphere
>
>
>             Can be a ClassLoader problem. JasperReports uses a custom
>             ClassLoader do load resources.
>
>             Giulio
>
>             Kalpesh Chordia wrote:
>
>>             Hi,
>>
>>             I am running JasperReports 0.5.2 in RedHat Linux + Ibm
>>             WebSphere environment. In my report, I have included
>>             images in page header and footer sections.
>>
>>             When I export jrprint file to HTML, I am not able to see
>>             all the images on all the generated pages. They appear
>>             properly on first page only and from second page, images
>>             do not appear. The behavior is very inconsistent. I need
>>             to right click on the image and select show picture
>>             option to get the image and that to twice for each
>>             disappeared image.
>>
>>             The same report with all the images on all the pages work
>>             fine under Windows 2000 + Weblogic environment.
>>
>>             Is JasperReports not 100% compatible with IBM WEB SPHERE
>>             ? OR do I need any thing extra ?
>>
>>             My HTML Exporter code written in JSP is as follows.
>>             exporter.setParameter(JRExporterParameter.JASPER_PRINT,
>>             jasperPrint);
>>             exporter.setParameter(JRExporterParameter.OUTPUT_STRING_BUFFER,
>>             sbuf);
>>             exporter.setParameter(JRHtmlExporterParameter.HTML_FOOTER,"
>>             ");
>>             exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN,
>>             Boolean.FALSE);
>>             Map imagesMap = new HashMap();
>>             request.getSession().setAttribute("IMAGES_MAP", imagesMap);
>>             exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP,
>>             imagesMap);
>>             exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI,
>>             "../../../view/platform/report/image.jsp?image=");
>>             exporter.exportReport();
>>
>>             Thanks,
>>             Kalpesh
>>
>