2013-07-24 159 views
2

我正在Glassfish 4服務器上使用Java EE 6和Primefaces進行Web應用程序。我越來越頻繁地收到同樣惱人的錯誤。我試圖谷歌這個問題,但我還沒有找到一個可行的解決方案。有時候,應用程序的執行完全沒有問題,但是突然間一次又一次地發生了同樣的錯誤。這是我的堆棧跟蹤:無法找到或提供資源

WARNING: JSF1064: Unable to find or serve resource, charts/charts.js, from library, primefaces. 
WARNING: java.io.IOException: java.util.concurrent.TimeoutException 
    at org.glassfish.grizzly.utils.Exceptions.makeIOException(Exceptions.java:81) 
    at org.glassfish.grizzly.http.io.OutputBuffer.blockAfterWriteIfNeeded(OutputBuffer.java:958) 
    at org.glassfish.grizzly.http.io.OutputBuffer.write(OutputBuffer.java:682) 
    at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:355) 
    at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:342) 
    at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:161) 
    at java.nio.channels.Channels$WritableByteChannelImpl.write(Channels.java:458) 
    at com.sun.faces.application.resource.ResourceHandlerImpl.handleResourceRequest(ResourceHandlerImpl.java:343) 
    at javax.faces.application.ResourceHandlerWrapper.handleResourceRequest(ResourceHandlerWrapper.java:153) 
    at org.primefaces.application.PrimeResourceHandler.handleResourceRequest(PrimeResourceHandler.java:99) 
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:643) 
    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) 
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673) 
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174) 
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260) 
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188) 
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191) 
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168) 
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189) 
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) 
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288) 
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206) 
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136) 
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114) 
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) 
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838) 
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113) 
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115) 
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55) 
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135) 
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564) 
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544) 
    at java.lang.Thread.run(Thread.java:722) 
Caused by: java.util.concurrent.TimeoutException 
    at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:258) 
    at java.util.concurrent.FutureTask.get(FutureTask.java:119) 
    at org.glassfish.grizzly.http.io.OutputBuffer.blockAfterWriteIfNeeded(OutputBuffer.java:951) 
    ... 36 more 

同樣的錯誤會發生幾次,但後來暫時無法服務資源,如:jQuery的/ jQuery的plugins.js,佈局/ layout.js,jQuery的/的jquery.js, primefaces.js。全部來自Primefaces庫。

這個錯誤一直困擾着我很長一段時間,並將不勝感激!

回答

1

請注意客戶端從服務器獲取資源作爲HTTP GET請求。這意味着對於每個CSS,JS或HTML文件,您都會收到一個HTTP請求。

打開你瀏覽器的網頁控制檯,然後點擊網絡。然後去任何網站,你會看到你有多少要求。

以下是關於您的問題的一些建議。

  1. 儘量增加你的服務器的最大池大小。在這裏閱讀http://docs.oracle.com/cd/E26576_01/doc.312/e24936/tuning-glassfish.htm#abeea - >調整EJB池設置
  2. 嘗試分析您的Web應用程序,並查看是否有太多請求使用相同的資源。如上所述,您可以在瀏覽器中執行此操作。
  3. 分析你無用進口的JSP,包括或iFrame

我希望這有助於

+0

謝謝您的快速答覆! – user2614556

+0

到目前爲止,我似乎解決了我的問題。我從我的庫中刪除了Primefaces 3.5.jar,並將其替換爲Primefaces 3.4.2.jar,現在一切似乎都奏效......其他人有沒有Primefaces 3.5的問題? – user2614556

4

這是最有可能與灰熊框架的錯誤。

可能造成錯誤:https://java.net/jira/browse/GLASSFISH-20681?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

在這種吉拉,還有一個jar補丁。複製到modules目錄,清除OSGI緩存(刪除glassfish4 \ glassfish \ domains \ domain1 \ osgi-cache)並重新啓動。這對我有效。

另見:GF4 incorrect timeout exception thrown in Servlet when multiple large responses are returned (requested)