开发者

enabeling comet in glassfish server

开发者 https://www.devze.com 2023-01-22 14:18 出处:网络
i am getting following error #|2010-10-31T19:13:38.127+0530|SEVERE|glassfish|javax.enterprise.system.container.web|_ThreadID=15;_ThreadName=Thread-3;|StandardWrapperValve[Grizzly Cometd Servlet]: PW

i am getting following error

#|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.StandardWrapperVa开发者_运维问答lve.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)
|#]

Am using following in 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>


Enabling Comet Support in Web Admin Console

  1. Start GlassFish Server, navigate to Web Admin Console (default: localhost:4848/) in browser.
  2. At "Common Task" pan on left hand side, select "Configuration" –> "Network Config" –> "Network Listeners" –> "http-listener-1"
  3. At "Edit Network Listener", select tab "HTTP".
  4. Under tab "HTTP", select the checkbox of "Comet Support"
  5. Click "Save" button (at top of frame)

Done!


I'm not sure how the domain.xml is supposed to be structured in GF 3.x but to enable comet support, you are supposed to use the following command:

Enabling Comet

Before running a Comet-enabled application, you need to enable Comet in the HTTP listener for your application by setting a special attribute in the associated protocol configuration. The following example shows the asadmin set command that adds this attribute:

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

Substitute the name of the protocol for http-1.

I would try that with a clean domain.xml (i.e. non manually edited).

References

  • GlassFish Server 3.0.1 Application Development Guide
    • Using Comet


In addition to previous answers.

I will ask you you to check if comet jar you are using to compile your application corresponds comet implementation in glassfish.

For example I've made 2 mistakes:

  1. I included comet jar into war file (it should be used only to compile project)

  2. I used wrong (outdated) version of comet implementation('com.sun.grizzly:grizzly-comet:1.9.59') to compile project for GF-4.0.

Problem was fixed by updating library to: 'org.glassfish.main.grizzly:glassfish-grizzly-extra-all:4.0'

0

精彩评论

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