Running Spring project causes warnings "RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,localport=54571] throws"

Viewed 1605

When I'am running start project from spring initializr I've this warning message

2021-06-03 15:48:38.987 WARN 9168 --- [MI TCP Accept-0] sun.rmi.transport.tcp : RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,localport=54408] throws

java.io.IOException: The server sockets created using the LocalRMIServerSocketFactory only accept connections from clients running on the host where the RMI remote objects have been exported.
    at sun.management.jmxremote.LocalRMIServerSocketFactory$1.accept(LocalRMIServerSocketFactory.java:114) ~[na:1.8.0_291]
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:405) [na:1.8.0_291]
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:377) [na:1.8.0_291]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_291]

2021-06-03 15:48:39.081  INFO 9168 --- [           main] r.p.mmsclient.MmsclientApplication       : Starting MmsclientApplication using Java 1.8.0_291 on d102 with PID 9168 (C:\Users\NTI\Downloads\mms-client\target\classes started by NTI in C:\Users\NTI\Downloads\mms-client)
2021-06-03 15:48:39.082  INFO 9168 --- [           main] r.p.mmsclient.MmsclientApplication       : No active profile set, falling back to default profiles: default
2021-06-03 15:48:39.314  WARN 9168 --- [MI TCP Accept-0] sun.rmi.transport.tcp                    : RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,localport=54408] throws

java.io.IOException: The server sockets created using the LocalRMIServerSocketFactory only accept connections from clients running on the host where the RMI remote objects have been exported.
    at sun.management.jmxremote.LocalRMIServerSocketFactory$1.accept(LocalRMIServerSocketFactory.java:114) ~[na:1.8.0_291]
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:405) [na:1.8.0_291]
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:377) [na:1.8.0_291]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_291]

2021-06-03 15:48:39.986  INFO 9168 --- [           main] r.p.mmsclient.MmsclientApplication       : Started MmsclientApplication in 1.556 seconds (JVM running for 2.575)

Process finished with exit code 0
1 Answers

I believe that this is related to the local JMX agent and the configuration of the hosts file. First, ensure your hosts file has an appropriate mapping of localhost to 127.0.0.1. Then, add the following VM option:

-Djava.rmi.server.hostname=localhost

If you are using IntelliJ, you can find instructions for adding this VM option here.

Related