Skip to content

Maven Plugin: integration tests (start) expects registered port 9001 to be free for JMX, fails cryptically otherwise ("Failed to retrieve RMIServer stub: javax.naming.CommunicationException") #23545

@Chealer

Description

@Chealer

Following a change of PC-s, my team was unable to start its Spring Boot application due to an error. Thanks to my colleague, we figured out that this is due to a common and well-known conflict for port 9001. Thanks to ticket #22401 , section 8.3.2 of the Maven plugin reference now documents a simple workaround.

Obviously, we should never expect a port we haven't registered to be free, but such an expectation is particularly problematic with port 9001. Port 9001 is officially registered for "ETL Service Manager", but this appears to be an old product no longer in usage. In practice though, this number is very tempting, and has several usages according to Wikipedia:

  • Microsoft SharePoint authoring environment
  • Tor network default
  • DBGp Proxy
  • HSQLDB default port

And apparently, the Intel Graphics Command Center Service now also binds to port 9001 (as discussed in this Microsoft forums thread and in this similar issue report). This is why the port is already in use on our PC-s. Note that the Intel Graphics Command Center Service is on our organization's laptops even though I see no sign of the Intel Graphics Command Center.

And to make it even worst, the part which attempts to bind port 9001 visibly has no error-checking at all. Therefore, it's only when the client tries to connect to it that the failure appears, and at this point, it's not pretty. Rather than a usual "Could not bind to port x" message, we get a message which even a senior developer like myself may not understand:

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.2.RELEASE:start (default-cli) on project [...]: Could not contact Spring Boot application: Failed to retrieve RMIServer stub: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: non-JRMP server at remote endpoint]


This was apparently introduced in commit 54e12a0 and affects the Maven plugin of Spring Boot 2.2.2 (but the changelog gives no indication that this would be fixed as of 2.3.4).

Ideally, Spring Boot would not try to open any registered port, but would instead either register one or use a dynamic port. But if that's not easy, it would help a lot meanwhile to detect failure earlier, so that the error message is reasonably clear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions