osx - Exception on reloading remote spring boot application with Intellij IDEA -
i'm trying setup remote spring-boot environment using spring devtools, docker , intellij. started article. unfortunately randomly fails exception. below configuration:
dockerfile
from java:8 expose 8888 workdir /app add build.gradle /app/build.gradle add gradlew /app/gradlew add gradle /app/gradle add src /app/src run ["chmod", "+x", "/app/gradlew"]
docker-compose.yml
backend: build: . env_file: environment ports: - "8888:8888" volumes: - ./.gradle-docker:/root/.gradle command: "/app/gradlew clean bootrun" links: - db db: image: postgres:9.5.3 env_file: environment ports: - "5454:5432"
the whole application started command line with: docker-compose build
, docker-compose up
commands.
in intellij i've prepared following java application configuration:
where docker:8888
ip of docker-machine , port used spring application. after configuration run following output:
/\\ / ___'_ __ _ _(_)_ __ __ _ ___ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | | _ \___ _ __ ___| |_ ___ \ \ \ \ \\/ ___)| |_)| | | | | || (_| []::::::[] / -_) ' \/ _ \ _/ -_) ) ) ) ) ' |____| .__|_| |_|_| |_\__, | |_|_\___|_|_|_\___/\__\___|/ / / / =========|_|==============|___/===================================/_/_/_/ :: spring boot remote :: (v1.3.5.release) 2016-07-06 12:48:51.997 info 17731 --- [ main] o.s.b.devtools.remotespringapplication : starting remotespringapplication v1.3.5.release on opal-mac.local pid 17731 (/users/opal/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-devtools/1.3.5.release/ab035bdc1e6297ff4c8676edd93ed307b11353c2/spring-boot-devtools-1.3.5.release.jar started opal in /users/opal/projects/backend) 2016-07-06 12:48:52.013 info 17731 --- [ main] o.s.b.devtools.remotespringapplication : no active profile set, falling default profiles: default 2016-07-06 12:48:52.106 info 17731 --- [ main] s.c.a.annotationconfigapplicationcontext : refreshing org.springframework.context.annotation.annotationconfigapplicationcontext@441772e: startup date [wed jul 06 12:48:52 cest 2016]; root of context hierarchy 2016-07-06 12:48:54.016 warn 17731 --- [ main] o.s.b.d.r.c.remoteclientconfiguration : connection http://docker:8888 insecure. should use url starting 'https://'. 2016-07-06 12:48:54.419 warn 17731 --- [ main] o.s.b.d.a.optionallivereloadserver : unable start livereload server 2016-07-06 12:48:54.499 info 17731 --- [ main] o.s.b.devtools.remotespringapplication : started remotespringapplication in 3.793 seconds (jvm running 5.004)
unfortunately after change made code, following exception occurs:
2016-07-06 12:49:29.141 info 17731 --- [ file watcher] o.s.b.d.r.c.classpathchangeuploader : uploaded 1 class resource 2016-07-06 12:49:31.056 info 17731 --- [ file watcher] o.s.b.d.r.c.classpathchangeuploader : uploaded 1 class resource exception in thread "file watcher" java.lang.illegalstateexception: java.net.connectexception: connection refused @ org.springframework.boot.devtools.remote.client.classpathchangeuploader.onapplicationevent(classpathchangeuploader.java:107) @ org.springframework.boot.devtools.remote.client.classpathchangeuploader.onapplicationevent(classpathchangeuploader.java:56) @ org.springframework.context.event.simpleapplicationeventmulticaster.invokelistener(simpleapplicationeventmulticaster.java:166) @ org.springframework.context.event.simpleapplicationeventmulticaster.multicastevent(simpleapplicationeventmulticaster.java:138) @ org.springframework.context.support.abstractapplicationcontext.publishevent(abstractapplicationcontext.java:381) @ org.springframework.context.support.abstractapplicationcontext.publishevent(abstractapplicationcontext.java:335) @ org.springframework.boot.devtools.classpath.classpathfilechangelistener.publishevent(classpathfilechangelistener.java:68) @ org.springframework.boot.devtools.classpath.classpathfilechangelistener.onchange(classpathfilechangelistener.java:64) @ org.springframework.boot.devtools.filewatch.filesystemwatcher.firelisteners(filesystemwatcher.java:230) @ org.springframework.boot.devtools.filewatch.filesystemwatcher.updatesnapshots(filesystemwatcher.java:223) @ org.springframework.boot.devtools.filewatch.filesystemwatcher.scan(filesystemwatcher.java:183) @ org.springframework.boot.devtools.filewatch.filesystemwatcher.access$100(filesystemwatcher.java:41) @ org.springframework.boot.devtools.filewatch.filesystemwatcher$1.run(filesystemwatcher.java:150) caused by: java.net.connectexception: connection refused @ java.net.plainsocketimpl.socketconnect(native method) @ java.net.abstractplainsocketimpl.doconnect(abstractplainsocketimpl.java:350) @ java.net.abstractplainsocketimpl.connecttoaddress(abstractplainsocketimpl.java:206) @ java.net.abstractplainsocketimpl.connect(abstractplainsocketimpl.java:188) @ java.net.sockssocketimpl.connect(sockssocketimpl.java:392) @ java.net.socket.connect(socket.java:589) @ java.net.socket.connect(socket.java:538) @ sun.net.networkclient.doconnect(networkclient.java:180) @ sun.net.www.http.httpclient.openserver(httpclient.java:432) @ sun.net.www.http.httpclient.openserver(httpclient.java:527) @ sun.net.www.http.httpclient.<init>(httpclient.java:211) @ sun.net.www.http.httpclient.new(httpclient.java:308) @ sun.net.www.http.httpclient.new(httpclient.java:326) @ sun.net.www.protocol.http.httpurlconnection.getnewhttpclient(httpurlconnection.java:1169) @ sun.net.www.protocol.http.httpurlconnection.plainconnect0(httpurlconnection.java:1105) @ sun.net.www.protocol.http.httpurlconnection.plainconnect(httpurlconnection.java:999) @ sun.net.www.protocol.http.httpurlconnection.connect(httpurlconnection.java:933) @ org.springframework.http.client.simplebufferingclienthttprequest.executeinternal(simplebufferingclienthttprequest.java:80) @ org.springframework.http.client.abstractbufferingclienthttprequest.executeinternal(abstractbufferingclienthttprequest.java:48) @ org.springframework.http.client.abstractclienthttprequest.execute(abstractclienthttprequest.java:53) @ org.springframework.http.client.interceptingclienthttprequest$interceptingrequestexecution.execute(interceptingclienthttprequest.java:93) @ org.springframework.boot.devtools.remote.client.httpheaderinterceptor.intercept(httpheaderinterceptor.java:57) @ org.springframework.http.client.interceptingclienthttprequest$interceptingrequestexecution.execute(interceptingclienthttprequest.java:85) @ org.springframework.http.client.interceptingclienthttprequest.executeinternal(interceptingclienthttprequest.java:69) @ org.springframework.http.client.abstractbufferingclienthttprequest.executeinternal(abstractbufferingclienthttprequest.java:48) @ org.springframework.http.client.abstractclienthttprequest.execute(abstractclienthttprequest.java:53) @ org.springframework.boot.devtools.remote.client.classpathchangeuploader.onapplicationevent(classpathchangeuploader.java:102) ... 12 more
in docker , intellij:
2016-07-06 12:49:29.141 info 17731 --- [ file watcher] o.s.b.d.r.c.classpathchangeuploader : uploaded 1 class resource
logs see context reloaded. may problem?
there's bug in spring boot's devtools means if make change application while restart triggered previous change still in progress, attempt upload changes fail. think need update devtools retry upload attempt.
in meantime, "solution" stop , restart remotespringapplication
whenever see failure due java.net.connectexception: connection refused
.
Comments
Post a Comment