zyro23 / grails-spring-websocket

93 stars 28 forks source link

No 'javax.websocket.server.ServerContainer' ServletContext attribute. #39

Closed nelsongallardo closed 8 years ago

nelsongallardo commented 8 years ago

Getting this exception when opening my page, it's weird since websockets still works, but having this exception in the logs with every request and javascript errors in the browser console is quite annoying

| Error 2016-07-03 19:30:44,354 [http-bio-8080-exec-11] ERROR errors.GrailsExceptionResolver - IllegalArgumentException occurred when processing request: [GET] /stomp/566/rqpjdvi4/websocket No 'javax.websocket.server.ServerContainer' ServletContext attribute. Are you running in a Servlet container that supports JSR-356?. Stacktrace follows: Message: Uncaught failure in SockJS request, uri=http://localhost:8080/stomp/566/rqpjdvi4/websocket; nested exception is org.springframework.web.socket.sockjs.SockJsTransportFailureException: WebSocket handshake failure; nested exception is java.lang.IllegalArgumentException: No 'javax.websocket.server.ServerContainer' ServletContext attribute. Are you running in a Servlet container that supports JSR-356?

zyro23 commented 8 years ago

grails version? plugin version? sample app would be really helpful.

maybe one of these issues? http://stackoverflow.com/questions/21523693/spring-websocket-example-error-are-you-running-in-a-servlet-container-that-s

nelsongallardo commented 8 years ago

Latest plugin version, grails 2.5.0, it was working fine on an Ubuntu machine, but having this error on a mac, also the same error on a test server running ubuntu

These are the errors I get on the firefox console:

zyro23 commented 8 years ago

as deployed app or running in dev mode? custom webSocketConfig?

nelsongallardo commented 8 years ago

As deployed app and also running as dev mode (edited my previous answer with a detail of js errors), haven't touched webSocketConfig

zyro23 commented 8 years ago

so plugin version 1.3.1, right? what are you deploying to? tomcat? version? websocket api present?

nelsongallardo commented 8 years ago

yes, version 1.3.1, deploying to tomcat 7, but even when I do grails run-app in dev mode on my machine I get the same errors, not sure about websocket api?

zyro23 commented 8 years ago

did you follow the readme reg. tomcat-7 (https://github.com/zyro23/grails-spring-websocket/tree/1.3.x)

If you are using the tomcat plugin (7.0.52+), you should add the following BuildConfig.groovy settings to ensure proper functionality:

grails.tomcat.nio = true
grails.tomcat.scan.enabled = true
nelsongallardo commented 8 years ago

yes, have that, and my tomcat version is build ":tomcat:7.0.55.2"

zyro23 commented 8 years ago

referenced a blank sample app using the config you describe with the readme "quickstart" example. works for me.. hth.

zyro23 commented 8 years ago

i hope the sample app works for you too? feel free to re-open and preferably attach/reference a sample app that reproduces the error if you still think it is an issue with the plugin