users@glassfish.java.net

Re: Help connecting to Glassfish using JMX

From: Nigel Deakin <nigel.deakin_at_oracle.com>
Date: Mon, 15 Nov 2010 11:02:53 +0000

Oscar,

You posted the same question to the GlassFish Message Queue forum: please see my response there:
http://forums.oracle.com/forums/thread.jspa?forumID=874&threadID=2129291

If you need to follow up on that forum I'll respond.

Nigel


forums_at_java.net wrote, on 15/11/2010 10:06:
> Hi all,
>
> I am trying to develop an app that connects to Glassfish using JMX. I am
> researching for a relativelly long time, but I am still having some issues.
>
> Asking around, I got some links that helped me to build this code to create a
> Queue:
>
> HashMap environment = new HashMap();
> String[] credentials = new String[] {"superadmin", "superadmin"};
> environment.put (JMXConnector.CREDENTIALS, credentials);
>
> JMXServiceURL url = new
> JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:8686/jmxrmi");
> // Get JMX connector, supplying user name and password
> JMXConnector jmxc1 = JMXConnectorFactory.connect(url, environment);
> // Get MBean server connection
> MBeanServerConnection mbsc = jmxc1.getMBeanServerConnection();
>
> ObjectName destMgrConfigName = new
> ObjectName(MQObjectName.DESTINATION_MANAGER_CONFIG_MBEAN_NAME);
> // Create operation's parameter and signature arrays
> Object opParams[] = { DestinationType.QUEUE, "MyQueue" };
> String opSig[] = { String.class.getName(), String.class.getName() };
> // Invoke operation
> mbsc.invoke(destMgrConfigName, DestinationOperations.CREATE, opParams,
> opSig);
> // Close JMX connector
> jmxc1.close();
>
>
>
> when I run this code, I get this exception: Exception in thread "main"
> javax.management.InstanceNotFoundException:
> com.sun.messaging.jms.server:type=DestinationManager,subtype=Config
>
> I did it heavly "inspired" by these examples:
> http://docs.sun.com/app/docs/doc/821-1797/gdrru?l=en&a=view
>
> but the big difference is that they use a AdminConnectionFactory, which
> generates me this error: Exception in thread "main"
> java.lang.IllegalAccessError: tried to access method
> com.sun.messaging.jmq.io.MQAddress.<init>()V from class
> com.sun.messaging.jmq.management.JMXMQAddress
>
>
>
> I am stuck and would really appreciate any help that would make me move
> forward.
>
>
>
> Thanks a lot,
>
> Oscar
>
>
> --
>
> [Message sent by forum member 'oscarfh']
>
> View Post: http://forums.java.net/node/717828
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>