YOUR FEEDBACK
shirley wrote: As an ISV and service provider, we specialise in .NET based collaboration soluti...
Cloud Computing Conference
March 22-24, 2009, New York
Register Today and SAVE !..

2008 East
DIAMOND SPONSOR:
Data Direct
Frontiers in Data Access: The Coming Wave in Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
Intel
Virtualization – Path to Predictive Enterprise
Green Hills
IT Security in a Hostile World
JBoss / freedom oss
Practical SOA Approach
GOLD SPONSORS:
Software AG
The Art & Science of SOA: How Governance Enables Adoption
PlateSpin
Effective Planning for Virtual Infrastructure Growth
Fujitsu
Automated Business Process Discovery & Virtualization Service
Ceedo
Workspace Virtualization
Click For 2007 West
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts

SYS-CON.TV
TOP THREE LINKS YOU MUST CLICK ON


Using JMX
Using JMX

The Java Management API (JMX) has been integral to managing the WebLogic Server since WebLogic 6.0. Through this API you can search for management beans (mbeans) within the application server and query them for both configuration information and runtime monitoring information. In addition, this API can be used to actually change the configuration of the server. In fact, this API is used internally by the console and other administration tools to do their work and report their data.

This API can be a powerful tool for monitoring. Let's look at an example. In this application, you have mostly static content, some JSP pages for your personalized pages, a registration system, a JMS-based data feed, and maybe a small billing application. Where in this application can we use JMX to our advantage? On the static page side, you can access the information for the FileServlet and see how much time was spent serving the static content. It might be less than you expect because of the amount of caching that browsers do automatically on the client side. Most requests for static content will be HEAD requests, checking for changes. For dynamic pages, each servlet in the system is accounted for separately. This data doesn't perfectly reflect the user experience (because the user has the lag between when their request is sent and when they receive the page back), but it does tell just how long each servlet, on average, spends in a request and how many have been made. Our registration system is an entity bean, while the billing system is a stateless session bean backed by an external service. Both beans can be monitored and the information used to tune the size of the caches and pools. Our data feed can also be interrogated to determine if we have been getting as many messages as we have been paying for, or to determine how many subscribers are using the data. Throughput can also be calculated using the attributes on the JMS topic and queue mbeans. Finally, all JDBC connections can be monitored and from their mbeans you can find out how much the pool connections are contended, which will tell you if you need more database client licenses, for instance.

The second use of mbeans in the WebLogic Server is for configuration information. The configuration of all resources is contained at runtime by the configuration mbeans. These mbeans are essentially an instantiated representation of the information contained within the config.xml file. Everything from which applications are deployed to which port a server listens on is contained within these interfaces. Most of the individual attributes are relatively straightforward; however, the collection of attributes that describes a deployment unit is complicated and they have been collected for convenience behind the weblogic.Deployer class. Accessing them directly is possible but not reccommended except for looking at configuration and not changing it. The rest of the attributes are fair game, although beware, most of those attributes will only actually change runtime behavior if the component (like a JDBC pool) is redeployed or if the server is restarted. Applications of these configuration mbeans range from determining the resources that a particular application is using to tweaking values based on the feedback from the monitoring mbeans.

As you can see, there's a lot of information - but how do you get to it if you're new to JMS and the WebLogic Server? It's actually not that hard. As long as you can use JNDI and read JavaDocs you'll find it pretty easy to navigate the hierarchy of mbeans. In the code sample below you can see how you find the local server mbean home and then find the JDBC pool.

MBeanHome home = (MBeanHome) new
InitialContext().lookup(MBeanHome.LOCAL_JNDI_NAME);
Set pools = home.getMBeansByType("JDBCConnectionPool");

This gives you the configuration mbeans for the JDBC pools. If you want to monitor the pools rather than look at their configuration, simply change the type of mbean by adding "Runtime" to it. From this mbean you can determine important information like whether you are leaking connections - you can even get a stack trace of where exactly the connection was allocated!

What if you want to use the JMX mbean system without doing any Java programming, like from a script file? Fortunately, we include a tool that will let you view and change mbeans directly from the command line - weblogic.Admin. In addition to PINGing servers, getting JNDI listings, resetting pools, and shutting down the server, it gives you direct access to the mbean hierarchy. In the next code sample you'll see the equivalent weblogic.Admin command.

java weblogic.Admin -username system -password [password] -url [url] GET
-pretty -type JDBCConnectionPool

This gives you an easily readable description of the mbeans that match the type descriptor plus the properties on those mbeans. Similarly, there is a SET command that will change the properties on any mbean in the system.

Armed with this tool you should be able to monitor your applications internally in Java and externally from scripts.

About Sam Pullara
Sam Pullara has been a software engineer at WebLogic since 1996 and has contributed to the architecture, design, and implementation of many aspects of the application server. e-mail: sam@sampullara.com

YOUR FEEDBACK
Alexander wrote: I would like to recive more jmx examples code, thank You
Chris Dahl wrote: It would be nice to have a few more JMX example code snippits to do some common things like maybe to untarget an MDB that is encountering too many errors. It seems there are very few JMX code examples out there and I find it difficult to glean specific runtime bean behavior control from the manual.
BEA WEBLOGIC LATEST STORIES
Okay, here's the deal. When you observe the big software guys and see how quickly they adopt emerging technologies, which will change IT the way we know it today, here is what we see. Larry Ellison invested millions in old SaaS / cloud companies, which gave him zippo in return, and he ...
SYS-CON Events announced today that more than 40 Cloud technology providers, as well as Virtualization and SOA companies will exhibit at the upcoming 1st International Cloud Computing Conference & Expo (www.CloudComputingExpo.com), November 19-21, in San Jose, California. The conferenc...
SYS-CON Events announced today that the leading global SOA, Virtualization, Cloud Computing and Open Source technology provider FreedomOSS named "Gold Sponsor" of SYS-CON's SOA World Conference & Expo which will take place November 19-21, 2008, at the Fairmont Hotel in the heart of Sil...
Cassatt, the company started by BEA founder Bill Coleman, is redirecting its data center widgetry into creating internal clouds comparable to Amazon or Google out of infrastructure customers already have in-house. Coleman observed that most IT professionals aren’t comfortable outsour...
Just as people begin to understand the difference between web ops and IT, we are entering a period where clouds promise "Ops-Free" computing. Because it’s easy, scalable, available and disposable, the cloud is well on its way to becoming “technology’s next big thing.” However, ...
As far as the software industry goes, these tough economic days give the biggest business advantage to those companies who contribute directly to the solution of the big global problem and they will be the first to flourish as we dig ourselves from the ditch. Call that the new Y2K prob...
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON FEATURED WHITEPAPERS

ADS BY GOOGLE
BREAKING NEWS FROM THE WIRES

In the graph before the boilerplate, the first sentence should read: The Evans Data...