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

I am trying to use Spring Dev (Spring Remote) download tools and automatically load recompiled files into my docker container.

I keep getting 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 configuration enter image description here

And this is the error I get:

enter image description here

+4
source share
3 answers

Starting with Spring Boot 1.5.0, the default devtools values ​​have been changed to exclude devtools from thick jars.

If you want to enable them, you must set the excludeDevtools flag to false.

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

To do this, you can put this piece of code in the build.gradle file:

 bootRepackage { excludeDevtools = false } 

Unfortunately, at first this was a mistake and did not affect Spring Boot 1.5.0. The workaround was to do this instead:

 springBoot { excludeDevtools = false } 

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

+1
source

I had the same problems as you when using docker-compose to compile my application (web services + redis server + mongo server).

As the document of the developer’s document, Spring indicates, "Developer tools are automatically disabled when starting a fully packaged application. If your application is launched using java -jar or if it starts using a special class loader, then it is considered a" production application ".

I think that when we launch the Spring web application in the Docker container, the developer tool is disabled, so we cannot restart it remotely.

I am currently running my web application on the host machine and installing the redis server, the mongo server inside the containers, so I can quickly launch the web application when the code changes during development.

0
source

In my case, I had to put the application context in the configuration argument of the RemoteSpringApplication IDE.

For example, my application root context was / virtue, so I had to configure it like this: Example

0
source

All Articles