Sample WebLogic JMX Client

Our goal is to implement a simple WebLogic JMX client that can be used as a starting point to write any WebLogic JMX client. We will look at the client's code. The classpath used to compile and run the code. The different WebLogic MBeanServers and associated JMX URI's the JMX Client can connect to.

Let's directly dive in the client's code below:

package blog.wls.jmx.client;

import java.util.Hashtable;
import java.util.Set;

public class JMXClient {

public static void main(String[] args) throws Exception {

        JMXConnector jmxCon = null;
        try {
            JMXServiceURL serviceUrl = 
                new JMXServiceURL(

            System.out.println("Connecting to: " + serviceUrl);
            Hashtable env = new Hashtable();
            env.put(javax.naming.Context.SECURITY_PRINCIPAL, "weblogic");
            env.put(javax.naming.Context.SECURITY_CREDENTIALS, "welcome1");

            jmxCon = JMXConnectorFactory.newJMXConnector(serviceUrl, env);
            MBeanServerConnection con = jmxCon.getMBeanServerConnection();
            Set<ObjectName> mbeans = con.queryNames(null, null);
            for (ObjectName mbeanName : mbeans) {
        finally {
            if (jmxCon != null)

Let's take a quick look at the above code.

JMXServiceURL serviceUrl = 
                new JMXServiceURL(

The JMX service URI identifies the following:

  • The protocol used to communicate with the remote WebLogic process. "iiop" in the above example. WebLogic supports "t3", "iiop" and "rmi". We won't touch further on this topic here.
  • The WebLogic process to connect to (host & port ). "" in the above example.

    The port value is available from the <WLS_INSTANCE_HOME>/config/config.xml file:

    Make sure you look under the correct server if several servers are defined as part of your config.xml. For instance in the above case we are connecting to the server identified as "myServer".

    The same information is also available from the server log at <WLS_INSTANCE_HOME>/servers/myServer/logs/myServer.log:

    <Sep 22, 2009 12:05:23 PM PDT> <Notice> <Server> <localhost><myServer>
    <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> 
    <<WLS Kernel>> <> <> <1253585123268> <BEA-002613> <Channel "Default" is now
    listening on myhost:7001 for protocols iiop, t3, ldap, snmp, http.> 
  • The MBeanServer to connect to: "". This identifies WebLogic's "Runtime" MBeanServer. This is the MBeanServer available from any WebLogic process, and that contains both WebLogic and user MBeans.
            Hashtable env = new Hashtable();
            env.put(javax.naming.Context.SECURITY_PRINCIPAL, "weblogic");
            env.put(javax.naming.Context.SECURITY_CREDENTIALS, "welcome1");

The above code specifies properties associated with the connection. "" identifies the package implementing WebLogic's client side connector code. For instance the 't3' or 'iiop' client connector.

"weblogic" and "welcome1" are the login/password associated with the user originating the JMX connection.

In the rest of the code we establish the JMX connection, and then retrieve the ObjectNames for all the MBeans registered in the "Runtime" MBeanServer. The ObjectNames are then displayed on the console. We also make sure we release the connection in a finally block to avoid leaking any resource.

The code doesn't contain any WebLogic specific classes, and can be compiled as follow:

javac -d . blog/wls/jmx/client/

Executing the code requires to add WebLogic client side classes to the execution ClassPath. We need to include the WebLogic JMX connector client side classes. Remember we specified those in the environment properties passed to the JMXConnectorFactory. Below is the command I used:

java -classpath .:$WL_HOME/server/lib/wljmxclient.jar blog/wls/jmx/client/JMXClient

WL_HOME points to the WebLogic binary install.

The above uses WebLogic's thin client classes. In some cases when you access server side classes, or you want to take full advantage of the t3 protocol, you are required to use WebLogic's thick client classes. To do so, you first need to build wlfullclient.jar as follow:

cd $WL_HOME/server/lib
java -jar wljarbuilder.jar

You can then execute the JMX Client as follow:

java -classpath .:$WL_HOME/server/lib/wlfullclient.jar  blog/wls/jmx/client/JMXClient

You can also bundle wlfulclient.jar with your client code. When using the thin client you cannot just bundle wljmxclient.jar with you client code, as this jar references other jars as part of its manifest Class-Path entry. At the time of this writing, you also need to bundle wlclient.jar

At this point we are now able to connect to WebLogic's "Runtime" MBeanServer. Each WebLogic process contains a "Runtime" MBeanServer in which local WebLogic MBeans and user-defined application MBeans are registered. WebLogic also offers two other MBeanServers that are only available from the Domain "AdminServer" process:

  • The "Domain Runtime" MBeanServer. It aggregates the MBeans registered on the domain's "Runtime" MBeanServers. So as long as a managed server is up, its MBeans can be accessed through the "Domain Runtime" MBeanServer. To connect to that MBeanServer, just use the following JMX URI:


    "7002" is the iiop port for my "AdminServer" install. Replace with your AdminServer's port as previously explained. Remember; only the AdminServer process runs the "Domain Runtime" MBeanServer.

  • The "Edit" MBeanServer. It contains the WebLogic Config MBeans that are used to configure the Domain. To connect to that MBeanServer, just use the following JMX URI:


    "7002" is the iiop port for my "AdminServer" install. Replace with your AdminServer's port as previously explained. Remember; only the AdminServer process runs the "Domain Runtime" MBeanServer.

Note: One can also use "t3" or "rmi" as protocol in place of "iiop"

The rest of the client's code remains unchanged. Only the JMX URI needs to be changed to connect to different MBeanServers.


So, if with this client I wish to get all JMSBean instances, how should I do it?

Posted by Daniel on December 17, 2009 at 02:04 AM PST #

Hi, Thank you. But, if I do not want to use User name and password and instead want to pass userConfigFile and userKeyFile (just like I use connect method of WLST), how can I do? Please advise. Thank you

Posted by Sreenivas on March 09, 2010 at 08:12 PM PST #

Sreenivas, Unfortunately userConfigFile and userKeyFile are not yet supported to authenticate pure JMX connections. I have filed an enhancement request to support this in a future release. Thanks, Philippe

Posted by philippe Le Mouel on March 10, 2010 at 11:35 PM PST #

Your post or blog is pretty cool. I happen to stumble upon it when I was looking for something else but it came in handy for me. I was really happy to go through your blog because I found the information that I was looking for.

Posted by Penis Exercise on April 06, 2010 at 01:48 PM PDT #

Nice post, I liked it. I started training with kettlebells a few years ago, and now I'm totally hooked. Most of the info on 'bells is getting more and more accurate because more people are getting into this style of training. It's taking over the world! Thanks for the food for thought.

Posted by Herbert Fial on September 13, 2010 at 02:40 PM PDT #

what would be the case if the protocol is http?

Posted by kevin on September 13, 2010 at 10:09 PM PDT #

Just replace "iiop" in the JMXServiceURL with "http", and enable HTTP tunneling. More info on enbling HTTP tunneling can be found in the WLS documentation. Here is a link:

Posted by philippe Le Mouel on September 14, 2010 at 07:53 AM PDT #

Therefore politically proper. WE interpreted the assertion since it definitely not getting an issue laughing at several colorations. Why cannot we express whatever presently with out the idea staying hateful, racist, sexist and many others .

Posted by Ronda Gliues on September 25, 2010 at 11:37 PM PDT #

Hello from the fashion sector, I actually recognize the you've completed in this post, it was a great read. I graduated Otis Parsons School of Design and am at the moment functioning on building an on the net forum for those functioning within the business to join with each other. I've gained a couple great suggestions for my site from reading this.

Posted by Fashion Merchandising on September 30, 2010 at 06:28 PM PDT #

im not sure if your aware but this blog does not show properly in my web browser for some reason. i checked with firefox too.

Posted by Maxx Extend Review on November 17, 2010 at 09:29 PM PST #

Hi, Currently on weblogic 10.3, I would like to restrict access from T3/RMI for example with no credentials : Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); env.put(Context.PROVIDER_URL,"t3://HOSTNAME:PORT"); env.put(Context.SECURITY_PRINCIPAL,""); env.put(Context.SECURITY_CREDENTIALS,""); it is possible to interact with the databases thanks to weblogic.jdbc.common.internal.RmiDataSource : InitialContext ictx = new InitialContext(env); Context ctx = (Context) ictx.lookup(""); Connection connection = ((javax.sql.DataSource)ctx.lookup("NAME_OF_THE_RMIDATASOURCE")).getConnection() String sql = "Select user from dual"; Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery(sql); I haven't found any documentation regarding a possible restriction. Thank you, Linkou

Posted by Linkou on November 26, 2010 at 12:41 AM PST #

I've had an Afro for 5 years. It's a statement of who I am and where I'm from. Enjoy the Fro!

Posted by Suzy Prunty on January 18, 2011 at 01:00 PM PST #

I have used this several times in the past very successfully; however, I did run across an overall performance issue with the approach.

Posted by fashion ideas on January 19, 2011 at 03:19 PM PST #

Definitely believe that which you said. Your favorite justification seemed to be on the net the easiest thing to be aware of. I say to you, I definitely get annoyed while people think about worries that they plainly do not know about. You managed to hit the nail upon the top and also defined out the whole thing without having side effect , people can take a signal. Will probably be back to get more. Thanks

Posted by posicionamiento seo on February 03, 2011 at 06:34 AM PST #

Dam this Blog is AWESOME. If you wrote this any better i would think you were a super human. lol nice.:)

Posted by Valentin Lawes on February 03, 2011 at 05:23 PM PST #

Hello, Just to add some info... This procedure is only for WLS 9.x and ongoing. The older method with type safe stubs works in WLS9.x and ongoing with compatibility module.. but on later fails to retrieve thread pool information. So, unfortunately for multiversion monitoring you should articulate both methods. Also, I've read in the comments some kind of confusion trying to add credentials dynamically.. I used this piece of code: import; import; [...] String userid = System.getProperty(""); UsernameAndPassword usernameAndPassword=UserConfigFileManager.getUsernameAndPassword("./conf/"+userid+"-"+hostname+"-"+port+"", "./conf/"+userid+"-"+hostname+"-"+port+"", "" ); username=new String(usernameAndPassword.getUsername()); password=new String(usernameAndPassword.getPassword());

Posted by manu on February 08, 2011 at 01:58 AM PST #

I just wanted to let you know how much we appreciate almost everything you've provided to help increase the value of the lives of men and women in this subject matter. Through your current articles, I have gone through just a beginner to a skilled in the area. It can be truly a tribute to your endeavours. Thanks

Posted by zero friction marketing on March 03, 2011 at 05:57 AM PST #

Great blog here i like all the information thats being shared, congratulations.

Posted by Backlinks on March 05, 2011 at 09:08 PM PST #

I feel like you could probably teach a class on how to make a great blog. This is fantastic! I have to say, what really got me was your design. You certainly know how to make your blog more than just a rant about an issue. Youve made it possible for people to connect. Good for you, because not that many people know what theyre doing.

Posted by Paxil medicine on March 06, 2011 at 07:45 AM PST #

Hi There, I just want to know how to use jmx client to connect to localhost, instead of using localhost or, can I use local ipaddress. I tried using local ipaddress but it is not working. Any answers would be greatly appreciated. I tried to use iiop,t3 with ipaddress but it started throwing "unreachable destination" Thanks Softtech

Posted by softtech on March 23, 2011 at 03:11 AM PDT #

you are really a good webmaster. The website loading speed is incredible. It seems that you're doing any unique trick. In addition, The contents are masterwork. you've done a wonderful job on this topic!

Posted by soccer jerseys from china on April 06, 2011 at 11:01 AM PDT #

low seminal fluid production food for sperm count increase how to improve sperm motility improve sperm health factors affecting sperm morphology increasing ejaculation amount how to enhance sperm motility how to increase my ejaculation increasing sperm count diet increase volume of ejaculate vitamins to produce more sperm loss of seminal fluid how to increase ejaculation pressure increase your load naturally zinc for sperm count sperm production vitamins to increase sperm quality sperm pill amount of sperm ejaculation ways to low sperm count

Posted by buy sex toys on April 06, 2011 at 11:02 AM PDT #

I really appreciate this cool article:) From there i get something I want to know:D Thanks for the info:D

Posted by Vitamin Trula on April 24, 2011 at 05:15 PM PDT #

Can you provide more information about this? Thanks

Posted by kopfschmerzen hausmittel on April 26, 2011 at 08:29 PM PDT #

Can ANYONE tell me how to use the t3 protocol for a remote jmx client on a "foreign" server like Tomcat to connect to Weblogic? Everyone simply says make sure the wlfullclient.jar (or the other two) file is in your class. Well I have with no luck, still. I put the jar file in WEB-INF/lib and the jar scanner complains about the servlet.class. I removed it and rebuilt the jar. I kept doing that still with no luck . . . I keep getting the t3 protocol unsupported error message that you see all over Oracle's forums and the internet forums. I have moved it to the main Tomcat lib directory.l I have create a custom setenv.bat file that is called and shows that wlfullclient.jar is loaded and in the classpath. Nothing. Nothing works. So, if anyone has been able to do this I would appreciate knowing what exactly I am doing wrong.

Posted by Tommy Peterson on February 03, 2013 at 10:09 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

The official blog for Oracle WebLogic Server fans and followers!

Stay Connected


« March 2015