title: How to fix springboot error Failed to retrieve RMIServer stub: javax.naming.CommunicationException error during JRMP connection establishment
body: <p>I am having issue with <code>springboot</code> <code>maven</code> project and <code>cassandra</code> in <code>docker</code>.
  I want to execute <code>mvn verify</code> and in <code>pre-integration-test</code> to start cassandra docker and api server, execute test and then in <code>post-integration-test</code> to stop server but I am facing error <code>Could not contact Spring Boot application: Failed to retrieve RMIServer stub: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: error during JRMP connection establishment;</code></p>
  <p>I have created <code>github</code> repo so you can easily reproduce error.</p>
  <p><strong>Steps to reproduce</strong>:</p>
  <pre><code>git clone https://github.com/gandra/docker-cassandra-with-initial-seed.git
  cd docker-cassandra-with-initial-seed
  mvn verify
  </code></pre>
  <p>this will produce error like this:</p>
  <pre><code>[INFO]
  [INFO] --- spring-boot-maven-plugin:2.2.2.RELEASE:start (api-server-start) @ docker-cassandra-with-initial-seed ---
  [INFO] Attaching agents: []
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time:  18.501 s
  [INFO] Finished at: 2021-01-21T18:39:05+01:00
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.2.RELEASE:start (api-server-start) on project docker-cassandra-with-initial-seed: Could not contact Spring Boot application: Failed to retrieve RMIServer stub: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
  [ERROR]     java.io.EOFException]
  [ERROR] -&gt; [Help 1]
  [ERROR]
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR]
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
  </code></pre>
  <p>Any idea how to fix.</p>
  <p>p.s.
  I am working on mac and this solution would work on mac and linux as well.</p>