incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anurag Gujral <anurag.guj...@gmail.com>
Subject old JMX code is not working with new cassandra version
Date Wed, 06 Apr 2011 00:56:06 GMT
Hi All,
          I had written code for cassandra 0.6.3 using JMX to call
compaction,when I try to use that code to connect to 0.7.3 I get the
following
error
Exception in thread "main" java.rmi.ConnectException: Connection refused to
host: 127.0.0.1; nested exception is:
    java.net.ConnectException: Connection refused
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
    at
sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:110)
    at javax.management.remote.rmi.RMIServerImpl_Stub.newClient(Unknown
Source)
    at
javax.management.remote.rmi.RMIConnector.getConnection(RMIConnector.java:2327)
    at
javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:279)
    at
javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
    at com.bluekai.Client.doCompaction(Client.java:51)
    at com.bluekai.Client.main(Client.java:41)
Caused by: java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:525)
    at java.net.Socket.connect(Socket.java:475)
    at java.net.Socket.<init>(Socket.java:372)
    at java.net.Socket.<init>(Socket.java:186)
    at
sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
    at
sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595

Any suggestions
Thanks
Anurag

I am pasting below the structure of the code I am using,it is giving above
error on when JMXConnectorFactory.connect is called.

MXServiceURL url =
            new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + host +
"/jmxrmi");

        System.out.println("before connection=host:"+host);
        JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
        System.out.println("After connection");
        // Get an MBeanServerConnection
        MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();

        // Construct the ObjectName for the QueueSampler MXBean
        ObjectName mxbeanName =
            new
ObjectName("org.apache.cassandra.db:type=ColumnFamilyStores,keyspace="+keyspace+",columnfamily="+columnfamily);

        // Create a dedicated proxy for the MXBean instead of
        // going directly through the MBean server connection
        ColumnFamilyStores mxbeanProxy =
            JMX.newMXBeanProxy(mbsc, mxbeanName, ColumnFamilyStores.class);
        mxbeanProxy.forceMajorCompaction();
        jmxc.close();

Mime
View raw message