5 Replies Latest reply on May 12, 2014 10:06 AM by Justin Bertram

    ClassCastException with JMSQueueControl

    Aurélien Lansmanne Newbie



      I'm trying to list all messages from my HornetQ Queue, but I've got a very strange exception :


      MBeanServerConnection server = ManagementFactory.getPlatformMBeanServer();
      ObjectName queueObjectName = new ObjectName("jboss.as:subsystem=messaging,hornetq-server=default,jms-queue=testQueue");

      JMSQueueControl queueControl = (JMSQueueControl)MBeanServerInvocationHandler.newProxyInstance(server,queueObjectName,JMSQueueControl.class,false);    








      2014-04-30 10:43:31,868 ERROR [stderr] java.lang.ClassCastException: [Ljavax.management.openmbean.CompositeData; cannot be cast to [Ljava.util.Map;



      2014-04-30 10:43:31,869 ERROR [stderr] at $Proxy101.listMessages(Unknown Source)


      This is thrown from a servlet inside the same Jboss than the one with the Queue...


      If this is not supported anymore, is is possible to access the message content from it's id?