Search code examples
weblogic

Is it possible to retrieve a list of WebLogic Domains from Node Manager?


Given a connection to NodeManager is it possible to have it tell you what domains it has registered?

I'm thinking of writing an tool for internal use that would list information about the servers running in the domains (up, down, port, etc) and it would be nice to have the tool automatically include new domains as they are created.

I know I could just parse the nodemanager.domains file, but that means the app has to have access to the server's file system. I'd like to avoid that if possible.


Solution

  • Is JMX an option? If so, just read Accessing WebLogic Server MBeans with JMX.

    Building a connection:

    JMXServiceURL serviceURL =
         new JMXServiceURL(protocol, hostname, port, jndiroot + mserver);
    
    JMXConnector connector = JMXConnectorFactory.connect(serviceURL, options);
    
    MBeanServerConnection connection = connector.getMBeanServerConnection();
    

    Getting the domains:

    String[] domains = connection.getDomains();
    

    Monitoring changes is also possible.