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/layout.js、jquery/jquery.js、primefaces.js。全部来自 Primefaces 库。

这个错误困扰了我很长一段时间,我们将不胜感激!

4

2 回答 2

4

这很可能是 grizzly 框架的错误。

可能导致错误: https ://java.net/jira/browse/GLASSFISH-20681?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

在那个 Jira 中,有一个jar补丁。复制到modules目录,清除 OSGI 缓存(删除 glassfish4\glassfish\domains\domain1\osgi-cache)并重新启动。这对我有用。

另请参阅:返回多个大响应(请求)时在 Servlet 中引发的 GF4 不正确超时异常

于 2014-01-02T11:46:52.523 回答
1

请注意,客户端从服务器获取资源作为 HTTP GET 请求。这意味着对于每个 CSS、JS 或 HTML 文件,您都会收到一个 HTTP 请求。

打开浏览器 Web 控制台并单击网络。然后去任何一个站点,你会看到你收到了多少请求。

以下是关于您的问题的一些建议。

  1. 尝试增加服务器的最大池大小。在此处阅读http://docs.oracle.com/cd/E26576_01/doc.312/e24936/tuning-glassfish.htm#abeea -> 调整 EJB 池设置
  2. 尝试分析您的 Web 应用程序,看看是否有太多对同一资源的请求。如上所述,您可以在浏览器中执行此操作。
  3. 分析您的 JSP 以查找无用的导入、包含或 iFrame

我希望这有帮助

于 2013-07-24T13:27:47.610 回答