users@glassfish.java.net

Help connecting to Glassfish using JMX

From: <forums_at_java.net>
Date: Mon, 15 Nov 2010 02:06:32 -0800

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