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

1
  • keep your html and js file in static folder Commented May 26, 2020 at 13:29

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.