-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to reproduce #1
Comments
WebSocket connection to 'ws://127.0.0.1:8080/myapp-0.0.1-SNAPSHOT/websocket/activity?X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.2.5-javascript&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&Content-Type=application/json&X-atmo-protocol=true' failed: Error during WebSocket handshake: Unexpected response code: 404
atmosphere.js:3117 Websocket failed. Downgrading to Comet and resending Is |
Have you started the application using spring-boot or dropper the war in tomcat? This issue occurs when launching like this: |
Yes. There is an ActivityService defined as @managedservice( |
I'm also getting the handshake error when dropping the war directly in tomcat |
There is serious issue here :-) Websocket is not available at all DEBUG] pro.tremblay.myapp.aop.logging.LoggingAspect - Exit: pro.tremblay.myapp.repository.CustomAuditEventRepository.auditEventRepository() with result = pro.tremblay.myapp.repository.CustomAuditEventRepository$1@236b4a44
[WARN] org.atmosphere.util.IOUtils - META-INF/services/org.atmosphere.cpr.AtmosphereFramework not found in class loader
[ERROR] org.atmosphere.cpr.DefaultAsyncSupportResolver - failed to create comet support class: org.atmosphere.container.JSR356AsyncSupport, error: null
[ERROR] org.atmosphere.cpr.AtmosphereFramework - Failed to initialize Atmosphere Framework
java.lang.IllegalArgumentException: Unable to createorg.atmosphere.container.JSR356AsyncSupport
at org.atmosphere.cpr.DefaultAsyncSupportResolver.newCometSupport(DefaultAsyncSupportResolver.java:242) ~[atmosphere-runtime-native-2.2.3.jar:2.2.3]
at org.atmosphere.cpr.AtmosphereFramework.doInitParams(AtmosphereFramework.java:1330) [atmosphere-runtime-native-2.2.3.jar:2.2.3]
at org.atmosphere.cpr.AtmosphereFramework.doInitParams(AtmosphereFramework.java:1305) [atmosphere-runtime-native-2.2.3.jar:2.2.3] And [ERROR] org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/] - Servlet threw load() exception
java.lang.IllegalStateException: ServerContainer is null. Make sure you are using JDK7 and your server has websocket support enabled
at org.atmosphere.container.JSR356AsyncSupport.<init>(JSR356AsyncSupport.java:43) ~[atmosphere-runtime-native-2.2.3.jar:2.2.3]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_25]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_25]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_25]
at java.lang.reflect.Constructor.newInstance(Constructor.java:408) ~[na:1.8.0_25]
at org.atmosphere.cpr.DefaultAsyncSupportResolver.newCometSupport(DefaultAsyncSupportResolver.java:238) ~[atmosphere-runtime-native-2.2.3.jar:2.2.3] |
I don't know how Spring Boot works, but normally the first class executed should be |
Spring Boot is seems to be broken: spring-projects/spring-boot#1722 |
Use private void initAtmosphereServlet(ServletContext servletContext) {
log.error("Registering Atmosphere Servlet");
AtmosphereServlet servlet = new AtmosphereServlet();
Field frameworkField = ReflectionUtils.findField(AtmosphereServlet.class, "framework");
ReflectionUtils.makeAccessible(frameworkField);
NoAnalyticsAtmosphereFramework atmosphereFramework = new NoAnalyticsAtmosphereFramework();
ReflectionUtils.setField(frameworkField, servlet, atmosphereFramework);
ServletRegistration.Dynamic atmosphereServlet =
servletContext.addServlet("atmosphereServlet", servlet);
servletContext.setAttribute("AtmosphereServlet", atmosphereFramework);
atmosphereServlet.setInitParameter("org.atmosphere.cpr.packages", "pro.tremblay.myapp.web.websocket");
atmosphereServlet.setInitParameter("org.atmosphere.cpr.asyncSupport", Servlet30CometSupport.class.getName());
servletContext.addListener(new org.atmosphere.cpr.SessionSupport());
atmosphereServlet.addMapping("/websocket/*");
atmosphereServlet.setLoadOnStartup(3);
atmosphereServlet.setAsyncSupported(true);
} but there are serious issue with SpringBoot + WebSocket. |
Ok. But I don't seem to have any @serverendpoint. How is the AtmosphereInitializer supposed to by called? |
AtmosphereInitializer is supposed to be called by the server itself. e.g any application deployed in a J2EE Container will be initialized when a META-INF/services is defined. This is Servlet Spec basic. Unclear to me why Spring Boot breaks that. |
Wow. That's much better. Now I'm getting some live results. Thanks! spring-boot seems to require to emulate some J2EE behavior manually. There is a SpringBootServletInitializer. So the AtmosphereInitializer should probably be called somewhere around there. |
However, I'm getting a bunch of [WARN] org.atmosphere.util.IOUtils - |
Hum. The SpringBootServletInitializer isn't called either. They must be called only when deployed on a server. I think initAtmosphereServlet is supposed to replace the AtmosphereInitializer but doesn't work very well. At least I should be able to work now. Thanks! |
Hum... The world is not saved yet. After a while, it freezes the browser and I'm getting these: WARN] org.atmosphere.config.managed.ManagedAtmosphereHandler - AtmosphereRequest{ method=POST contextPath= servletPath=/websocket pathInfo=/activity requestURI=/websocket/activity requestURL=http://localhost:8080/websocket/activity AtmosphereResource UUID=33540705-9766-44ae-b31d-4874776b91d3 destroyable=true} received an empty body But it kinda looks like the tracker is tracking the websocket themselves or something weird like that. |
the issue. I've deployed on Tomcat 8.0.15 and everything seems to starts properly. What is the next steps?
The text was updated successfully, but these errors were encountered: