Upgrade Spring from 2.1.10 to 2.2.1 (including maven plugin) cause fail:

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

problem occurs when the plugin starts the app, there is no problem with Spring 2.2.x and maven plugin downgraded to 2.1.10.

workaround: downgrade the maven plugin to 2.1.x

Comment From: snicoll

@zsalab thanks for the report but it's very hard to help you with the amount of details you've provided. Spring Boot 2.2 now forks the process by default but I can't say if that's related.

To help you further, can you please share a small sample that reproduces the problem?

Comment From: zsalab

This forking can be the root cause, but interesting not appear on MacOS just in the CI (linux).... I will try to provide some example, but unfortunately, I lost to much time to find the workaround... will do my best, but maybe that ticket can help others if they see the same error

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

Comment From: tanbt

I've got this problem on Windows but it works on Linux. Downgrading to 2.1.x also helps.

Comment From: wilkinsona

Thanks, @tanbt. That's interesting. If you'd like us to investigate a bit, we would be happy to do so if you can provide a minimal sample that reproduces the problem.

Comment From: tanbt

Here's my reproduce: demo.zip. It's a simple project from Spring Initializr with Spring Web dependency, then I add to pom.xml a profile which uses the plugin:

        <profile>
            <id>it</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                        <!-- Use a downgraded version to workaround -->
                        <!-- <version>2.1.16.RELEASE</version> -->
                        <executions>
                            <execution>
                                <id>start-spring-boot</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>start</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>stop-spring-boot</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

Running this profile (e.g. mvn verify -Pit) causes the issue on Windows.

Comment From: snicoll

@tanbt thank you for the sample. Unfortunately I cannot reproduce using Windows10 and Java 8. Can you run this command with -X > out.log and share a link of the output (attaching the logs here or using gist.github.com). Thanks!

Comment From: grimmohe

Windows 10 Java 11.0.4 Spring 2.3.2.RELEASE

mvn clean install && mvn -X spring-boot:start > error.log

error.log

Comment From: snicoll

@grimmohe thanks for the feedback and the error log. Do you have a process listening on port 9001? That's the default port that's used to establish a JMX connection between the forked process with the app and the Maven process. Alternatively you could try to set a different jmxPort in your plugin configuration to check if that helps.

Comment From: grimmohe

There realy is some system process right after reboot. SpringBoot spring-boot-maven-plugin 2.2.x Failed to retrieve RMIServer stub

I configured like you suggested and its working again.

        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
          <jmxPort>9011</jmxPort>
        </configuration>

Thank you.

Comment From: snicoll

@tanbt does changing the JMX port fixes the issue for you as well?

Comment From: tanbt

@snicoll Thanks! jmxPort works for me as well!

Comment From: snicoll

Thanks for the feedback. I am going to close this one in favour of #22401 to which I’ve added a comment to document the need to tweak the port.

Comment From: sudheerah

This worked for me https://github.com/spring-projects/spring-boot/issues/23545#issuecomment-864896397