The Artima Developer Community
Sponsored Link

Java Buzz Forum
WebLogic and JMX

1 reply on 1 page. Most recent reply: Sep 23, 2004 9:35 AM by Vinny Carpenter

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Vinny Carpenter

Posts: 276
Nickname: vscarpente
Registered: Feb, 2003

Vinny is a Java developer/architect working with Java, J2EE, OO, Linux, OpenSource.
WebLogic and JMX Posted: Sep 23, 2004 9:35 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Vinny Carpenter.
Original Post: WebLogic and JMX
Feed Title: Vinny Carpenter's Blog
Feed URL: http://www.j2eegeek.com/error.html
Feed Description: Welcome to my blog. I am a total Java geek that lives in Milwaukee, making my living as an architect/developer, spending all my time with Java, J2EE, OO, Linux, and open source. In my spare time, when I am not in front of my computers, I spend every other minute with my other loves: My wife, books, music, guitars, Formula-1 racing and StarGate. Check out my blog @ http://www.j2eegeek.com/blog
Latest Java Buzz Posts
Latest Java Buzz Posts by Vinny Carpenter
Latest Posts From Vinny Carpenter's Blog

Advertisement

I know I rarely use JMX, the Java Management Extensions (JMX) 1.0 specification that provide open and extensible management services. But there are instances when it's a great thing to have in your tool-belt, specially dealing with applications deployed in a WebLogic cluster in a distributed environment. As users of WebLogic know, WebLogic Server has implemented JMX 1.0 and added its own set of convenience methods and other extensions to facilitate working in the WebLogic Server.

The WebLogic JMX services expose the management attributes and operations of managed resources through one or more managed beans (MBeans). An MBean is really a concrete Java class that is developed per JMX specifications that provides getters and setters for each attribute. For more information, check out the WebLogic documentation for Programming WebLogic Management Services with JMX.

My usage of JMX is fairly limited and it's usually something simple like discovering all the names and addresses of managed servers in a cluster. For redundancy and fault tolerance, I will create caches of data at the individual server level (No, we don't use Coherence :)) that need to be managed across the cluster. My typical pattern is to create a simple admin servlet that sits in each member of the cluster and interacts with the cache via the exposed destroy, reset, display, etc operations. Here's a snippet of code that allows you to discover members of a WebLogic cluster:

         try { 
Environment env =
new Environment();
env.setProviderUrl(
"t3://adminserver:port");
env.setSecurityPrincipal(
"username");
env.setSecurityCredentials(
"password");
Context ctx = env.getInitialContext();
home = (MBeanHome) ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);
}
catch (NamingException e) {
System.out.println(
"Exception caught: " + e);
//do something useful here
}

if (home != null) {
System.out.println(
"Active Domain: " + home.getActiveDomain().getName());
}

//getting the names of servers in the domain
System.out.println(
"Active Servers: ");
Set mbeanSet = home.getMBeansByType(
"ServerRuntime");
Iterator mbeanIterator = mbeanSet.iterator();

while (mbeanIterator.hasNext()) {
ServerRuntimeMBean serverRuntime = (ServerRuntimeMBean) mbeanIterator.next();

if (serverRuntime.getState().equals(ServerStates.RUNNING)) {

if (!serverRuntime.isAdminServer()) {
String[] serverName = serverRuntime.getListenAddress().split(
"/");
String serverURL =
"http://" + serverName[1] + ":" + serverRuntime.getListenPort();
reloadCache(serverURL);
}
}
}

More information is at dev2dev.bea.com and Programming WebLogic Management Services with JMX.

Read: WebLogic and JMX


Swapna

Posts: 1
Nickname: jmxweb
Registered: Oct, 2004

Management of Weblogic remotely Posted: Oct 25, 2004 2:48 AM
Reply to this message Reply
Hi,

Has anybody tried managing weblogic remotely without using any of the weblogic specific jar files. I tried using RMI/IIOP instead of t3 and no weblogic.jar/wlclient.jar files in my runtime classpath. I am able to get the stub but get a CORBA.MARSHAL exception on MBeanServer.queryNames method. Is there anything I am missing. Has anyone faced this problem. Please let me know if you know a solution to this.

Thanks

Flat View: This topic has 1 reply on 1 page
Topic: RE: Don wants to know how Indigo can avoid EJB's fate Previous Topic   Next Topic Topic: Who wouldn't love the Google Desktop Search?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use