zyro23 / grails-spring-websocket

93 stars 28 forks source link

Use Spring Websocket 4.2.X with Grails 2.5 #54

Closed sighup1 closed 6 years ago

sighup1 commented 6 years ago

Forgive me, this isn't a problem with the plugin by any means, there's just a feature in the Spring Websocket 4.2.X version that I would like to have in a Grails 2.5 app, and I've been struggling to get it to work. I've added runtime dependencies to the BuildConfig like so:

    runtime 'org.springframework:spring-expression:4.2.2.RELEASE'
    runtime 'org.springframework:spring-aop:4.2.2.RELEASE'
    runtime 'org.springframework:spring-core:4.2.2.RELEASE'
    runtime "org.springframework:spring-websocket:4.2.2.RELEASE"
    runtime "org.springframework:spring-messaging:4.2.2.RELEASE"
    runtime 'org.springframework:spring-web:4.2.2.RELEASE'

    runtime "com.fasterxml.jackson.core:jackson-databind:2.6.3"
    runtime "io.netty:netty-all:4.0.33.Final"
    runtime "io.projectreactor:reactor-net:2.0.7.RELEASE"

And it runs, but it's throwing an error when the SockJS client tries to connect... maybe you could see what I'm doing wrong?

Edit: This is the error NoSuchMethodError occurred when processing request: [GET] /application/stomp/info org.springframework.web.util.WebUtils.isSameOrigin(Lorg/springframework/http/HttpRequest;)Z

zyro23 commented 6 years ago

are you sure that org.springframework:spring-web:4.2.2.RELEASE is actually used? looks like you are still using 4.1.x (perhaps pulled in transitively by another dependency)? the missing method has been added in spring-web-4.2 but is missing on the 4.1.x branch. maybe check grails dependency-report to see whats going on.

sighup1 commented 6 years ago

You are a life saver!! The rest-client-builder has a dependency on 4.1.X web module, I pulled that out and it works, thanks!