在glassfish服务器中启用彗星

时间:2010-10-31 13:54:34

标签: java glassfish comet

我收到以下错误

#|2010-10-31T19:13:38.127+0530|SEVERE|glassfish|javax.enterprise.system.container.web|_ThreadID=15;_ThreadName=Thread-3;|StandardWrapperValve[Grizzly Cometd Servlet]: PWC1406: Servlet.service() for servlet Grizzly Cometd Servlet threw exception
java.lang.IllegalStateException: Make sure you have enabled Comet or make sure the Thread invoking that method is the same a the request Thread.
 at com.sun.grizzly.comet.CometContext.addCometHandler(CometContext.java:263)
 at com.sun.grizzly.cometd.servlet.CometdServlet.doPost(CometdServlet.java:159)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
 at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:431)
 at org.apache.catalina.core.StandardWrapperValve.preInvoke(StandardWrapperValve.java:462)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:139)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:186)
 at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
 at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
 at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:96)
 at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:187)
 at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
 at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
 at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:651)
 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1030)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:142)
 at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
 at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
 at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:651)
 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1030)
 at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:242)
 at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:180)
 at com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:633)
 at com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:570)
 at com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:827)
 at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:152)
 at com.sun.enterprise.v3.services.impl.GlassfishProtocolChain.executeProtocolFilter(GlassfishProtocolChain.java:71)
 at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:103)
 at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:89)
 at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
 at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67)
 at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56)
 at com.sun.grizzly.util.WorkerThreadImpl.processTask(WorkerThreadImpl.java:325)
 at com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:184)
|#]

[#|2010-10-31T19:14:51.754+0530|SEVERE|glassfish|javax.enterprise.system.container.web|_ThreadID=15;_ThreadName=Thread-3;|StandardWrapperValve[Grizzly Cometd Servlet]: PWC1406: Servlet.service() for servlet Grizzly Cometd Servlet threw exception
java.lang.IllegalStateException: Make sure you have enabled Comet or make sure the Thread invoking that method is the same a the request Thread.
 at com.sun.grizzly.comet.CometContext.addCometHandler(CometContext.java:263)
 at com.sun.grizzly.cometd.servlet.CometdServlet.doPost(CometdServlet.java:159)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
 at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:431)
 at org.apache.catalina.core.StandardWrapperValve.preInvoke(StandardWrapperValve.java:462)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:139)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:186)
 at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
 at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
 at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:96)
 at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:187)
 at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
 at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
 at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:651)
 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1030)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:142)
 at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
 at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
 at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:651)
 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1030)
 at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:242)
 at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:180)
 at com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:633)
 at com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:570)
 at com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:827)
 at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:152)
 at com.sun.enterprise.v3.services.impl.GlassfishProtocolChain.executeProtocolFilter(GlassfishProtocolChain.java:71)
 at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:103)
 at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:89)
 at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
 at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67)
 at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56)
 at com.sun.grizzly.util.WorkerThreadImpl.processTask(WorkerThreadImpl.java:325)
 at com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:184)
|#]

我在domain.xml中使用了以下内容

<http-listener default-virtual-server="server" server-name="" address="0.0.0.0" port="%%%HTTP_PORT%%%" id="http-listener-1">
   <!-- added by akshay -->
   <property name="cometSupport" value="true"/>
   <!-- done -->
  </http-listener>
        <http-listener default-virtual-server="server" enabled="false" security-enabled="true" server-name="" address="0.0.0.0" port="%%%HTTP_SSL_PORT%%%" id="http-listener-2">
          <ssl ssl3-enabled="false" cert-nickname="s1as" />
    <!-- added by akshay -->
   <property name="cometSupport" value="true"/>
   <!-- done -->
        </http-listener>
        <http-listener default-virtual-server="__asadmin" server-name="" address="0.0.0.0" port="%%%ADMIN_PORT%%%" id="admin-listener">
   <!-- added by akshay -->
   <property name="cometSupport" value="true"/>
   <!-- done -->
  </http-listener>

3 个答案:

答案 0 :(得分:7)

在Web Admin Console中启用Comet支持

  1. 启动GlassFish Server,导航到Web Admin Console(默认值: localhost:4848 /)在浏览器中。
  2. 在左侧的“Common Task”平移下,选择“Configuration” - &gt; “网络配置” - &gt; “网络听众” - &gt; “HTTP监听-1”
  3. 在“编辑网络侦听器”中,选择“HTTP”选项卡。
  4. 在“HTTP”标签下,选中“Comet Support”
  5. 复选框
  6. 点击“保存”按钮(在框架顶部)
  7. 完成!

答案 1 :(得分:3)

我不确定如何在GF 3.x中构造domain.xml但是为了启用彗星支持,您应该使用以下命令:

  

Enabling Comet

     

在运行启用Comet之前   应用程序,你需要启用Comet   在你的HTTP监听器中   通过设置特殊应用程序   相关协议中的属性   组态。以下示例   显示asadmin set命令   添加此属性:

asadmin set server-config.network-config.protocols.protocol.http-1.http.comet-support-enabled="true"
     

替换协议的名称   http-1

我会尝试使用干净的domain.xml(即非手动编辑)。

参考

  • GlassFish Server 3.0.1应用程序开发指南

答案 2 :(得分:0)

除了之前的答案。

我会请你检查你用来编译你的应用程序的彗星罐对应于glassfish中的彗星实现。

例如,我犯了两个错误:

  1. 我将彗星jar包含在war文件中(它应该只用于 编译项目)

  2. 我使用了错误的(过时的)彗星版本     实施(&#39; com.sun.grizzly:grizzly-comet:1.9.59&#39;)编译     GF-4.0项目。

  3. 通过将库更新为: &#39; org.glassfish.main.grizzly:与GlassFish灰熊-额外全:4.0&#39;