Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij, Spring dev tools remote, Docker, error Unexpected 404 response uploading class files

Im trying to use Spring Boot Dev tools (Spring Remote), and automatically upload recompiled files to my docker container.

I keep receiving Unexpected 404 response uploading class files

This is my docker file:

FROM java:8
WORKDIR /first
ADD ./build/libs/first.jar /first/first.jar
EXPOSE 8080
RUN bash -c 'touch /first/first.jar'
ENTRYPOINT ["java","-Dspring.data.mongodb.uri=mongodb://mongodb/micros", "-Djava.security.egd", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005","-jar", "first.jar"]

This is my configuration and the configuration enter image description here

And this is the error I'm receiving:

enter image description here

like image 576
IturPablo Avatar asked Mar 13 '17 08:03

IturPablo


1 Answers

As of Spring Boot 1.5.0, devtools defaults were changed to exclude the devtools from fat jars.

If you want to include them, you have to set the excludeDevtools flag to false.

However, the devtools documentation doesn't explain how to do this. The necessary documentation is actually in the spring-boot-gradle-plugin documentation.

To do it, you can put this snippet of code in your build.gradle file:

bootRepackage {
    excludeDevtools = false
}

Unfortunately, this was buggy at first and had no effect as of Spring Boot 1.5.0. The workaround was to do this instead:

springBoot {
    excludeDevtools = false
}

However, I have verified that the bootRepackage approach works for Spring Boot 1.5.8 .

like image 106
tunesmith Avatar answered Oct 24 '22 12:10

tunesmith