public static void main(String[] args) throws Exception
{
prepareUsersFile();
// The address of the connector server
JMXServiceURL url = new JMXServiceURL("rmi", "localhost", 0, "/jndi/jmx");
// Specify the authenticator in the environment Map, using the
// standard property JMXConnector.AUTHENTICATOR
Map environment = new HashMap();
JMXAuthenticator authenticator = new PasswordAuthenticator(new File(PASSWORD_FILE));
environment.put(JMXConnectorServer.AUTHENTICATOR, authenticator);
// Create and register the connector server
JMXConnectorServer cntorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, environment, null);
ObjectName cntorServerName = ObjectName.getInstance(":service=" + JMXConnectorServer.class.getName() + ",protocol=" + url.getProtocol());
MBeanServer server = MBeanServerFactory.createMBeanServer("remote.security.example");
server.registerMBean(cntorServer, cntorServerName);
// Setup the rmiregistry to bind in JNDI the RMIConnectorServer stub.
NamingService naming = new NamingService();
ObjectName namingName = ObjectName.getInstance(":service=" + NamingService.class.getName());
server.registerMBean(naming, namingName);
naming.start();
// Start the connector server
cntorServer.start();
System.out.println("Server up and running");
}
Server.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:cacheonix-core
作者:
评论列表
文章目录