Hi Kyle,
here is an example script which connects to an admin server and retrieves domain's servers runtime mbeans. Tested on WLS8.1.5, jython2.2.1 and don't forget to use the same version of jre as the weblogic server you are connecting to.


[user@box ~]$ echo $CLASSPATH
/home/user/lib/weblogic.jar

[user@box ~]$ jython
Jython 2.2.1 on java1.4.2_08
Type "copyright", "credits" or "license" for more information.
>>> from weblogic.jndi import Environment
>>> from weblogic.management import MBeanHome
>>>
>>> def AdminMBean(server = None, user = None, password = None):
...         """connect to a weblogic admin server and return MBeanHome.ADMIN_JNDI_NAME
...         AdminMBean(server = None, user = None, password = None)"""
...        if server is None or user is None or password is None:
...            print 'Missing some arguments! AdminMBean(server = None, user = None, password = None)'
...            return None
...        else:
...            env = Environment(providerUrl = 't3://' + server + ':80', securityPrincipal = user, securityCredentials = password)
...            ctx = env.initialContext
...            return ctx.lookup(MBeanHome.ADMIN_JNDI_NAME)
...
>>>
>>> admin = AdminMBean(**{'user': 'system', 'password': 'password', 'server': 'adminServer'})
>>> running_servers = admin.getMBeansByType('ServerRuntime')
>>> running_servers = running_servers.toArray()
>>> for server in running_servers:
...         print server.name
...
server1
server2
server3
adminServer
server4

Hope it helps,
Marcel


----- Original Message ----
From: Kyle Reynolds <kreynold@hotmail.com>
To: jython-users@lists.sourceforge.net
Sent: Thursday, March 27, 2008 10:29:40 AM
Subject: [Jython-users] weblogic JMX

 Can someone show me a small example of using jython/jmx to connect to a weblogic mbeanserver (not using WLST).  I have found many examples, but they all use WLST...

Thanks!



How well do you know your celebrity gossip? Talk celebrity smackdowns here.



Looking for the perfect gift? Give the gift of Flickr!