glassfish_at_javadesktop.org wrote:
> I am trying to run Grizzly Comet program on embedded GlassFish. The code to start up the server is shown below.
>
> EmbeddedFileSystem.Builder efsb = new EmbeddedFileSystem.Builder();
> efsb.instanceRoot( new File("D:/Program/netbeans-projects/EmGlassfish/GlassFishRoot") );
> EmbeddedFileSystem efs = efsb.build();
>
> Server.Builder builder = new Server.Builder("CometServer");
> builder.embeddedFileSystem(efs);
> builder.verbose(true);
>
> Server server = builder.build();
> ContainerBuilder containerBuilder = server.createConfig(ContainerBuilder.Type.web);
> server.addContainer(containerBuilder);
> EmbeddedWebContainer webContainer = (EmbeddedWebContainer)containerBuilder.create(server);
> Port http = server.createPort(8080);
> webContainer.bind(http, "httpPort");
>
> deployWar(server);
> server.start();
>
>
> When I ran the program, I got exception:
> Sep 15, 2010 6:05:41 PM org.apache.catalina.core.StandardWrapperValve log
> WARNING: StandardWrapperValve[CometTest]: PWC1406: Servlet.service() for servlet CometTest threw exception
> java.lang.IllegalStateException: Make sure you have enabled Comet or make sure the Thread invoking that method is the same as the Servlet.service() Thread.
> at com.sun.grizzly.comet.CometContext.addCometHandler(CometContext.java:286)
> at com.sun.grizzly.comet.CometContext.addCometHandler(CometContext.java:305)
> at com.reuters.sds.comet.CometTest.processRequest(CometTest.java:82)
> at com.reuters.sds.comet.CometTest.doGet(CometTest.java:106)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
> at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1522)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
> at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
> at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
> at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
>
> I recall this is the exception of GlassFish server hasn't been set to enable comet support. Could anyone tell me how to enable the configuration problematically.
> [Message sent by forum member 'devguli']
>
In non-embedded, you would enable comet support using "asadmin set
configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.comet-support-enabled=true".
In embedded, you can add the following in your domain.xml and set it
using EmbeddedFileSystem.Builder.configurationFile(domainXml).
<network-config>
<protocols>
<protocol name="http-listener-1">
<http default-virtual-server="server" max-connections="250"
comet-support-enabled="true">
<file-cache></file-cache>
</http>
</protocol>
....
Next version of Embedded APIs are planned to allow asadmin execution in
embedded mode.
Amy
> http://forums.java.net/jive/thread.jspa?messageID=482817
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>