开发者

javax.xml.ws.WebServiceException: java.net.SocketException: Unexpected end of file from server

开发者 https://www.devze.com 2023-03-15 18:37 出处:网络
We are developing an application for an academic course of software architecture and we must use Java EE to implement that.

We are developing an application for an academic course of software architecture and we must use Java EE to implement that.

Essentially we have to implement a distributed Hearts game(you know the Windows game? I think so).

We want to use SOAP to make the client able to communicate with the server (glassfish in our case) but to avoid polling we need to implement the web service endpoint as a @WebServiceProvider.

Such kind of endopoit can implement the asyncProvider interface that allow us to decoplue soap request and soap response. But here we have 2 big problems:

  • The first one is that: glassfish (without any additional settings) can use a set of only 5 threads in the http-thread-pool. After the first five request we have the endopoint servlet "blocked". Is that the right mode to work of asyncProvider? After the invoke termination we were expecting that the servlet thread was released to process another one incoming request but, apparently, it does not work in this way. It's not a real "async" managment of the request. Are we wrong?

  • The second one: We are pretty sure that the problem we are introducing is strictly correlated with the first one. Making ten request with a thread pool size of 5 we have this scenario: The first five requests are well processed and, after a timeout of 20 seconds, they are correctly sent to the client. From the sixth to the last we have some mistake: in the server side everything is ok, but in the client-side and only sometimes we have an excpetion like this:

java.util.concurrent.ExecutionException: javax.xml.ws.WebServiceException: java.net.SocketException: Unexpected end of file from server

at com.sun.xml.ws.util.CompletedFuture.get(CompletedFuture.java:72)

at client.Client$1.handleResponse(Client.java:79)

at com.sun.xml.ws.client.AsyncResponseImpl.set(AsyncResponseImpl.java:125)

at com.sun.xml.ws.client.sei.AsyncMethodHandler$SEIAsyncInvoker$开发者_运维百科1.onCompletion(AsyncMethodHandler.java:202)

at com.sun.xml.ws.client.Stub$1.onCompletion(Stub.java:397)

at com.sun.xml.ws.api.pipe.Fiber.completionCheck(Fiber.java:503)

at com.sun.xml.ws.api.pipe.Fiber.run(Fiber.java:423)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

at java.lang.Thread.run(Thread.java:662)

Caused by: javax.xml.ws.WebServiceException: java.net.SocketException: Unexpected end of file from server

at com.sun.xml.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:214)

at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:162)

at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:93)

at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105)

at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629)

at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)

at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)

at com.sun.xml.ws.api.pipe.Fiber.run(Fiber.java:422)

... 3 more

Caused by: java.net.SocketException: Unexpected end of file from server

at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:769)

at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)

at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:766)

at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)

at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)

at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)

at com.sun.xml.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:210)

... 10 more

We want to highlight that the content of the soap response is validated and well-formed after checking it without any exception at the server side.

If we send a number of request lower than the http-thread-pool size we have no problem.

Any suggestion for us?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号