当我从spring initializer运行启动项目时,我收到了以下警告消息
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:UsersNTIDownloadsmms-clienttargetclasses started by NTI in C:UsersNTIDownloadsmms-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
我认为这与本地JMX代理和hosts
文件的配置有关。首先,确保您的hosts
文件具有localhost
到127.0.0.1
的适当映射。然后,添加以下VM选项:
-Djava.rmi.server.hostname=localhost
如果您正在使用IntelliJ,您可以在此处找到添加此VM选项的说明。