cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Narendra Sharma <narendra.sha...@gmail.com>
Subject Re: old JMX code is not working with new cassandra version
Date Wed, 06 Apr 2011 04:36:20 GMT
I think you need to specify the port in the JMXServiceURL. The exception
indicates there is no service listening on given host and port. Also, I
guess, based on 127.0.0.1, you are running the client on same m/c as
Cassandra. If that is not the case then fix the host as well. You might want
to look at the cassandra-env.sh file and comments it in.



On Tue, Apr 5, 2011 at 5:56 PM, Anurag Gujral <anurag.gujral@gmail.com>wrote:

> 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();
>
>


-- 
Narendra Sharma
Solution Architect
*http://www.persistentsys.com*
*http://narendrasharma.blogspot.com/*

Mime
View raw message