i got the answer.the code follows
ObjectName activeMQ = new ObjectName("org.apache.activemq:BrokerName=localhost,Type=Broker");
In the above code i mention BrokerName's and Type's first letter is capital .but it should be small letter like
ObjectName activeMQ = new ObjectName("org.apache.activemq:brokerName=localhost,type=Broker");