java.lang.IllegalStateException: Cannot read while there is an open stream writer

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Solutions on the web

via Stack Overflow by RDR
, 1 year ago
via Stack Overflow by Hari R
, 7 months ago
Cannot read while there is an open stream writer
java.lang.IllegalStateException: Cannot read while there is an open stream writer
at org.apache.pdfbox.cos.COSStream.createRawInputStream(COSStream.java:129)
at org.apache.pdfbox.pdfwriter.COSWriter.visitFromStream(COSWriter.java:1177)
at org.apache.pdfbox.cos.COSStream.accept(COSStream.java:372)
at org.apache.pdfbox.pdfwriter.COSWriter.doWriteObject(COSWriter.java:561)
at org.apache.pdfbox.pdfwriter.COSWriter.doWriteObjects(COSWriter.java:490)
at org.apache.pdfbox.pdfwriter.COSWriter.doWriteBody(COSWriter.java:474)
at org.apache.pdfbox.pdfwriter.COSWriter.visitFromDocument(COSWriter.java:1073)
at org.apache.pdfbox.cos.COSDocument.accept(COSDocument.java:419)
at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1331)
at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1229)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1095)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1067)
at com.helper.ScreenshotPDF.screenshotPDF(ScreenshotPDF.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:774)
at org.testng.TestRunner.run(TestRunner.java:624)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
at org.testng.SuiteRunner.run(SuiteRunner.java:261)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1048)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:152)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:57)

Users with the same issue

You are the first who have seen this exception. Write a tip to help other users and build your expert profile.

Know the solutions? Share your knowledge to help other developers to debug faster.