I didn't find any promising answer to Multiple Endpoints may not be deployed to the same path though scouring through several stackoverflows and google groups cometd related topics.
Cometd Version: 3.0.5 Tomcat Version: 7.0.55
BayeuxServer instance is created as follows for Spring integration.
@Bean(initMethod = "start", destroyMethod = "stop")
@Singleton
public BayeuxServer bayeuxServer() {
BayeuxServerImpl bayeuxServer = new BayeuxServerImpl();
***bayeuxServer.setTransports(new WebSocketTransport(bayeuxServer), new JSONTransport(bayeuxServer));***
bayeuxServer.setOption(ServletContext.class.getName(), servletContext);
bayeuxServer.setOption("ws.cometdURLMapping", "/cometd/*");
bayeuxServer.addExtension(new org.cometd.server.ext.TimesyncExtension());
servletContext.setAttribute(BayeuxServer.ATTRIBUTE, bayeuxServer);
return bayeuxServer;
}
During this setup cometd and tomcat both tried to add end point on the same path as seen in error log.
Caused by: java.lang.RuntimeException: javax.websocket.DeploymentException: Multiple Endpoints may not be deployed to the same path [/cometd] at org.cometd.websocket.server.WebSocketTransport.init(WebSocketTransport.java:93)
Jul 30, 2015 4:35:02 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Allocate exception for servlet cometd javax.websocket.DeploymentException: Multiple Endpoints may not be deployed to the same path [/cometd] at org.apache.tomcat.websocket.server.WsServerContainer.addEndpoint(WsServerContainer.java:207)
I understand the cometd doesn't play well with tomcat. Can the tomcat be prevented from adding the end point same as created by cometd? I have a requirement to deploy the application in tomcat.