2012-10-17 33 views
2

我有基於澤西的REST資源類,每個資源都提供一個JSON對象。我有一個簡單的HTML + Javascipt接口,其中來自每個REST資源的數據通過jquery ajax調用獲取,返回的JSON呈現爲ExtJS網格。由於響應已經提交,因此無法使用WebApplicationException的響應。重新投擲到HTTP容器

根據用戶選擇的內容(多個複選框),創建多個ajax調用,並且成功方法將json渲染爲一個Grid。

其中一個Ajax調用需要大約一分鐘,而另一個需要大約4-10秒。

有時,我在服務器端看到這個「Timeout」錯誤(堆棧跟蹤粘貼在下面),然後調用Ajax的錯誤方法。 只有當我在工作中的無線網絡時纔會發生這種情況,但在有線連接時正常工作。

我不知道是怎麼回事:

if(//Checkbox-1 is selected){ 
    $.ajax({ 
      url: url, 
      type: 'GET', 
      timeout: '120000', 
      dataType: 'json', 
      success: function(data){ 
       displayExtJsGrid1(data); //this displays the grid 1 in div1 element. 
      }, 
      error: function(){ 
       $("#div1").html("Error: Couldn't get results of analysis"); 
      } 
      }); 
} 
if (//checkbox-2 is selected){ 
    $.ajax({ 
      url: url, 
      type: 'GET',       
      timeout: '120000', 
      dataType: 'json', 
      success: function(data){ 
       displayExtJsGrid2(data); //this displays the grid 2 in div2 element. 
      },       
      error: function(){ 
       $("#div2").html("Error: Couldn't get results of analysis"); 
      } 
    }); 
} 
if (//checkbox-3 is selected){ 
    ..... 
    .....similar to above call.... 
} 

在服務器端,我的JAX-RS(球衣)資源是這樣的:

@GET 
@Produces({ "application/json","application/xml"}) 
@Path("/{data} 
public List<Result> getAnalysisOne(@PathParam("data") String data){ 
    try {   
     //Invokes a DAO class that does some computations 

    } catch (Exception e) { 
     throw new WebApplicationException(Response.status(
       Status.BAD_REQUEST).type("application/xml").entity(
       "<error>Error</error>").build()); 
    } 
    return results; 
} 

@GET 
@Produces({ "application/json","application/xml"}) 
@Path("/two/{data} 
public List<Result> getAnalysisTwo(@PathParam("data") String data){ 
    try {   
     //Invokes a DAO class that does some computations 

    } catch (Exception e) { 
     throw new WebApplicationException(Response.status(
       Status.BAD_REQUEST).type("application/xml").entity(
       "<error>Error</error>").build()); 
    } 
    return results; 
} 

奇怪的是我得到以下錯誤主要是當我在無線連接(這不是很好),並且在有線連接(所有網格得到呈現)上工作得很好。在客戶端,當我收到這個錯誤時,Ajax的Error方法被調用。大多數情況下,這是第一次ajax調用(大約需要一分鐘才能返回),而其他人則成功並顯示網格。

我正在使用jetty-maven-plugin的mvn碼頭:運行以啓動Jersey資源和webapp。我使用JAXB根據請求類型(xml或json)對數據進行封送處理。

在服務器端錯誤:

Oct 17, 2012 12:20:07 AM com.sun.jersey.server.impl.application.WebApplicationImpl _handleRequest 
SEVERE: The response of the WebApplicationException cannot be utilized as the response is already committed. Re-throwing to the HTTP container 
javax.ws.rs.WebApplicationException: javax.xml.bind.MarshalException 
- with linked exception: 
[javax.xml.stream.XMLStreamException: org.eclipse.jetty.io.EofException: timeout] 
    at com.sun.jersey.core.provider.jaxb.AbstractListElementProvider.writeTo(AbstractListElementProvider.java:266) 
    at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:306) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1451) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1363) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1353) 
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:414) 
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537) 
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) 
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:648) 
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455) 
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) 
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:559) 
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) 
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072) 
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382) 
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) 
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006) 
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) 
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255) 
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) 
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) 
    at org.eclipse.jetty.server.Server.handle(Server.java:365) 
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485) 
    at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926) 
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988) 
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635) 
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) 
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) 
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:627) 
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:51) 
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) 
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) 
    at java.lang.Thread.run(Thread.java:662) 
Caused by: javax.xml.bind.MarshalException 
- with linked exception: 
[javax.xml.stream.XMLStreamException: org.eclipse.jetty.io.EofException: timeout] 
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:327) 
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:177) 
    at com.sun.jersey.json.impl.provider.entity.JSONListElementProvider.writeList(JSONListElementProvider.java:145) 
    at com.sun.jersey.core.provider.jaxb.AbstractListElementProvider.writeTo(AbstractListElementProvider.java:264) 
    ... 33 more 
Caused by: javax.xml.stream.XMLStreamException: org.eclipse.jetty.io.EofException: timeout 
    at com.sun.jersey.json.impl.writer.JsonXmlStreamWriter.writeStartElement(JsonXmlStreamWriter.java:443) 
    at com.sun.xml.bind.v2.runtime.output.XMLStreamWriterOutput.beginStartTag(XMLStreamWriterOutput.java:118) 
    at com.sun.xml.bind.v2.runtime.output.XmlOutputAbstractImpl.beginStartTag(XmlOutputAbstractImpl.java:102) 
    at com.sun.xml.bind.v2.runtime.output.NamespaceContextImpl$Element.startElement(NamespaceContextImpl.java:496) 
    at com.sun.xml.bind.v2.runtime.XMLSerializer.endNamespaceDecls(XMLSerializer.java:291) 
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:594) 
    at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:328) 
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:498) 
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:320) 
    ... 36 more 
Caused by: org.eclipse.jetty.io.EofException: timeout 
    at org.eclipse.jetty.http.AbstractGenerator.blockForOutput(AbstractGenerator.java:520) 
    at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:170) 
    at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:107) 
    at com.sun.jersey.spi.container.servlet.WebComponent$Writer.write(WebComponent.java:305) 
    at com.sun.jersey.spi.container.ContainerResponse$CommittingOutputStream.write(ContainerResponse.java:134) 
    at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202) 
    at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:263) 
    at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:106) 
    at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:116) 
    at java.io.OutputStreamWriter.write(OutputStreamWriter.java:203) 
    at java.io.Writer.write(Writer.java:140) 
    at com.sun.jersey.json.impl.writer.JsonXmlStreamWriter$WriterAdapter.write(JsonXmlStreamWriter.java:78) 
    at com.sun.jersey.json.impl.writer.JsonXmlStreamWriter.writeStartElement(JsonXmlStreamWriter.java:438) 
    ... 44 more 
2012-10-17 00:20:07.352:WARN:oejs.ServletHandler:/resources/ARX%3ALRP2%3AMED12%3AOFD1%3AZEB2%3AAHI1%3ACREBBP%3AFGFR1%3AFGFR2%3AHESX1%3AKIF7%3APAX6%3AARL13B%3AATRX%3ACC2D2A%3ACEP290%3ADCX%3ANFIB%3ANPHP1%3ANSD1%3ANTN1%3APAFAH1B1%3APEX13%3ARELN%3ATSC1%3ATSC2%3AFOXP2%3AOXTR%3ARELN%3ADLX2%3AFEZF2%3AFEZF2%3APCDH9%3APITX1%3ASLC6A4%3ADAB1%3ADLX1%3AROBO1%3AROBO1%3ADRD1%3ADRD2%3AERBB4%3AGAD1%3ARELN%3ARPGRIP1L%3ARPGRIP1L%3ASLC6A4%3ACCKAR%3AFOXP2%3AGRIN1%3AGSK3B%3ANR4A2%3ANUMBL%3ANUMBL%3ASLC1A2%3AAHI1%3ADPYSL2 
javax.ws.rs.WebApplicationException: javax.xml.bind.MarshalException| - with linked exception:|[javax.xml.stream.XMLStreamException: org.eclipse.jetty.io.EofException: timeout] 
    at com.sun.jersey.core.provider.jaxb.AbstractListElementProvider.writeTo(AbstractListElementProvider.java:266) 
    at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:306) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1451) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1363) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1353) 
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:414) 
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537) 
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) 
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:648) 
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455) 
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) 
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:559) 
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) 
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072) 
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382) 
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) 
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006) 
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) 
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255) 
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) 
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) 
    at org.eclipse.jetty.server.Server.handle(Server.java:365) 
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485) 
    at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926) 
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988) 
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635) 
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) 
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) 
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:627) 
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:51) 
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) 
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) 
    at java.lang.Thread.run(Thread.java:662) 
Caused by: 
javax.xml.bind.MarshalException| - with linked exception:|[javax.xml.stream.XMLStreamException: org.eclipse.jetty.io.EofException: timeout] 
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:327) 
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:177) 
    at com.sun.jersey.json.impl.provider.entity.JSONListElementProvider.writeList(JSONListElementProvider.java:145) 
    at com.sun.jersey.core.provider.jaxb.AbstractListElementProvider.writeTo(AbstractListElementProvider.java:264) 
    at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:306) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1451) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1363) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1353) 
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:414) 
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537) 
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) 
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:648) 
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455) 
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) 
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:559) 
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) 
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072) 
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382) 
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) 
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006) 
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) 
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255) 
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) 
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) 
    at org.eclipse.jetty.server.Server.handle(Server.java:365) 
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485) 
    at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926) 
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988) 
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635) 
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) 
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) 
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:627) 
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:51) 
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) 
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) 
    at java.lang.Thread.run(Thread.java:662) 
Caused by: 
javax.xml.stream.XMLStreamException: org.eclipse.jetty.io.EofException: timeout 
    at com.sun.jersey.json.impl.writer.JsonXmlStreamWriter.writeStartElement(JsonXmlStreamWriter.java:443) 
    at com.sun.xml.bind.v2.runtime.output.XMLStreamWriterOutput.beginStartTag(XMLStreamWriterOutput.java:118) 
    at com.sun.xml.bind.v2.runtime.output.XmlOutputAbstractImpl.beginStartTag(XmlOutputAbstractImpl.java:102) 
    at com.sun.xml.bind.v2.runtime.output.NamespaceContextImpl$Element.startElement(NamespaceContextImpl.java:496) 
    at com.sun.xml.bind.v2.runtime.XMLSerializer.endNamespaceDecls(XMLSerializer.java:291) 
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:594) 
    at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:328) 
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:498) 
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:320) 
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:177) 
    at com.sun.jersey.json.impl.provider.entity.JSONListElementProvider.writeList(JSONListElementProvider.java:145) 
    at com.sun.jersey.core.provider.jaxb.AbstractListElementProvider.writeTo(AbstractListElementProvider.java:264) 
    at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:306) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1451) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1363) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1353) 
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:414) 
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537) 
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) 
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:648) 
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455) 
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) 
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:559) 
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) 
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072) 
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382) 
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) 
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006) 
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) 
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255) 
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) 
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) 
    at org.eclipse.jetty.server.Server.handle(Server.java:365) 
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485) 
    at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926) 
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988) 
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635) 
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) 
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) 
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:627) 
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:51) 
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) 
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) 
    at java.lang.Thread.run(Thread.java:662) 
Caused by: 
org.eclipse.jetty.io.EofException: timeout 
    at org.eclipse.jetty.http.AbstractGenerator.blockForOutput(AbstractGenerator.java:520) 
    at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:170) 
    at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:107) 
    at com.sun.jersey.spi.container.servlet.WebComponent$Writer.write(WebComponent.java:305) 
    at com.sun.jersey.spi.container.ContainerResponse$CommittingOutputStream.write(ContainerResponse.java:134) 
    at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202) 
    at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:263) 
    at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:106) 
    at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:116) 
    at java.io.OutputStreamWriter.write(OutputStreamWriter.java:203) 
    at java.io.Writer.write(Writer.java:140) 
    at com.sun.jersey.json.impl.writer.JsonXmlStreamWriter$WriterAdapter.write(JsonXmlStreamWriter.java:78) 
    at com.sun.jersey.json.impl.writer.JsonXmlStreamWriter.writeStartElement(JsonXmlStreamWriter.java:438) 
    at com.sun.xml.bind.v2.runtime.output.XMLStreamWriterOutput.beginStartTag(XMLStreamWriterOutput.java:118) 
    at com.sun.xml.bind.v2.runtime.output.XmlOutputAbstractImpl.beginStartTag(XmlOutputAbstractImpl.java:102) 
    at com.sun.xml.bind.v2.runtime.output.NamespaceContextImpl$Element.startElement(NamespaceContextImpl.java:496) 
    at com.sun.xml.bind.v2.runtime.XMLSerializer.endNamespaceDecls(XMLSerializer.java:291) 
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:594) 
    at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:328) 
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:498) 
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:320) 
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:177) 
    at com.sun.jersey.json.impl.provider.entity.JSONListElementProvider.writeList(JSONListElementProvider.java:145) 
    at com.sun.jersey.core.provider.jaxb.AbstractListElementProvider.writeTo(AbstractListElementProvider.java:264) 
    at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:306) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1451) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1363) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1353) 
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:414) 
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537) 
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) 
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:648) 
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455) 
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) 
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:559) 
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) 
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072) 
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382) 
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) 
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006) 
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) 
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255) 
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) 
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) 
    at org.eclipse.jetty.server.Server.handle(Server.java:365) 
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485) 
    at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926) 
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988) 
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635) 
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) 
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) 
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:627) 
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:51) 
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) 
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) 
    at java.lang.Thread.run(Thread.java:662) 

希望得到任何幫助/建議:

+0

問題並不響應已經COMMITED,但在org.eclipse.jetty.io.EofException:超時。您的連接超時。所以回覆已經發回。所以當你試圖迴應時,http響應已經被髮回。嘗試更改服務器上的超時時間 –

+0

增加jetty中的maxIdleTime似乎解決了這個問題。我在pom中改變了它。xml配置:\t \t \t \t \t \t \t 120000 但另一個問題:早前maxIdleTime被設置爲 「100」,目前仍是AJAX是返回中說10-15secs電話正常工作。但那些花費大約幾分鐘的時間卻讓超時錯誤。如果maxidletime設置爲100,那麼在10secs中返回的其他ajax調用是否也會失敗? –

回答

0

嗯,我想你應該增加:

timeout: <number of miliseconds>

$.ajax({})

另外,cache: false,可以在少數情況下幫助。

More info

+0

我在我的ajax調用中有一個超時! –

+0

以及我認爲你應該增加它 – rahul

+0

我已經設置了2分鐘。分析在約1分鐘內完成。我在2分鐘超時窗口之前看到這個錯誤。 –

相關問題