You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Joey Daughtery <jd...@t-sciences.com> on 2012/10/19 16:01:10 UTC

Call qpid jmx from ear deployed in JBoss7.1.2Final

All
The following code when ran in a main method runs as expected.  However,
when I put the code inside an ear and call it via a webservice endpoint, I
get the exception below.  Appears that jboss is interpreting the url as if
the code is attempting to connect to the jboss service.  I was thinking
that because qpid is listening on port 8999, that jboss would hit that
port, there by triggering the jmx lookup on qpid.

Exception:
Failed to retrieve RMIServer stub: javax.naming.NameNotFoundException:
rmi://localhost:8999/jmxrmi -- service
jboss.naming.context.java.rmi:.localhost:8999.jmxrmi"}

Code:

private static void main() {
        String[] attributes = new String[]{"Name", "Owner",
"ActiveConsumerCount", "AutoDelete", "Capacity", "ConsumerCount",
"Description", "Durable", "Exclusive", "FlowOverfull",
            "FlowResumeCapacity", "MaximumDeliveryCount",
"MaximumMessageAge", "MaximumMessageCount", "MaximumMessageSize",
"MaximumQueueDepth", "MessageCount", "QueueDepth", "QueueType",
"ReceivedMessageCount"};

        try {
            Map<String, Object> environment = new HashMap<String, Object>();

// credentials: user name and password
            environment.put(JMXConnector.CREDENTIALS, new String[]{"admin",
"admin"});
            JMXServiceURL url = new
JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:8999/jmxrmi");
            JMXConnector jmxConnector = JMXConnectorFactory.connect(url,
environment);
            MBeanServerConnection mbsc =
jmxConnector.getMBeanServerConnection();
            String[] domains = mbsc.getDomains();
            for (int k = 0; k < domains.length; k++) {
                String domain = domains[k];
                ObjectName queueObjectName = new ObjectName(domain + ":*");
                Set nameSet = mbsc.queryNames(queueObjectName, null);
                Iterator it = nameSet.iterator();
                while (it.hasNext()) {
                    ObjectName n = (ObjectName) it.next();
                    //System.out.println(n.getCanonicalName() + ": " +
n.getKeyPropertyListString());
                    ObjectName queueObjectName2 = new
ObjectName(domain+":"+n.getKeyPropertyListString());
                    Iterator it2 = mbsc.getAttributes(queueObjectName2,
attributes).asList().iterator();
                    System.out.println("########################NEXT
DOMAIN: "+domain+":"+n.getKeyPropertyListString());
                    while (it2.hasNext()) {
                        Attribute att = (Attribute) it2.next();
                        System.out.println("attribute: "+att.getName() + "
value: " + att.getValue());
                    }

                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

Thanks

Joe

Re: Call qpid jmx from ear deployed in JBoss7.1.2Final

Posted by "Weston M. Price" <wp...@redhat.com>.
Hi Joey,
	Yep, I will ask around and see what I can come up with. 

Regards,

Weston
On Oct 22, 2012, at 9:41 AM, Joey Daughtery <jd...@t-sciences.com> wrote:

> Weston
> Thanks for the information. I submitted the following last week, but no one
> has responded.  If you happen to know anyone that might be able to help,
> can you forward the link below to them.
> 
> https://community.jboss.org/thread/208071?tstart=0
> 
> Thanks
> 
> Joe Daughtery
> 
> On Fri, Oct 19, 2012 at 10:28 AM, Weston M. Price <wp...@redhat.com> wrote:
> 
>> Hi Joey,
>>        Probably the best place for this post would be in the AS7 forums
>> as it does appear AS7 is not interpreting the url correctly and since it
>> works as expected outside of the container it looks like it might be a
>> defect on the AS7 side. Probably the best place to start would be in the
>> AS7 forum:
>> 
>> https://community.jboss.org/en/jbossas7?view=discussions
>> 
>> From what I can see in your code, it 'should' work as expected.
>> 
>> Regards,
>> 
>> Weston
>> On Oct 19, 2012, at 10:01 AM, Joey Daughtery <jd...@t-sciences.com>
>> wrote:
>> 
>>> All
>>> The following code when ran in a main method runs as expected.  However,
>>> when I put the code inside an ear and call it via a webservice endpoint,
>> I
>>> get the exception below.  Appears that jboss is interpreting the url as
>> if
>>> the code is attempting to connect to the jboss service.  I was thinking
>>> that because qpid is listening on port 8999, that jboss would hit that
>>> port, there by triggering the jmx lookup on qpid.
>>> 
>>> Exception:
>>> Failed to retrieve RMIServer stub: javax.naming.NameNotFoundException:
>>> rmi://localhost:8999/jmxrmi -- service
>>> jboss.naming.context.java.rmi:.localhost:8999.jmxrmi"}
>>> 
>>> Code:
>>> 
>>> private static void main() {
>>>       String[] attributes = new String[]{"Name", "Owner",
>>> "ActiveConsumerCount", "AutoDelete", "Capacity", "ConsumerCount",
>>> "Description", "Durable", "Exclusive", "FlowOverfull",
>>>           "FlowResumeCapacity", "MaximumDeliveryCount",
>>> "MaximumMessageAge", "MaximumMessageCount", "MaximumMessageSize",
>>> "MaximumQueueDepth", "MessageCount", "QueueDepth", "QueueType",
>>> "ReceivedMessageCount"};
>>> 
>>>       try {
>>>           Map<String, Object> environment = new HashMap<String,
>> Object>();
>>> 
>>> // credentials: user name and password
>>>           environment.put(JMXConnector.CREDENTIALS, new
>> String[]{"admin",
>>> "admin"});
>>>           JMXServiceURL url = new
>>> JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:8999/jmxrmi");
>>>           JMXConnector jmxConnector = JMXConnectorFactory.connect(url,
>>> environment);
>>>           MBeanServerConnection mbsc =
>>> jmxConnector.getMBeanServerConnection();
>>>           String[] domains = mbsc.getDomains();
>>>           for (int k = 0; k < domains.length; k++) {
>>>               String domain = domains[k];
>>>               ObjectName queueObjectName = new ObjectName(domain +
>> ":*");
>>>               Set nameSet = mbsc.queryNames(queueObjectName, null);
>>>               Iterator it = nameSet.iterator();
>>>               while (it.hasNext()) {
>>>                   ObjectName n = (ObjectName) it.next();
>>>                   //System.out.println(n.getCanonicalName() + ": " +
>>> n.getKeyPropertyListString());
>>>                   ObjectName queueObjectName2 = new
>>> ObjectName(domain+":"+n.getKeyPropertyListString());
>>>                   Iterator it2 = mbsc.getAttributes(queueObjectName2,
>>> attributes).asList().iterator();
>>>                   System.out.println("########################NEXT
>>> DOMAIN: "+domain+":"+n.getKeyPropertyListString());
>>>                   while (it2.hasNext()) {
>>>                       Attribute att = (Attribute) it2.next();
>>>                       System.out.println("attribute: "+att.getName() + "
>>> value: " + att.getValue());
>>>                   }
>>> 
>>>               }
>>>           }
>>>       } catch (Exception e) {
>>>           e.printStackTrace();
>>>       }
>>>   }
>>> 
>>> Thanks
>>> 
>>> Joe
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
>> For additional commands, e-mail: users-help@qpid.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: Call qpid jmx from ear deployed in JBoss7.1.2Final

Posted by Joey Daughtery <jd...@t-sciences.com>.
Weston
Thanks for the information. I submitted the following last week, but no one
has responded.  If you happen to know anyone that might be able to help,
can you forward the link below to them.

https://community.jboss.org/thread/208071?tstart=0

Thanks

Joe Daughtery

On Fri, Oct 19, 2012 at 10:28 AM, Weston M. Price <wp...@redhat.com> wrote:

> Hi Joey,
>         Probably the best place for this post would be in the AS7 forums
> as it does appear AS7 is not interpreting the url correctly and since it
> works as expected outside of the container it looks like it might be a
> defect on the AS7 side. Probably the best place to start would be in the
> AS7 forum:
>
> https://community.jboss.org/en/jbossas7?view=discussions
>
> From what I can see in your code, it 'should' work as expected.
>
> Regards,
>
> Weston
> On Oct 19, 2012, at 10:01 AM, Joey Daughtery <jd...@t-sciences.com>
> wrote:
>
> > All
> > The following code when ran in a main method runs as expected.  However,
> > when I put the code inside an ear and call it via a webservice endpoint,
> I
> > get the exception below.  Appears that jboss is interpreting the url as
> if
> > the code is attempting to connect to the jboss service.  I was thinking
> > that because qpid is listening on port 8999, that jboss would hit that
> > port, there by triggering the jmx lookup on qpid.
> >
> > Exception:
> > Failed to retrieve RMIServer stub: javax.naming.NameNotFoundException:
> > rmi://localhost:8999/jmxrmi -- service
> > jboss.naming.context.java.rmi:.localhost:8999.jmxrmi"}
> >
> > Code:
> >
> > private static void main() {
> >        String[] attributes = new String[]{"Name", "Owner",
> > "ActiveConsumerCount", "AutoDelete", "Capacity", "ConsumerCount",
> > "Description", "Durable", "Exclusive", "FlowOverfull",
> >            "FlowResumeCapacity", "MaximumDeliveryCount",
> > "MaximumMessageAge", "MaximumMessageCount", "MaximumMessageSize",
> > "MaximumQueueDepth", "MessageCount", "QueueDepth", "QueueType",
> > "ReceivedMessageCount"};
> >
> >        try {
> >            Map<String, Object> environment = new HashMap<String,
> Object>();
> >
> > // credentials: user name and password
> >            environment.put(JMXConnector.CREDENTIALS, new
> String[]{"admin",
> > "admin"});
> >            JMXServiceURL url = new
> > JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:8999/jmxrmi");
> >            JMXConnector jmxConnector = JMXConnectorFactory.connect(url,
> > environment);
> >            MBeanServerConnection mbsc =
> > jmxConnector.getMBeanServerConnection();
> >            String[] domains = mbsc.getDomains();
> >            for (int k = 0; k < domains.length; k++) {
> >                String domain = domains[k];
> >                ObjectName queueObjectName = new ObjectName(domain +
> ":*");
> >                Set nameSet = mbsc.queryNames(queueObjectName, null);
> >                Iterator it = nameSet.iterator();
> >                while (it.hasNext()) {
> >                    ObjectName n = (ObjectName) it.next();
> >                    //System.out.println(n.getCanonicalName() + ": " +
> > n.getKeyPropertyListString());
> >                    ObjectName queueObjectName2 = new
> > ObjectName(domain+":"+n.getKeyPropertyListString());
> >                    Iterator it2 = mbsc.getAttributes(queueObjectName2,
> > attributes).asList().iterator();
> >                    System.out.println("########################NEXT
> > DOMAIN: "+domain+":"+n.getKeyPropertyListString());
> >                    while (it2.hasNext()) {
> >                        Attribute att = (Attribute) it2.next();
> >                        System.out.println("attribute: "+att.getName() + "
> > value: " + att.getValue());
> >                    }
> >
> >                }
> >            }
> >        } catch (Exception e) {
> >            e.printStackTrace();
> >        }
> >    }
> >
> > Thanks
> >
> > Joe
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>

Re: Call qpid jmx from ear deployed in JBoss7.1.2Final

Posted by "Weston M. Price" <wp...@redhat.com>.
Hi Joey,
	Probably the best place for this post would be in the AS7 forums as it does appear AS7 is not interpreting the url correctly and since it works as expected outside of the container it looks like it might be a defect on the AS7 side. Probably the best place to start would be in the AS7 forum:

https://community.jboss.org/en/jbossas7?view=discussions

From what I can see in your code, it 'should' work as expected. 

Regards,

Weston
On Oct 19, 2012, at 10:01 AM, Joey Daughtery <jd...@t-sciences.com> wrote:

> All
> The following code when ran in a main method runs as expected.  However,
> when I put the code inside an ear and call it via a webservice endpoint, I
> get the exception below.  Appears that jboss is interpreting the url as if
> the code is attempting to connect to the jboss service.  I was thinking
> that because qpid is listening on port 8999, that jboss would hit that
> port, there by triggering the jmx lookup on qpid.
> 
> Exception:
> Failed to retrieve RMIServer stub: javax.naming.NameNotFoundException:
> rmi://localhost:8999/jmxrmi -- service
> jboss.naming.context.java.rmi:.localhost:8999.jmxrmi"}
> 
> Code:
> 
> private static void main() {
>        String[] attributes = new String[]{"Name", "Owner",
> "ActiveConsumerCount", "AutoDelete", "Capacity", "ConsumerCount",
> "Description", "Durable", "Exclusive", "FlowOverfull",
>            "FlowResumeCapacity", "MaximumDeliveryCount",
> "MaximumMessageAge", "MaximumMessageCount", "MaximumMessageSize",
> "MaximumQueueDepth", "MessageCount", "QueueDepth", "QueueType",
> "ReceivedMessageCount"};
> 
>        try {
>            Map<String, Object> environment = new HashMap<String, Object>();
> 
> // credentials: user name and password
>            environment.put(JMXConnector.CREDENTIALS, new String[]{"admin",
> "admin"});
>            JMXServiceURL url = new
> JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:8999/jmxrmi");
>            JMXConnector jmxConnector = JMXConnectorFactory.connect(url,
> environment);
>            MBeanServerConnection mbsc =
> jmxConnector.getMBeanServerConnection();
>            String[] domains = mbsc.getDomains();
>            for (int k = 0; k < domains.length; k++) {
>                String domain = domains[k];
>                ObjectName queueObjectName = new ObjectName(domain + ":*");
>                Set nameSet = mbsc.queryNames(queueObjectName, null);
>                Iterator it = nameSet.iterator();
>                while (it.hasNext()) {
>                    ObjectName n = (ObjectName) it.next();
>                    //System.out.println(n.getCanonicalName() + ": " +
> n.getKeyPropertyListString());
>                    ObjectName queueObjectName2 = new
> ObjectName(domain+":"+n.getKeyPropertyListString());
>                    Iterator it2 = mbsc.getAttributes(queueObjectName2,
> attributes).asList().iterator();
>                    System.out.println("########################NEXT
> DOMAIN: "+domain+":"+n.getKeyPropertyListString());
>                    while (it2.hasNext()) {
>                        Attribute att = (Attribute) it2.next();
>                        System.out.println("attribute: "+att.getName() + "
> value: " + att.getValue());
>                    }
> 
>                }
>            }
>        } catch (Exception e) {
>            e.printStackTrace();
>        }
>    }
> 
> Thanks
> 
> Joe


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org