Skip to Main Content
WebLogic: The Definitive Guide
book

WebLogic: The Definitive Guide

by Jon Mountjoy, Avinash Chugh
February 2004
Intermediate to advanced content levelIntermediate to advanced
848 pages
27h 25m
English
O'Reilly Media, Inc.
Content preview from WebLogic: The Definitive Guide

Examples

WebLogic contains hundreds of MBeans. The following sections cover examples of some of the Runtime, Configuration, and Security MBeans and examines common ways of manipulating these MBeans. Other MBeans provided by WebLogic may be manipulated similarly.

Runtime MBeans

A prime example of a Runtime MBean is the ServerRuntimeMBean, which provides information on the operational status of a server and other details such as its listen address and port. The following code uses WebLogic’s type-safe approach to connect to a Managed Server, print out its listen address and port, and then shut it down:

serverRuntime = (ServerRuntimeMBean) 
      localHomeB.getRuntimeMBean("ServerB", "ServerRuntime");
System.out.println("Listens on " +
      serverRuntime.getListenAddress( )+":"+serverRuntime.getListenPort( ));
serverRuntime.shutdown( );

You can do the same thing using the weblogic.Admin tool:

java weblogic.Admin -url http://serverb.x:7001 -username system -password pssst
  INVOKE -mbean "myClusterDomain:Location=ServerB,Name=ServerB,Type=ServerRuntime" 
  -method shutdown

The ServerRuntimeMBean will exist on the Local Home of each server instance. To find all of the server runtimes, we will have to contact the Administration Server:

Set mbeanSet = adminHome.getMBeansByType("ServerRuntime"); Iterator mbeanIterator = mbeanSet.iterator( ); while (mbeanIterator.hasNext( )) { ServerRuntimeMBean serverRuntime = (ServerRuntimeMBean)mbeanIterator.next( ); System.err.println("Found server: " + serverRuntime.getName( ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Building Microservices with Spring Boot, Second Edition

Building Microservices with Spring Boot, Second Edition

Josh Long / Phillip Webb
Spring Microservices in Action, Second Edition

Spring Microservices in Action, Second Edition

John Carnell, Illary Huaylupo Sanchez
Kubernetes: Up and Running, 2nd Edition

Kubernetes: Up and Running, 2nd Edition

Brendan Burns, Joe Beda, Kelsey Hightower
Learn OpenShift

Learn OpenShift

Denis Zuev, Artemii Kropachev, Aleksey Usov

Publisher Resources

ISBN: 059600432XErrata Page