[#13521] - getOutputStream() has already been called for this response

Category:
General
Priority:
Normal
Status:
Feedback Requested
Project: Severity:
Major
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:
0

Create minimal report with only detail band with a simple barcode (barcode4j) code128 with fixed code "123456789"
Link org.krisalis barcode4j.jar ver2.1 in lib directory of web application
After compile and fill the report the servlet out with:
JasperExportManager.exportReportToPdfStream(jp, response.getOutputStream());
and error in tomcat is:
getOutputStream() has already been called for this response
seem that are no stream in response.
If i delete barcode component and add a simple text component all run correctly and servlet response with pdf stream in browser
How i can print barcode ?

v6.16.0
Barcode4j
cicciorossi15's picture
Joined: Apr 23 2021 - 10:55am
Last seen: 18 hours 22 min ago

2 Comments:

#1

With barbecue all run ok

#2
  • Status:New» Feedback Requested
  • Assigned:nobody» teodord

I'm not sure this is related to JasperReports. This is a common servlet/JSP issue which occurs when output has already started to be sent to the response and the program tries to acquire the output stream again.
It usually happens with JSP files which have some blank space in them and thus start to write them to the response before the program tries to get the output stream and write bytes to it.
The best way to solve this is to use a servlet and make sure it writes to the response output only in one place.

I hope this helps.
Teodor

Feedback
randomness