Hi,

I see out.close() in the writeXML method of yours.. I do not think you
should be closing it.

Can you try removing that and putting it to a test?

Regards,
-yogesh

On Friday, August 8, 2014, Filip Hanik <fi...@hanik.com> wrote:

> if you could capture the XML that you are trying to write, we can put it
> into a test case and reproduce.
>
> Filip
>
>
>
> On Thu, Aug 7, 2014 at 3:24 PM, Terence M. Bandoian <tere...@tmbsw.com
> <javascript:;>>
> wrote:
>
> > On 8/7/2014 10:04 AM, John Smith wrote:
> >
> >> TC 7.0.54 / RHEL 6 / JDK 1.7.0_60
> >>
> >> I'm getting a pretty consistent error in my logs that started showing up
> >> recently. I use logback and have a servlet catch all 500 errors and log
> >> them. The error seems to be associated with one servlet that writes XML
> >> output.
> >>
> >> Two changes I made recently were implement SSL for one subdirectory on
> the
> >> webapp, and removing redirects in IPTables to the HWLB. I can't really
> >> think of any other code level changes that might have caused the change
> in
> >> behavior. Please let me know if you need more information. Any thoughts?
> >>
> >> The writeXML method is:
> >>
> >> protected void writeXML(HttpServletResponse res, String xml) throws
> >> IOException {
> >>          res.setContentType("text/xml");
> >>          PrintWriter out = res.getWriter();
> >>          out.write(xml);
> >>          out.close();
> >> }
> >>
> >>
> >> The stacktrace almost always looks like this:
> >> _____________________________________
> >> 14:18:59.617 [http-nio-8080-exec-45] ERROR c.m.
> >> SiteExceptionHandlerServlet
> >> - Stacktrace was: java.lang.IllegalArgumentException
> >> at java.nio.Buffer.limit(Buffer.java:267)
> >> at org.apache.tomcat.util.buf.C2BConverter.convert(C2BConverter.java:85)
> >> at
> >> org.apache.catalina.connector.OutputBuffer.realWriteChars(
> >> OutputBuffer.java:481)
> >> at org.apache.tomcat.util.buf.CharChunk.flushBuffer(CharChunk.java:464)
> >> at org.apache.tomcat.util.buf.CharChunk.append(CharChunk.java:384)
> >> at org.apache.catalina.connector.OutputBuffer.write(
> >> OutputBuffer.java:554)
> >> at org.apache.catalina.connector.CoyoteWriter.write(
> >> CoyoteWriter.java:174)
> >> at org.apache.catalina.connector.CoyoteWriter.write(
> >> CoyoteWriter.java:184)
> >> at com.mysite.AbstractServlet.writeXML(AbstractServlet.java:182)
> >> at com.mysite.level.GetLevelServlet.getAllAsXML(GetLevelServlet.java:82)
> >> at com.mysite.level.GetLevelServlet.manageActions(
> >> GetLevelServlet.java:33)
> >> at com.mysite.AbstractServlet.doPost(AbstractServlet.java:52)
> >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
> >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
> >> ...
> >> __________________________
> >>
> >> Although there are variations like:
> >>
> >> Stacktrace was: java.lang.IllegalArgumentException
> >> at java.nio.Buffer.position(Buffer.java:236)
> >> at sun.nio.cs.ISO_8859_1$Encoder.encodeArrayLoop(ISO_8859_1.java:179)
> >> at sun.nio.cs.ISO_8859_1$Encoder.encodeLoop(ISO_8859_1.java:212)
> >> at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:561)
> >> at
> org.apache.tomcat.util.buf.C2BConverter.convert(C2BConverter.java:108)
> >> at
> >> org.apache.catalina.connector.OutputBuffer.realWriteChars(
> >> OutputBuffer.java:481)
> >> at org.apache.tomcat.util.buf.CharChunk.flushBuffer(CharChunk.java:464)
> >> at org.apache.tomcat.util.buf.CharChunk.append(CharChunk.java:384)
> >> at org.apache.catalina.connector.OutputBuffer.write(
> >> OutputBuffer.java:554)
> >> at org.apache.catalina.connector.CoyoteWriter.write(
> >> CoyoteWriter.java:174)
> >> at org.apache.catalina.connector.CoyoteWriter.write(
> >> CoyoteWriter.java:184)
> >> at com.mysite.AbstractServlet.writeXML(AbstractServlet.java:182)
> >>
> >> ___________________
> >>
> >>
> >
> > What's on line 182 of AbstractServlet.java?
> >
> > -Terence Bandoian
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> <javascript:;>
> > For additional commands, e-mail: users-h...@tomcat.apache.org
> <javascript:;>
> >
> >
>

Reply via email to