0 Replies Latest reply: Jan 8, 2015 2:23 PM by 976438 RSS

    Getting UCP Connection Pool statistics over JMX

    976438

      Hi,

      I'm trying to get UCP Connection Pool statistics over JMX, my code is as below..


      public static JMXConnector connector;

      public static String host,port ="";

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

      connector = JMXConnectorFactory.connect(jmxURL);

      MBeanServerConnection connection = connector.getMBeanServerConnection();

      ObjectName oracleUCP = new ObjectName("oracle.ucp.admin.UniversalConnectionPoolMBean:name=UniversalConnectionPoolManager-XXXXXXX");


      UniversalConnectionPoolLifeCycleState ucpLifeState = (UniversalConnectionPoolLifeCycleState)connection.invoke(oracleUCP, "getLifeCycleState", null, null);

      UniversalConnectionPoolStatistics ucpS = (UniversalConnectionPoolStatistics)connection.invoke(oracleUCP, "getStatistics", null, null);

      connector.close();

      int avlableConn = ucpS.getAvailableConnectionsCount();
      int peakConnCount = ucpS.getPeakConnectionsCount();

      System.out.println("Available conn: "+avlableConn+"Peak Conn: "+peakConnCount);

      ------------------------------------------------------------------------------------------------------------------------------------

      Output Exception:


      java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
      java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: oracle.ucp.jdbc.oracle.OracleJDBCConnectionPoolStatisticsImpl
      at sun.rmi.server.UnicastRef.invoke(Unknown Source)
      at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
      at javax.management.remote.rmi.RMIConnectionImpl_Stub.invoke(Unknown Source)
      at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.invoke(Unknown Source)
      at QueryMBeans.main(QueryMBeans.java:47)
      Caused by: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: oracle.ucp.jdbc.oracle.OracleJDBCConnectionPoolStatisticsImpl
      at java.io.ObjectInputStream.readObject0(Unknown Source)
      at java.io.ObjectInputStream.readObject(Unknown Source)
      at sun.rmi.server.UnicastRef.unmarshalValue(Unknown Source)
      ... 5 more
      Caused by: java.io.NotSerializableException: oracle.ucp.jdbc.oracle.OracleJDBCConnectionPoolStatisticsImpl
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
      at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:274)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:315)
      at sun.rmi.transport.Transport$1.run(Transport.java:159)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)

      Edited by: user11901464 on Nov 28, 2012 1:32 AM