Skip to content
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

Tomcat configuration problem when using WebSockets #439

Closed
sbuettner opened this issue Mar 5, 2014 · 6 comments
Closed

Tomcat configuration problem when using WebSockets #439

sbuettner opened this issue Mar 5, 2014 · 6 comments

Comments

@sbuettner
Copy link

When launching a spring-boot based app (1.0.0.RC4) by running my main class using come sample code from the spring-boots-websocket-example, i am not able to establish a websocket connection because of the following exception:

java.lang.IllegalArgumentException:
No 'javax.websocket.server.ServerContainer' ServletContext attribute. 
Are you running in a Servlet container that supports JSR-356

This leads to a xhr-based fallback by the sockjs client.

The problem can be resolved using the provided solution in the issues comments:
https://jira.springsource.org/browse/SPR-10841?focusedCommentId=92892&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-92892

Any plans to enhance the embedded tomcat configuration?

@dsyer
Copy link
Member

dsyer commented Mar 5, 2014

It works for me (the sample). The code from the JIRA link (or its equivalent) is included in the autoconfig setup for websockets. Where did you get the sample code (it changed recently so RC4 would only work with an older version of the sample probably)? Try a snapshot and master: https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-websocket?

@dsyer dsyer added the question label Mar 6, 2014
@sbuettner
Copy link
Author

I tried it out yesterday with a simple application using the gradle plugin but i can try to reproduce and document it more clearly.

@sbuettner sbuettner reopened this Mar 6, 2014
@dsyer
Copy link
Member

dsyer commented Mar 6, 2014

Sure. If you can share the code we might be able to see what you did different. Does the sample work for you?

@sbuettner
Copy link
Author

The sample works and i am currently finding out what the difference is.

@bjconlan
Copy link

I just got stung by this today too, I'm curious to find out what you discover, I gave it a quick once over comparing both the rc4 and build snapshots from my local box and it looks like the 'spring-boot-autoconfigure' dependency is the issue.

But it's fixed in the current spring boot code (as per checkout today the 17th of March) so I just ended up building and installing the 1.0.0.BUILD-SNAPSHOT versions into my local repo then explicitly override the deps via

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-autoconfigure</artifactId>
    <version>1.0.0.BUILD-SNAPSHOT</version>
</dependency>

in my pom for the meantime

@dsyer
Copy link
Member

dsyer commented Mar 17, 2014

I guess that means this is fixed.

@dsyer dsyer closed this as completed Mar 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants