- I am working on a Spring-MVC application in which I am currently implementing chat functionality using Cometd on Apache tomcat 7.0.55. I have basic code running and I am able to send messages over channel and receive them too. While the page is loaded I am getting an error that cometd servlet does not support asynchronous operations.
- As I read the documentation, I found out, it is necessary to configure tomcat with NIO connector, which I have done and also put in web.xml, but still I keep getting that error. Why is that? After looking for some solution, I found one question, that says tomcat needs to be configured, and link for cometd documentation, which inturn only links Apache-tomcat homepage(Dead-End).
Can anyone tell me what modifications must I make for allowing websockets. Thanks a lot.
Error log :
SEVERE: Servlet.service() for servlet [cometd] in context with path [] threw exception
java.lang.IllegalStateException: A filter or servlet of the current chain does not support asynchronous operations.
at org.apache.catalina.connector.Request.startAsync(Request.java:1658)
at org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1029)
at javax.servlet.ServletRequestWrapper.startAsync(ServletRequestWrapper.java:379)
at javax.servlet.ServletRequestWrapper.startAsync(ServletRequestWrapper.java:379)
at org.springframework.security.web.context.HttpSessionSecurityContextRepository$Servlet3SaveToSessionRequestWrapper.startAsync(HttpSessionSecurityContextRepository.java:246)
web.xml :
<servlet>
<servlet-name>cometd</servlet-name>
<servlet-class>org.cometd.server.CometDServlet</servlet-class>
<init-param>
<param-name>transports</param-name>
<param-value>org.cometd.websocket.server.WebSocketTransport</param-value>
</init-param>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>cometd</servlet-name>
<url-pattern>/cometd/*</url-pattern>
</servlet-mapping>
<filter>
<filter-name>cross-origin</filter-name>
<filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>cross-origin</filter-name>
<url-pattern>/cometd/*</url-pattern>
</filter-mapping>
Tomcat's conf.xml :
<Connector connectionTimeout="20000" maxThreads="1000" port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol" redirectPort="8443"/>
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150"
scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" maxHttpHeaderSize="8192" connectionTimeout="20000"
keystoreFile="/home/username/.keystore" keystorePass="password" />
Is there anything else I must do, maybe for 8443 also use NIO protocol? Any help would be nice. Thanks a lot. :-)
Aucun commentaire:
Enregistrer un commentaire