Warum O2
Warenkorb
Service
Frage

Handyfinder funktioniert (seit Wochen?) nicht. Versuch einer Vorlage für die Programmierer.

  • 21 March 2019
  • 1 Antwort
  • 149 Aufrufe

Hallo eventuelle Lesende/r/innen/Diverse/... von O2, Content Provider und übrige Community

wie mancher andere User möchte ich gelegentlich mein verlegtes Telefon orten. Da gibt es den klangvollen und möglicherweise verdienten Handyfinder.
Leider weiß ich weder, wie gut die Ortungs-Geodaten sind, noch funktioniert der Service (und das wohl schon für geraume Zeit).
Sollte dies jemand vom Service/Software lesen, so wäre es schön, wenn man sich z.B. Gedanken um möglicherweise nicht/erfolgte Updates der App o.ä. macht. Ich füge abschließend ein Snippet an, das für die hier beklagte nachfolgende Fehlermeldung des Servers vielleicht eine Lösungs-Vorlage sein könnte.

HTTP Status 500 – Internal Server Error

Type Exception Report
Message Cannot call sendRedirect() after the response has been committed
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
code:
java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed
org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:482)
com.o2.handyfinder.auth.HandyfinderAuthFilter.doFilter(HandyfinderAuthFilter.java:101)


Note The full stack trace of the root cause is available in the server logs.

Apache Tomcat/7.0.91


Und nun das Snippet:

Cannot call sendRedirect() after the response has been committed


So for the past few months I've noticed the following error on one page in our system: Cannot call sendRedirect() after the response has been committed
Nothing on that page that deals with the request or response has changed in the past few months and the error was only happening on my dev machine, our test and production servers worked fine, so I thought it was just my machine. The other day a colleague mentioned they were also getting the error. So we started looking into it. The java code in the page seemed fine, so for a while we were stumped. He realized that over the past few months lots of html code was put before the sendRedirect. So we moved the redirect to happen before the HTML code and our problem went away. Which reminded me, I've read somewhere that you can't have any HTML tags on a JSP page before the sendRedirect call because those tags are written to the response as they are hit, which effectively commits the response to that page making it impossible to forward to another page.

Lessons learned: Don't use a JSP page as a servlet or you will have weird bugs that only make sense when you view the generated code; don't forget HTML on a JSP commits the response.

Wie wär's?
Ich bin gespannt auf das Echo.
MfG G.

1 Antwort

Nur nicht den Link zum Snippet vergessen: https://programmersbane.blogspot.com/2013/02/cannot-call-sendredirect-after-response.html

Deine Antwort