Posts

Showing posts from 2018

mysql how to fix Access denied for user 'root'@'localhost'

sudo mysql -u root use mysql; [mysql] update user set plugin='mysql_native_password' where User='root'; [mysql] flush privileges; Now you should be able to login with your password.

How to get consumer count using JMX API in ActiveMQ

first, get a connection to a JMX server (assumes localhost, port 9010, no auth) First you need to start activemq with jmx service. Add below jvm parameters to java opts- -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.rmi.port=9011 -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.local.only=false JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9010/jmxrmi");       JMXConnector jmxc = JMXConnectorFactory.connect(url);       MBeanServerConnection conn = jmxc.getMBeanServerConnection();       ObjectName activeMQ = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost");       BrokerViewMBean mbean = (BrokerViewMBean) MBeanServerInvocationHandler.newProxyInstance(conn,           activeMQ, BrokerViewMBean.class, ...