我只是在ElasticBeanstalk上设置了我的Web应用程序。 一切似乎工作正常,直到我发现我的实例不能使用WebSocket,每次我试图连接内部服务器的错误代码被回避。
当我检查日志时,发现NullPointerException,这是不太可能由我造成的。 这里是stacktrace:
Aug 27, 2013 5:01:18 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [WebSocketChannel] in context with path [] threw exception java.lang.NullPointerException at org.apache.catalina.websocket.WebSocketServlet.getWebSocketAccept(WebSocketServlet.java:171) at org.apache.catalina.websocket.WebSocketServlet.doGet(WebSocketServlet.java:116) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:680) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:679)
我的实例正在运行版本7.0.27。 当我查看tomcat的源代码来查看问题的根源时,我无法理解一件事情。
任何想法似乎是造成这个问题? WebSockets不适用于ElasticBeanstalk和Apache Tomcat吗?
Websockets需要tomcat 7.0.47或8,还要确保你有JRE 7多一件事情检查你的ELBconfiguration在TCP / SSL级别而不是HTTP / HTTPS