0

I've a master JSP page which uses <s:include/> tag to include 3 other JSP files. One of the 3 JSP file has large text body. When the action class returns success the master JSP should be invoked should load the content from the other 3 JSP-s. In doing so it is throwing BufferOverflowException:

java.nio.BufferOverflowException
at java.nio.HeapByteBuffer.put(Unknown Source)
at org.apache.struts2.util.FastByteArrayOutputStream.decodeAndWriteOut(FastByteArrayOutputStream.java:150)
at org.apache.struts2.util.FastByteArrayOutputStream.writeTo(FastByteArrayOutputStream.java:93)
at org.apache.struts2.components.Include.include(Include.java:260)
at org.apache.struts2.components.Include.end(Include.java:153)
at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)

I've tried the following approaches but still getting the same exception
1) Adding the page attribute to JSP-s <%@ page buffer="64kb" autoFlush="true"%>
2) modified connector entry in server.xml

<Connector connectionTimeout="20000" port="8081" protocol="org.apache.coyote.http11.Http11NioProtocol" redirectPort="8443" socket.appWriteBufSize="64000"/>

Any suggestions would be greatly appreciated.

Roman C
  • 49,761
  • 33
  • 66
  • 176
Gopi
  • 620
  • 8
  • 16
  • How big is *large text body*? – Aleksandr M Nov 23 '17 at 18:24
  • Which Struts2 version you are using? – Aleksandr M Nov 24 '17 at 18:51
  • I'm using Struts 2.5.13 and the text is couple of word doc pages... – Gopi Nov 24 '17 at 20:23
  • Can you show snippet of your code? It works for me, at least for less than 65k - https://stackoverflow.com/q/17422480/1700321. – Aleksandr M Nov 27 '17 at 18:25
  • I've resolved this issue. There were some special invisible characters that were copied to jsp as part of the static text content. This was causing BufferOverflow exception, which is strange as the buffer limit has nothing to do with special characters. After getting rid of the special characters, page loads nicely. – Gopi Dec 14 '17 at 20:16

0 Answers0