1

I'm having some trouble deploying a Spring Boot + WebSocket + Stomp tutorial available in spring guides for a Tomcat Server

I'm using gradle to create the war where I have the following dependencie

"build.gradle"

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.6.RELEASE")
    }
}

apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'org.springframework.boot'

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
     mavenCentral()
}

dependencies {
compile group: 'org.springframework.boot', name: 'spring-boot-starter-tomcat', version: '1.5.6.RELEASE'

compile("org.springframework.boot:spring-boot-starter-websocket")

compile("org.webjars:webjars-locator")
compile("org.webjars:sockjs-client:1.0.2")
compile("org.webjars:stomp-websocket:2.3.3")
compile("org.webjars:bootstrap:3.3.7")
compile("org.webjars:jquery:3.1.0")

testCompile("org.springframework.boot:spring-boot-starter-test")
}

Basically i only added the spring-boot-starter-tomcat dependency and the war and idea plugins.

The code is the one available here https://spring.io/guides/gs/messaging-stomp-websocket/

After the deploy, when I try to access to http://localhost:8080/complete/ i get the following error

"Failed to load resource: the server responded with a status of 404 (Not Found)"

What can I do to make this work?

Thanks

Marco Sousa
  • 185
  • 1
  • 1
  • 9

1 Answers1

0

First, Make sure you deploy the WAR with the right context path. The example code you mentioned assume that you deploy the code to the root path - http://localhost:8080

You can set the context path from your code. See this answer.

If everything with the context is right you should watch the sever logs for errors that may have blocked the deploy.

ApriOri
  • 2,618
  • 29
  • 48
  • The context is correct because I have done a deploy of another application and works fine. The context is equal to the name of the war file. When I watch the logs there are no erros, only the acess log changes. The follow line is added: 0:0:0:0:0:0:0:1 - - [07/Aug/2017:09:54:58 +0100] "GET /complete/ HTTP/1.1" 404 1012 – Marco Sousa Aug 07 '17 at 08:57