Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8152433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:42:49+00:00 2026-06-06T15:42:49+00:00

I have register my MBean app this way: ObjectName appName = new ObjectName(testpack.Application:name=myApp); MBeanServer

  • 0

I have register my MBean app this way:

ObjectName appName = new ObjectName("testpack.Application:name=myApp");
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
mbs.registerMBean(this, appName);

And next I’m trying to get all registered instances by:

for (ObjectInstance instance : mbs.queryMBeans(appName, null)) {
    System.out.println(instance.toString());
}

But this prints only one instance even if I run many instances of this same app on this same JVM. What I misunderstood? How to do this properly?


EDIT

Excuse me, I misunderstood some basic terms like MBeans, JMX agents, servers and clients. Now I now that my app must be an JMX client and expose common MBean to do some kind of communication across my apps and maybe own managment console in future.

@Gray point me that I’m asking about some different that I want. Now I’m study JMX from basics and some aspects was clearly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T15:42:51+00:00Added an answer on June 6, 2026 at 3:42 pm

    Edit:

    So now it seems that you are talking about multiple JVMs running on a box. By using the ManagementFactory.getPlatformMBeanServer() code, you are accessing the beans in the current JVM only. If you are trying to look at beans on another JVM instance then you are going to have to use a JMX client to connect to that remote process. Using my SimpleJMX package you could do something like:

    JmxClient client = new JmxClient("localhost", somePortNumber);
    Set<ObjectName> objectNameSet = client.getBeanNames();
    ...
    

    Here are the javadocs for my JmxClient. There are certainly others clients that do this. Java 6+ might even have them built in. I know that there are ways to programmatically list the JVM instances on the current computer in Java 6+. My SimpleJMX package does not do that.


    I’m not sure I understand the question but I think you are saying that you have multiple instances of your myApp class but you are only seeing one of them in JMX.

    You are going to have to create unique ObjectName for each of your classes if you want to see them separately via JMX. Typically, we use folders and bean names (sometimes even System.identityHashCode(obj)) to get a unique name for each instance of the object.

    For example, we have a large number of timer factory beans. They have object names like:

    mprew:00=timers,name=MailServerTimerFactory
    mprew:00=timers,name=MysqlManagerTimerFactory
    mprew:00=timers,name=PointsTimerFactory
    

    They all are the same class and we are using the spring bean to identify them specifically.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to build a web application where users can register and have a
I have this code to register dlls into my gac Assembly asm = Assembly.LoadFrom(argument);
We have a C++ application with an embedded JVM (Sun's). Because we register our
I have a register model thats tighly bound to a register view. The register
I have a register page that saves the data to a database the only
I have a requirement where I have to register users first via email. So,
In iOS apps, we have to register nib files with our table view before
Did any one have luck recently register Visual studio 2008 express C# product? Look
Trying to solve a problem with templatetags. I have two templatetags: @register.inclusion_tag('directory/_alphabet.html') def alphabet_list(names):
I have my own templatetag: @register.inclusion_tag('path_to_module.html', takes_context=True) def getmodule(context, token): try: return slow_function(params) except

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.