aspose file tools*
The moose likes Other Application Frameworks and the fly likes Closing Buffer Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Closing Buffer Error" Watch "Closing Buffer Error" New topic

Closing Buffer Error

Vinayak More

Joined: Mar 12, 2013
Posts: 1
Hi Friends,

I'm getting Closing Buffer Error . I read lot of forums but unable to resolve it. Could you please help me to resolve it..I have attach comple code

2013-03-12 05:46:34,160 120563 ERROR WebResponse: Unable to redirect to: ?wicket:interface=:2:36::::, HTTP Response has already been committed.
2013-03-12 05:46:34,302 120705 ERROR WicketFilter: closing the buffer error
java.lang.IllegalStateException: Committed
at org.mortbay.jetty.Response.resetBuffer(
at org.mortbay.jetty.Response.sendRedirect(
at org.apache.wicket.protocol.http.WebResponse.sendRedirect(
at org.apache.wicket.protocol.http.WebResponse.redirect(
at org.apache.wicket.protocol.http.BufferedWebResponse.close(
at org.apache.wicket.protocol.http.WicketFilter.doGet(
at org.apache.wicket.protocol.http.WicketFilter.doFilter(
at com.uprr.ui.wicket.components.infrastructure.RicolaWicketFilter.doFilter(
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(
at org.mortbay.jetty.servlet.ServletHandler.handle(
at org.mortbay.jetty.servlet.SessionHandler.handle(
at org.mortbay.jetty.handler.ContextHandler.handle(
at org.mortbay.jetty.webapp.WebAppContext.handle(
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(
at org.mortbay.jetty.handler.HandlerCollection.handle(
at org.mortbay.jetty.handler.HandlerWrapper.handle(
at org.mortbay.jetty.Server.handle(
at org.mortbay.jetty.HttpConnection.handleRequest(
at org.mortbay.jetty.HttpConnection$RequestHandler.content(
at org.mortbay.jetty.HttpParser.parseNext(
at org.mortbay.jetty.HttpParser.parseAvailable(
at org.mortbay.jetty.HttpConnection.handle(
at org.mortbay.thread.QueuedThreadPool$

private void addPrintButton11() {
Button printButton = new Button("printButton11") {
private static final long serialVersionUID = 1L;

public void onSubmit() {
final List<SystemGeneralOrderSearchModel> list = new ArrayList<SystemGeneralOrderSearchModel>(0);
// Error Message if non of the Check box selected
if (getSgoGrid().getSelectedItems().isEmpty()) {
error(new ResourceModel("error_service_unit_checkbox_select").getObject().toString());
// /target.addComponent(getFeedbackPanel());
} else {
// Adding selected records in the list
for (final SystemGeneralOrderSearchModel systemGeneralOrderSearchModel : getSgoGrid().getSelectedItems()) {
// Skip Sys. SI. 0 record as a part of Merging
if (!RCRFEnum.SSI_0.value().equalsIgnoreCase(systemGeneralOrderSearchModel.getOrderCategory())) {
new ViewSelectedEffectiveSystemGeneralOrder(list);


private void viewMergedPDF(List<SystemGeneralOrderSearchModel> list)
ByteArrayOutputStream byteArrayOutputStream = null;
String fileName = new ResourceModel("effectiveMergedSystemGeneralOrder").getObject().toString();
OutputStream outs = null;
byteArrayOutputStream = pdfMergeService.mergeSelectedPDFUsingWindow(list);
// To open PDF Dialog box
if (byteArrayOutputStream != null) {
try {
WebResponse response = (WebResponse) getRequestCycle().getResponse();
outs = response.getOutputStream();
outs = null;
} catch (Exception ex) {
LOGGER.error("Exception occured while opening PDF :", ex);
finally {
if (outs != null) {
try {
catch (Exception e) {
LOGGER.error("Error occured in viewMergedPDF Finally Block", e);

public ByteArrayOutputStream mergeSelectedPDFUsingWindow(List<?> list) {
final ByteArrayOutputStream baos= new ByteArrayOutputStream();
StringBuilder fileName = new StringBuilder();
Document document = new Document();
PdfCopy copy = null;
int i = 1;
//Server Path
if (ERTHelper.isLocalMode()) {
} else {

try {
copy = new PdfCopy(document, baos);;

for (Object object : list) {
// Bulletins Records
if (object instanceof Bulletin) {
Bulletin bulletin = (Bulletin) object;
if (i == 1) {
fileName.append(bulletin.getServiceUnitName().replaceAll(" ", ""));
// Merging all PDF Files
mergeFiles(fileName.toString()+(bulletin.getCategoryId()+ERTEnum.PDF_FILE.value()), copy);
i = 0;
// System General Order Records
else if (object instanceof SystemGeneralOrderSearchModel) {
SystemGeneralOrderSearchModel systemGeneralOrder = (SystemGeneralOrderSearchModel) object;
mergeFiles(fileName.toString()+getPDFFileName(systemGeneralOrder.getOrderCategory()), copy);

} catch (Exception e) {
LOGGER.error("Error occured MergeSelectedPDF ", e);

return baos;
subject: Closing Buffer Error
Similar Threads
How jsp and a pdf document displayed in the same browser?
Upload using O'Reilly package
Closing the Buffer error
feeding byte[] to crreate a pdf
generate pdf and display on browser when clicked on link