Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JRUN 3.0 bug? "Response has been closed" exceptions while using JAI

8 views
Skip to first unread message

BB

unread,
Sep 7, 2000, 5:58:22 PM9/7/00
to

Hi,

Anyone knows about the following problem?

I am using JAI to create PNG images on the fly using servlets. The
following two exceptions were always output to stderr using JRun 3.0
(but the image can still be created sucessfully). But I didn't have
such problem with JRun 2.3.3 with the same code:

java.io.IOException: Response has been closed
at allaire.jrun.servlet.JRunOutputStream.alreadyClosed
(JRunOutputStream.java:51)
at allaire.jrun.servlet.JRunOutputStream.flush
(JRunOutputStream.java:64)
at com.sun.media.jai.opimage.EncodeRIF.create(EncodeRIF.java:75)
at javax.media.jai.OperationRegistry.create
(OperationRegistry.java:2956)
at javax.media.jai.RenderedOp.createInstance
(RenderedOp.java:402)
at javax.media.jai.RenderedOp.createRendering
(RenderedOp.java:414)
at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:430)
at javax.media.jai.JAI.createNS(JAI.java:439)
at javax.media.jai.JAI.create(JAI.java:306)
at javax.media.jai.JAI.create(JAI.java:1001)
at intelsat.capview.servlet.SawtoothImage.doGet
(SawtoothImage.java:192)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1013)
at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java:925)
at allaire.jrun.servlet.JRunNamedDispatcher.forward
(JRunNamedDispatcher.java:34)
at allaire.jrun.servlet.Invoker.service(Invoker.java:84)
at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1013)
at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java:925)
at allaire.jrun.servlet.JRunRequestDispatcher.forward
(JRunRequestDispatcher.java:88)
at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1131)
at allaire.jrun.servlet.JvmContext.dispatch(JvmContext.java:330)
at allaire.jrun.jrpp.ProxyEndpoint.run(ProxyEndpoint.java:354)
at allaire.jrun.ThreadPool.run(ThreadPool.java:267)
at allaire.jrun.WorkerThread.run(WorkerThread.java:74)
java.lang.RuntimeException: - Unable to render RenderedOp for this
operation.
at javax.media.jai.RenderedOp.createInstance
(RenderedOp.java:406)
at javax.media.jai.RenderedOp.createRendering
(RenderedOp.java:414)
at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:430)
at javax.media.jai.JAI.createNS(JAI.java:439)
at javax.media.jai.JAI.create(JAI.java:306)
at javax.media.jai.JAI.create(JAI.java:1001)
at intelsat.capview.servlet.SawtoothImage.doGet
(SawtoothImage.java:192)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1013)
at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java:925)
at allaire.jrun.servlet.JRunNamedDispatcher.forward
(JRunNamedDispatcher.java:34)
at allaire.jrun.servlet.Invoker.service(Invoker.java:84)
at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1013)
at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java:925)
at allaire.jrun.servlet.JRunRequestDispatcher.forward
(JRunRequestDispatcher.java:88)
at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1131)
at allaire.jrun.servlet.JvmContext.dispatch(JvmContext.java:330)
at allaire.jrun.jrpp.ProxyEndpoint.run(ProxyEndpoint.java:354)
at allaire.jrun.ThreadPool.run(ThreadPool.java:267)
at allaire.jrun.WorkerThread.run(WorkerThread.java:74)


My servlet doGet() code is like:

public void doGet(HttpServletRequest request,
HttpServletResponse response) throws
ServletException,
IOException {

// set MIME content type to be .png image
response.setContentType("image/x-png");

try {
ServletOutputStream out = response.getOutputStream();

//Get information from the servlet request
String planName = request.getParameter("planName");
...

BufferredImage bi = new BufferedImage(IMG_WIDTH ,
IMG_HEIGHT,

BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = (Graphics2D) bi.getGraphics();
g2.setPaint(Color.blue);
g2.fillRect(0, 0, IMG_WIDTH, IMG_HEIGHT);
// render the graphics
...
...

// Convert into JAI Rendered object.
PlanarImage pi = PlanarImage.wrapRenderedImage(bi);

// Output the image into stream in a specified format
// using one of the methods: encode or filestore.
JAI.create("encode", pi, out, "PNG", null);
} catch (Exception e) {
// redirect to the error page

e.printStackTrace();

request.setAttribute("EXCEPTION",e);

ServletContext sc = getServletContext();
sc.getRequestDispatcher("/capview_error.jsp").forward
(request,response);

}
}


Any response would be greatly appreciated.
--
BB & MM

--
/*
BB & MM
*/


Sent via Deja.com http://www.deja.com/
Before you buy.

asr...@my-deja.com

unread,
Sep 8, 2000, 6:45:26 AM9/8/00
to
In article <8p931i$mtm$1...@nnrp1.deja.com>,

BB <li...@my-deja.com> wrote:
>
>
> Hi,
>
> Anyone knows about the following problem?
>
> I am using JAI to create PNG images on the fly using servlets. The
> following two exceptions were always output to stderr using JRun 3.0
> (but the image can still be created sucessfully). But I didn't have
> such problem with JRun 2.3.3 with the same code:
>
> java.io.IOException: Response has been closed
> at allaire.jrun.servlet.JRunOutputStream.alreadyClosed

I have seen similar errors when I flushed before setting the response
content type (actually I was trying to set it twice). Sounds like
something is closing your output stream... the JAI method looks like a
likely candidate. But you did leave out some code... look it over
carefully.

You might try to write the new image to a file or a
ByteArrayOutputStream (?) instead. Then write the result back to the
browswer.

0 new messages