You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by to...@lantaka.it on 2010/06/29 08:45:55 UTC

org.apache.wicket.WicketRuntimeException: Unable to write the response

Hello,

This is my first post. I am not a web developer, I usually develop other kinds of systems, but for a quick project I have to do, I looked at JSF and I really did not like it. Finally, I have come across wicket and it was love at first sight. 

Now, so far everything has been straightforward, but I am now facing the first puzzle...

I have a page that takes a while to render and, while it's rendering, if the user does anything, then I get:

org.apache.wicket.WicketRuntimeException: Unable to write the response
 at org.apache.wicket.Response.handleException(Response.java:286)
 at org.apache.wicket.Response.write(Response.java:310)
 at org.apache.wicket.request.target.resource.ResourceStreamRequestTarget.respond(ResourceStreamRequestTarget.java:160)
 at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)
 at org.apache.wicket.RequestCycle.respond(RequestCycle.java:1267)
 at org.apache.wicket.RequestCycle.step(RequestCycle.java:1334)
 at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
 at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
 at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479)
 at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:138)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
.... etc ...
Caused by: EOFException(java.net.SocketException: Connection reset by peer: socket write error)
 at org.mortbay.http.BufferedOutputStream.flush(BufferedOutputStream.java:195)
 at org.mortbay.util.ByteBufferOutputStream.ensureSpareCapacity(ByteBufferOutputStream.java:342)
 at org.mortbay.util.ByteBufferOutputStream.write(ByteBufferOutputStream.java:182)
 at org.mortbay.http.BufferedOutputStream.write(BufferedOutputStream.java:135)
 at org.mortbay.http.HttpOutputStream.write(HttpOutputStream.java:442)
 at org.mortbay.jetty.servlet.ServletOut.write(ServletOut.java:42)
 at org.apache.wicket.util.io.Streams.copy(Streams.java:121)
 at org.apache.wicket.util.io.Streams.copy(Streams.java:88)
 at org.apache.wicket.Response.write(Response.java:306)
 ... 23 more

00:39:32.335 WARN!! Invalid length: Content-Length=9491 written=4096 for http://127.0.0.1:8081/quickstart/app/
ERROR - WicketFilter               - closing the buffer error
java.lang.IllegalStateException
 at org.mortbay.jetty.servlet.ServletHttpResponse.getWriter(ServletHttpResponse.java:540)
 at org.apache.wicket.protocol.http.WebResponse.write(WebResponse.java:392)
.... etc ...

Now, this would be ok, I suppose. The user clicks something while wicket is sending stuff and that operation has to abort. However, this except really corrupts things, after this exception the web page behaves very strangely, some of wicket:ids do not update well anymore etc...
In the book Wicket in Action it says that a page is single threaded and all I am doing here is using one single page, one sesion, two request, quickly one after the other, before the first one completes.

I am using: INFO  - WebApplication             - [QuickStartApplication] Started Wicket version 1.4.8 in development mode
And I have downlowded a hello world project (quickstart) adapted it to 1.4.8 (generics pretty much) and not yet refactored things as I am concentrating on business logic for a quick prototype. The webserver is jetty.

Ok, sorry for the long post, and I hope someone of you will be able to give me a couple of hints/tips (tried to google it, but did not find much).


Thanks,

Tommy



Re: org.apache.wicket.WicketRuntimeException: Unable to write the response

Posted by to...@lantaka.it.
Marjin,

Thanks, I suppose that solves part of my problem. The wait is only 1 sec or 
so, so using a lazy panel is a great idea, but does not eliminate my 
underliying problem. For instance the user can still press the refresh 
button causing the same exception and the same problem (some sort of 
corruption, things do not work well anymore, for example I have various 
wicket-ids that render differently but based on the same data and some of 
those stop rendering consistent things).

As I am not familiar with wicket yet, I am struggling to understand what's 
happening under the hood. I am also not too familiar with the threading 
model. However, I am not even sure it's concurrency problem yet.

Some of those parts using the same data  that I have mentioned above are 
JFreeCharts and if I take those out, then the problem seems to go away 
completely. Even by putting a sleep 1000 in the rendering code for the list 
view (table), I cannot reproduce the problem (and not even the exception to 
be fair).

JFreeChartImage extends Image and I took the sample from 
https://cwiki.apache.org/WICKET/jfreechart-and-wicket-example.html


Thanks,

Tommy


----- Original Message ----- 
From: "Martijn Dashorst" <ma...@gmail.com>
To: <us...@wicket.apache.org>
Sent: Tuesday, June 29, 2010 8:05 AM
Subject: Re: org.apache.wicket.WicketRuntimeException: Unable to write the 
response


Don't let the user wait. Use a lazy panel to render the long stuff in
the background, or if it even takes longer than that, calculate your
model data in a background thread and use a timer to poll and see if
the thread has finished, and use the result in a panel that you
replace on your page.

Martijn

On Tue, Jun 29, 2010 at 8:45 AM,  <to...@lantaka.it> wrote:
> Hello,
>
> This is my first post. I am not a web developer, I usually develop other 
> kinds of systems, but for a quick project I have to do, I looked at JSF 
> and I really did not like it. Finally, I have come across wicket and it 
> was love at first sight.
>
> Now, so far everything has been straightforward, but I am now facing the 
> first puzzle...
>
> I have a page that takes a while to render and, while it's rendering, if 
> the user does anything, then I get:
>
> org.apache.wicket.WicketRuntimeException: Unable to write the response
> at org.apache.wicket.Response.handleException(Response.java:286)
> at org.apache.wicket.Response.write(Response.java:310)
> at 
> org.apache.wicket.request.target.resource.ResourceStreamRequestTarget.respond(ResourceStreamRequestTarget.java:160)
> at 
> org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)
> at org.apache.wicket.RequestCycle.respond(RequestCycle.java:1267)
> at org.apache.wicket.RequestCycle.step(RequestCycle.java:1334)
> at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
> at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
> at 
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479)
> at 
> org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:138)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> .... etc ...
> Caused by: EOFException(java.net.SocketException: Connection reset by 
> peer: socket write error)
> at 
> org.mortbay.http.BufferedOutputStream.flush(BufferedOutputStream.java:195)
> at 
> org.mortbay.util.ByteBufferOutputStream.ensureSpareCapacity(ByteBufferOutputStream.java:342)
> at 
> org.mortbay.util.ByteBufferOutputStream.write(ByteBufferOutputStream.java:182)
> at 
> org.mortbay.http.BufferedOutputStream.write(BufferedOutputStream.java:135)
> at org.mortbay.http.HttpOutputStream.write(HttpOutputStream.java:442)
> at org.mortbay.jetty.servlet.ServletOut.write(ServletOut.java:42)
> at org.apache.wicket.util.io.Streams.copy(Streams.java:121)
> at org.apache.wicket.util.io.Streams.copy(Streams.java:88)
> at org.apache.wicket.Response.write(Response.java:306)
> ... 23 more
>
> 00:39:32.335 WARN!! Invalid length: Content-Length=9491 written=4096 for 
> http://127.0.0.1:8081/quickstart/app/
> ERROR - WicketFilter - closing the buffer error
> java.lang.IllegalStateException
> at 
> org.mortbay.jetty.servlet.ServletHttpResponse.getWriter(ServletHttpResponse.java:540)
> at org.apache.wicket.protocol.http.WebResponse.write(WebResponse.java:392)
> .... etc ...
>
> Now, this would be ok, I suppose. The user clicks something while wicket 
> is sending stuff and that operation has to abort. However, this except 
> really corrupts things, after this exception the web page behaves very 
> strangely, some of wicket:ids do not update well anymore etc...
> In the book Wicket in Action it says that a page is single threaded and 
> all I am doing here is using one single page, one sesion, two request, 
> quickly one after the other, before the first one completes.
>
> I am using: INFO - WebApplication - [QuickStartApplication] Started Wicket 
> version 1.4.8 in development mode
> And I have downlowded a hello world project (quickstart) adapted it to 
> 1.4.8 (generics pretty much) and not yet refactored things as I am 
> concentrating on business logic for a quick prototype. The webserver is 
> jetty.
>
> Ok, sorry for the long post, and I hope someone of you will be able to 
> give me a couple of hints/tips (tried to google it, but did not find 
> much).
>
>
> Thanks,
>
> Tommy
>
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.4 increases type safety for web applications
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.8

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: org.apache.wicket.WicketRuntimeException: Unable to write the response

Posted by Martijn Dashorst <ma...@gmail.com>.
Don't let the user wait. Use a lazy panel to render the long stuff in
the background, or if it even takes longer than that, calculate your
model data in a background thread and use a timer to poll and see if
the thread has finished, and use the result in a panel that you
replace on your page.

Martijn

On Tue, Jun 29, 2010 at 8:45 AM,  <to...@lantaka.it> wrote:
> Hello,
>
> This is my first post. I am not a web developer, I usually develop other kinds of systems, but for a quick project I have to do, I looked at JSF and I really did not like it. Finally, I have come across wicket and it was love at first sight.
>
> Now, so far everything has been straightforward, but I am now facing the first puzzle...
>
> I have a page that takes a while to render and, while it's rendering, if the user does anything, then I get:
>
> org.apache.wicket.WicketRuntimeException: Unable to write the response
>  at org.apache.wicket.Response.handleException(Response.java:286)
>  at org.apache.wicket.Response.write(Response.java:310)
>  at org.apache.wicket.request.target.resource.ResourceStreamRequestTarget.respond(ResourceStreamRequestTarget.java:160)
>  at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)
>  at org.apache.wicket.RequestCycle.respond(RequestCycle.java:1267)
>  at org.apache.wicket.RequestCycle.step(RequestCycle.java:1334)
>  at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
>  at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
>  at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479)
>  at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:138)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> .... etc ...
> Caused by: EOFException(java.net.SocketException: Connection reset by peer: socket write error)
>  at org.mortbay.http.BufferedOutputStream.flush(BufferedOutputStream.java:195)
>  at org.mortbay.util.ByteBufferOutputStream.ensureSpareCapacity(ByteBufferOutputStream.java:342)
>  at org.mortbay.util.ByteBufferOutputStream.write(ByteBufferOutputStream.java:182)
>  at org.mortbay.http.BufferedOutputStream.write(BufferedOutputStream.java:135)
>  at org.mortbay.http.HttpOutputStream.write(HttpOutputStream.java:442)
>  at org.mortbay.jetty.servlet.ServletOut.write(ServletOut.java:42)
>  at org.apache.wicket.util.io.Streams.copy(Streams.java:121)
>  at org.apache.wicket.util.io.Streams.copy(Streams.java:88)
>  at org.apache.wicket.Response.write(Response.java:306)
>  ... 23 more
>
> 00:39:32.335 WARN!! Invalid length: Content-Length=9491 written=4096 for http://127.0.0.1:8081/quickstart/app/
> ERROR - WicketFilter               - closing the buffer error
> java.lang.IllegalStateException
>  at org.mortbay.jetty.servlet.ServletHttpResponse.getWriter(ServletHttpResponse.java:540)
>  at org.apache.wicket.protocol.http.WebResponse.write(WebResponse.java:392)
> .... etc ...
>
> Now, this would be ok, I suppose. The user clicks something while wicket is sending stuff and that operation has to abort. However, this except really corrupts things, after this exception the web page behaves very strangely, some of wicket:ids do not update well anymore etc...
> In the book Wicket in Action it says that a page is single threaded and all I am doing here is using one single page, one sesion, two request, quickly one after the other, before the first one completes.
>
> I am using: INFO  - WebApplication             - [QuickStartApplication] Started Wicket version 1.4.8 in development mode
> And I have downlowded a hello world project (quickstart) adapted it to 1.4.8 (generics pretty much) and not yet refactored things as I am concentrating on business logic for a quick prototype. The webserver is jetty.
>
> Ok, sorry for the long post, and I hope someone of you will be able to give me a couple of hints/tips (tried to google it, but did not find much).
>
>
> Thanks,
>
> Tommy
>
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.4 increases type safety for web applications
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.8

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org