You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tomcat 8.x + Jersey ( 1.18.1 ) + atmosphere-runtime 2.2.x cannot correctly route WebSocket requests due to an incorrect requestURI implementation in org.atmosphere.container.JSR356Endpoint.onOpen
#1839
Closed
lone-cloud opened this issue
Jan 20, 2015
· 7 comments
I've had atmosphere running well under Tomcat 7.0.55; however, after an upgrade to Tomcat 8.15 ( and now 8.0.17 ) it all fell apart. I've been debugging the stack trace and the problem seems to originate due to an incompatibility between
the requestURI value created within atmosphere-runtime-2.2.4.jar:JSR356Endpoint.onOpen() and the requestURI expected by jersey-server-1.18.1.jar:ServletContainer.service(). In my case, atmosphere creates the requestURI like "http://localhost:8080/com.absolute.am.webapi/api/push" where as jersey expects it to be like "/com.absolute.am.webapi/api/push".
var socket;
var transport = 'websocket';
var request = {
url: 'http://localhost:8080/com.absolute.am.webapi/api/push',
contentType: 'application/json',
transport: transport,
reconnectOnServerError: false,
maxReconnectOnClose: 0,
fallbackTransport: 'none'
};
...
socket = atmosphere.subscribe(request);
Stack trace:
ERROR c.a.am.webapi.JAXRSExceptionMapper - JAXRSExceptionMapper unhandled exception={}
com.sun.jersey.api.NotFoundException: null for uri: http://localhost:8080/http://localhost:8080/com.absolute.am.webapi/api/push
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1543) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409) [jersey-servlet-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540) [jersey-servlet-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715) [jersey-servlet-1.18.1.jar:1.18.1]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) [servlet-api.jar:na]
at org.atmosphere.util.AtmosphereFilterChain.doFilter(AtmosphereFilterChain.java:135) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.util.AtmosphereFilterChain.invokeFilterChain(AtmosphereFilterChain.java:96) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.handler.ReflectorServletProcessor$FilterChainServletWrapper.service(ReflectorServletProcessor.java:317) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.handler.ReflectorServletProcessor.onRequest(ReflectorServletProcessor.java:160) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:205) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:104) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:66) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:2079) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(DefaultWebSocketProcessor.java:570) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.websocket.DefaultWebSocketProcessor.open(DefaultWebSocketProcessor.java:215) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.container.JSR356Endpoint.onOpen(JSR356Endpoint.java:198) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.init(WsHttpUpgradeHandler.java:138) [tomcat-websocket.jar:8.0.17]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:687) [tomcat-coyote.jar:8.0.17]
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:285) [tomcat-coyote.jar:8.0.17]
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2431) [tomcat-coyote.jar:8.0.17]
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2420) [tomcat-coyote.jar:8.0.17]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_67]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.7.0_67]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.0.17]
at java.lang.Thread.run(Unknown Source) [na:1.7.0_67]
Key points:
JSR356Endpoint:
requestUri is initially set correctly on line 156 ( uri = /com.absolute.am.webapi/api/push )
It's working as expected again with the 2.3.0-SNAPSHOT. I don't recall seeing a bunch of 'X's being sent back though the WebSocket before. Is this something you've committed before for debugging?
Hi,
I've had atmosphere running well under Tomcat 7.0.55; however, after an upgrade to Tomcat 8.15 ( and now 8.0.17 ) it all fell apart. I've been debugging the stack trace and the problem seems to originate due to an incompatibility between
the requestURI value created within atmosphere-runtime-2.2.4.jar:JSR356Endpoint.onOpen() and the requestURI expected by jersey-server-1.18.1.jar:ServletContainer.service(). In my case, atmosphere creates the requestURI like "http://localhost:8080/com.absolute.am.webapi/api/push" where as jersey expects it to be like "/com.absolute.am.webapi/api/push".
Maven:
web.xml:
The HTTP request:
Generated using atmosphere.js ( version 2.2.4 ):
var socket;
var transport = 'websocket';
var request = {
url: 'http://localhost:8080/com.absolute.am.webapi/api/push',
contentType: 'application/json',
transport: transport,
reconnectOnServerError: false,
maxReconnectOnClose: 0,
fallbackTransport: 'none'
};
...
socket = atmosphere.subscribe(request);
Stack trace:
ERROR c.a.am.webapi.JAXRSExceptionMapper - JAXRSExceptionMapper unhandled exception={}
com.sun.jersey.api.NotFoundException: null for uri: http://localhost:8080/http://localhost:8080/com.absolute.am.webapi/api/push
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1543) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409) [jersey-servlet-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540) [jersey-servlet-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715) [jersey-servlet-1.18.1.jar:1.18.1]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) [servlet-api.jar:na]
at org.atmosphere.util.AtmosphereFilterChain.doFilter(AtmosphereFilterChain.java:135) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.util.AtmosphereFilterChain.invokeFilterChain(AtmosphereFilterChain.java:96) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.handler.ReflectorServletProcessor$FilterChainServletWrapper.service(ReflectorServletProcessor.java:317) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.handler.ReflectorServletProcessor.onRequest(ReflectorServletProcessor.java:160) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:205) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:104) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:66) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:2079) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(DefaultWebSocketProcessor.java:570) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.websocket.DefaultWebSocketProcessor.open(DefaultWebSocketProcessor.java:215) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.atmosphere.container.JSR356Endpoint.onOpen(JSR356Endpoint.java:198) [atmosphere-runtime-2.2.4.jar:2.2.4]
at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.init(WsHttpUpgradeHandler.java:138) [tomcat-websocket.jar:8.0.17]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:687) [tomcat-coyote.jar:8.0.17]
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:285) [tomcat-coyote.jar:8.0.17]
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2431) [tomcat-coyote.jar:8.0.17]
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2420) [tomcat-coyote.jar:8.0.17]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_67]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.7.0_67]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.0.17]
at java.lang.Thread.run(Unknown Source) [na:1.7.0_67]
Key points:
JSR356Endpoint:
ServletContainer
The text was updated successfully, but these errors were encountered: