0

I've recently installed an ssl certificate on my server and switched the url in the client program to use the https version of the url. Now, for some reason, when sending files to the server, the parameters sent on the multipart request aren't on the request. But sometimes they are on the request but then the files on the multipart request seem to be corrupted and I get EOFException when reading the files. It's really strange. I'm using Apache's HttpClient library to send the files to the server. Does anyone know what this could be? Below is the error that I'm getting on the server when attempting to deserialize the files:

  java.io.EOFException
    at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2325)
    at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2794)
    at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:801)
    at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
    at com.jgy.genserver.service.CreateDomainsAndDaosImpl.deserializeObject(CreateDomainsAndDaosImpl.java:741)
    at com.jgy.genserver.service.CreateDomainsAndDaosImpl.createDomainsAndDaos(CreateDomainsAndDaosImpl.java:70)
    at com.jgy.genserver.controller.CreationController.uploadFile(CreationController.java:199)
    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.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:61

7) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)

1 Answers1

0

Ok, I figured it out and wanted to post the answer in case anyone else comes across this issue. The problem was that the stream was being closed prematurely before all of the files could be read. This is because I was grabbing one file at a time and doing processing on the file before I grab the next one. Evidently, an https connection isn't stable enough to do that. I'm guessing that since it's a secure transmission the stream isn't maintained for long.

  • Just an update to the answer. Even after changing the code to grab all of the files off of the request immediately, I was still having the same issue. So I looked around and found an example on using the httpclient library to send a multipart request. The code that I had written was not using the most up-to-date components so I switched out the httpclient components in my code for the up-to-date httpclient components in the code from this apache example: https://hc.apache.org/httpcomponents-client-ga/httpmime/examples/org/apache/http/examples/entity/mime/ClientMultipartFormPost.java – user2488184 Sep 25 '14 at 05:14