Hi Bakary,

It looks as if your port is wrong.  Controller.xml is configured to use 1090 
for JMX but your code sample uses 8091.

Cheers, Robert


On 1/30/09 5:08 AM, "Bakary Dialaya DJIBA" <[email protected]> wrote:

Hi all,

Today I'm trying to access to the controller vdb proxy through JMX - RMI with 
the simple jmx client class in examples.

But I have this exception:

java.io.IOException: Failed to retrieve RMIServer stub: 
javax.naming.ServiceUnavailableException [Root exception is 
java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested 
exception is:
    java.net.ConnectException: Connection refused: connect]
    at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:317)
    at 
javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
    ......

Caused by: javax.naming.ServiceUnavailableException [Root exception is 
java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested 
exception is:
    java.net.ConnectException: Connection refused: connect]
    at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:97)
    at 
com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:103)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at 
javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1817)
    at 
javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1787)
    at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:259)
   .........

Is there a config to do before? because I use a simple controller config below:

   <Controller port="25322">
    <Report hideSensitiveData="true" generateOnShutdown="true" 
generateOnFatal="true" enableFileLogging="true" />
    <JmxSettings>
      <RmiJmxAdaptor port="1090" serverPort="1090" />
    </JmxSettings>
    <VirtualDatabase configFile="mysql-raidb1-distribution-2.xml" 
virtualDatabaseName="db" autoEnableBackends="true"/>
  </Controller>

Java code :


    String host = "127.0.0.1";
    String port = "8091";
    String vdb = "db";
    String protocole = "rmi";
    String path = "/jndi/jrmp";
    String username = "me";
    String password = "me";


    JMXServiceURL hostAddress =  new JMXServiceURL(protocole, host, 0, path);

    ObjectName database = JmxConstants.getVirtualDataBaseObjectName(vdb);


    VirtualDatabaseUser vdbUser = new VirtualDatabaseUser(username,password);
    Set principals = new HashSet();
    principals.add(vdbUser);
    Subject subject = new Subject(true,principals,new HashSet(),new HashSet());

    Map environment = new HashMap();
    environment.put(Context.INITIAL_CONTEXT_FACTORY, 
"com.sun.jndi.rmi.registry.RegistryContextFactory");
    environment.put(Context.PROVIDER_URL, "rmi://" + host + ":" + port);


   MBeanServerConnection delegatedConnection = 
JMXConnectorFactory.connect(hostAddress,environment).getMBeanServerConnection(subject);

   VirtualDatabaseMBean proxy = (VirtualDatabaseMBean) 
MBeanServerInvocationHandler.newProxyInstance(delegatedConnection, database, 
VirtualDatabaseMBean.class, false);
   System.out.println(proxy.getAllBackendNames());


How to access to the controller? help! please.

Regards,


--
Robert Hodges, CTO, Continuent, Inc.
Email:  [email protected]
Mobile:  +1-510-501-3728  Skype:  hodgesrm
_______________________________________________
Sequoia mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/sequoia

Reply via email to