为什么JMX监听0.0.0.0?可以将听音更改为仅127.0.0.1吗?
我在JMX文档中搜索了有关监听0.0.0.0的任何信息,但没有发现任何信息。
当我运行我的应用并签入cmd netstat
时,它会打印
TCP 0.0.0.0:1099 0.0.0.0:0 LISTENING [java.exe]
我注册Bean像:
@Bean
public ConnectorServerFactoryBean serverConnector() throws MalformedObjectNameException {
ConnectorServerFactoryBean factoryBean=new ConnectorServerFactoryBean();
factoryBean.setServiceUrl("service:jmx:rmi://127.0.0.1/jndi/rmi://127.0.0.1:1099/appname");
factoryBean.setThreaded(true);
return factoryBean;
}
@Bean
public RmiRegistryFactoryBean registry() {
RmiRegistryFactoryBean factoryBean=new RmiRegistryFactoryBean();
factoryBean.setPort(1099);
factoryBean.setAlwaysCreate(true);
return factoryBean;
}
和
@Bean
public MBeanServerConnection clientConnection() throws IOException {
MBeanServerConnectionFactoryBean factoryBean = new MBeanServerConnectionFactoryBean();
factoryBean.setServiceUrl("service:jmx:rmi://127.0.0.1/jndi/rmi://127.0.0.1:1099/appname");
factoryBean.afterPropertiesSet();
return factoryBean.getObject();
}
任何想法如何将其更改为仅127.0.0.1? 我使用的是Spring Boot 1.4.1.RELEASE
答案 0 :(得分:0)
您可以使用Java选项-Djava.rmi.server.hostname=127.0.0.1
仅在127.0.0.1上监听