java.io.IOException: Stream Closed

Jenkins JIRA | Raphael CHAUMIER | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    https://github.com/jenkinsci/weblogic-deployer-plugin/commit/981fc3eacd1979833ff2674fbea1c410bd626f2b It seems like the log file stream is closed a bit too early (before calling the deploy() method which then uses that stream). As a result, my deployment log file is empty and Jenkins prints the following stacktrace: 11:07:04 java.io.IOException: Stream Closed 11:07:04 at java.io.FileOutputStream.writeBytes(Native Method) 11:07:04 at java.io.FileOutputStream.write(FileOutputStream.java:325) 11:07:04 at org.jenkinsci.plugins.deploy.weblogic.task.DeploymentTaskServiceImpl.undeploy(DeploymentTaskServiceImpl.java:284) 11:07:04 at org.jenkinsci.plugins.deploy.weblogic.task.DeploymentTaskServiceImpl.perform(DeploymentTaskServiceImpl.java:182) 11:07:04 at org.jenkinsci.plugins.deploy.weblogic.WeblogicDeploymentPlugin.perform(WeblogicDeploymentPlugin.java:236) 11:07:04 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) 11:07:04 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785) 11:07:04 at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:757) 11:07:04 at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1020) 11:07:04 at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:706) 11:07:04 at hudson.model.Run.execute(Run.java:1702) 11:07:04 at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:509) 11:07:04 at hudson.model.ResourceController.execute(ResourceController.java:88) 11:07:04 at hudson.model.Executor.run(Executor.java:231) 11:07:04 ERROR: [WeblogicDeploymentPlugin] - Failed to deploy.

    Jenkins JIRA | 3 years ago | Raphael CHAUMIER
    java.io.IOException: Stream Closed
  2. 0

    https://github.com/jenkinsci/weblogic-deployer-plugin/commit/981fc3eacd1979833ff2674fbea1c410bd626f2b It seems like the log file stream is closed a bit too early (before calling the deploy() method which then uses that stream). As a result, my deployment log file is empty and Jenkins prints the following stacktrace: 11:07:04 java.io.IOException: Stream Closed 11:07:04 at java.io.FileOutputStream.writeBytes(Native Method) 11:07:04 at java.io.FileOutputStream.write(FileOutputStream.java:325) 11:07:04 at org.jenkinsci.plugins.deploy.weblogic.task.DeploymentTaskServiceImpl.undeploy(DeploymentTaskServiceImpl.java:284) 11:07:04 at org.jenkinsci.plugins.deploy.weblogic.task.DeploymentTaskServiceImpl.perform(DeploymentTaskServiceImpl.java:182) 11:07:04 at org.jenkinsci.plugins.deploy.weblogic.WeblogicDeploymentPlugin.perform(WeblogicDeploymentPlugin.java:236) 11:07:04 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) 11:07:04 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785) 11:07:04 at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:757) 11:07:04 at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1020) 11:07:04 at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:706) 11:07:04 at hudson.model.Run.execute(Run.java:1702) 11:07:04 at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:509) 11:07:04 at hudson.model.ResourceController.execute(ResourceController.java:88) 11:07:04 at hudson.model.Executor.run(Executor.java:231) 11:07:04 ERROR: [WeblogicDeploymentPlugin] - Failed to deploy.

    Jenkins JIRA | 3 years ago | Raphael CHAUMIER
    java.io.IOException: Stream Closed
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    WebLogic Deployer Plugin - Jenkins - Jenkins Wiki

    jenkins-ci.org | 8 months ago
    java.io.IOException: Stream Closed
  5. 0

    While executing multipart form request using RESTEasy client builder API, I get the following error. {noformat} javax.ws.rs.ProcessingException: Unable to invoke request at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.invoke(ApacheHttpClient4Engine.java:287) at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:407) at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:102) at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:62) at com.sun.proxy.$Proxy34.uploadPhoto(Unknown Source) at org.samples.javaee7.arquillian.MultipartResourceTest.multipartPost_TempFile(MultipartResourceTest.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.jboss.arquillian.junit.Arquillian$8$1.invoke(Arquillian.java:370) at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145) at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116) at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67) at org.jboss.arquillian.container.test.impl.execution.ClientTestExecuter.execute(ClientTestExecuter.java:53) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:142) at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createTestContext(ContainerEventController.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:130) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:92) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145) at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:136) at org.jboss.arquillian.junit.Arquillian$8.evaluate(Arquillian.java:363) at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:245) at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:422) at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:54) at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:259) at org.jboss.arquillian.junit.Arquillian$7$1.invoke(Arquillian.java:315) at org.jboss.arquillian.container.test.impl.execution.ClientBeforeAfterLifecycleEventExecuter.execute(ClientBeforeAfterLifecycleEventExecuter.java:99) at org.jboss.arquillian.container.test.impl.execution.ClientBeforeAfterLifecycleEventExecuter.on(ClientBeforeAfterLifecycleEventExecuter.java:72) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:142) at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createBeforeContext(ContainerEventController.java:124) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:130) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:92) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145) at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116) at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.fireCustomLifecycle(EventTestRunnerAdaptor.java:159) at org.jboss.arquillian.junit.Arquillian$7.evaluate(Arquillian.java:311) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:204) at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:422) at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:54) at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:218) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:166) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) Caused by: java.lang.RuntimeException: java.io.IOException: Stream Closed at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.loadHttpMethod(ApacheHttpClient4Engine.java:430) at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.invoke(ApacheHttpClient4Engine.java:281) ... 131 more Caused by: java.io.IOException: Stream Closed at java.io.FileOutputStream.writeBytes(Native Method) at java.io.FileOutputStream.write(FileOutputStream.java:325) at org.apache.commons.io.output.ThresholdingOutputStream.write(ThresholdingOutputStream.java:110) at org.jboss.resteasy.util.DelegatingOutputStream.write(DelegatingOutputStream.java:42) at org.jboss.resteasy.plugins.providers.multipart.AbstractMultipartWriter.writePart(AbstractMultipartWriter.java:61) at org.jboss.resteasy.plugins.providers.multipart.AbstractMultipartFormDataWriter.writeParts(AbstractMultipartFormDataWriter.java:33) at org.jboss.resteasy.plugins.providers.multipart.AbstractMultipartWriter.write(AbstractMultipartWriter.java:33) at org.jboss.resteasy.plugins.providers.multipart.MultipartFormAnnotationWriter.writeTo(MultipartFormAnnotationWriter.java:81) at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.writeTo(AbstractWriterInterceptorContext.java:129) at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:118) at org.jboss.resteasy.plugins.interceptors.encoding.GZIPEncodingInterceptor.aroundWriteTo(GZIPEncodingInterceptor.java:100) at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:122) at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.writeRequestBody(ClientInvocation.java:341) at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.writeRequestBodyToOutputStream(ApacheHttpClient4Engine.java:558) at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.buildEntity(ApacheHttpClient4Engine.java:524) at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.loadHttpMethod(ApacheHttpClient4Engine.java:423) ... 132 more {noformat} After some debugging, it seems there is some issue with use of ThresholdingOutputStream. The issue occurs when size of input request is bigger than the FileUploadInMemoryThresholdLimit. In the sample testcase, I'm uploading a file of 236KB. If I set FileUploadInMemoryThresholdLimit to 256KB, upload request works fine. But if I reduce the limit to something lower than the file size e.g. 64KB; upload request fails with stream closed error. MultipartForm bean used for upload request. {code} public class DocumentForm { @FormParam("content") @PartType(MediaType.APPLICATION_OCTET_STREAM) private InputStream content; @FormParam("filename") @PartType(MediaType.TEXT_PLAIN) private String filename; @FormParam("username") @PartType(MediaType.TEXT_PLAIN) private String username; @FormParam("employee") @PartType(MediaType.APPLICATION_JSON) private Employee employee; {code} Another strange observation is if I change the order of properties in the above bean by moving "employee" before "content"; upload works fine irrespective of file size. {code} public class DocumentForm { @FormParam("employee") @PartType(MediaType.APPLICATION_JSON) private Employee employee; @FormParam("content") @PartType(MediaType.APPLICATION_OCTET_STREAM) private InputStream content; @FormParam("filename") @PartType(MediaType.TEXT_PLAIN) private String filename; @FormParam("username") @PartType(MediaType.TEXT_PLAIN) private String username; {code}

    JBoss Issue Tracker | 2 years ago | Aparna Chaudhary
    javax.ws.rs.ProcessingException: Unable to invoke request

  1. davidvanlaatum 8 times, last 3 months ago
6 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.io.IOException

    Stream Closed

    at java.io.FileOutputStream.writeBytes()
  2. Java RT
    FileOutputStream.write
    1. java.io.FileOutputStream.writeBytes(Native Method)
    2. java.io.FileOutputStream.write(FileOutputStream.java:325)
    2 frames
  3. org.jenkinsci.plugins
    WeblogicDeploymentPlugin.perform
    1. org.jenkinsci.plugins.deploy.weblogic.task.DeploymentTaskServiceImpl.undeploy(DeploymentTaskServiceImpl.java:284)
    2. org.jenkinsci.plugins.deploy.weblogic.task.DeploymentTaskServiceImpl.perform(DeploymentTaskServiceImpl.java:182)
    3. org.jenkinsci.plugins.deploy.weblogic.WeblogicDeploymentPlugin.perform(WeblogicDeploymentPlugin.java:236)
    3 frames
  4. Hudson
    AbstractBuild$AbstractBuildExecution.performAllBuildSteps
    1. hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    2. hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785)
    3. hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:757)
    3 frames
  5. Hudson Maven Embedder
    MavenModuleSetBuild$MavenModuleSetBuildExecution.post2
    1. hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1020)
    1 frame
  6. Hudson
    Run.execute
    1. hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:706)
    2. hudson.model.Run.execute(Run.java:1702)
    2 frames
  7. Hudson Maven Embedder
    MavenModuleSetBuild.run
    1. hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:509)
    1 frame
  8. Hudson
    Executor.run
    1. hudson.model.ResourceController.execute(ResourceController.java:88)
    2. hudson.model.Executor.run(Executor.java:231)
    2 frames