Java Management Solutions Borcon 2005 Ken Sipe Borcon 2005 Ken Sipe

Slides:



Advertisements
Similar presentations
Managing Components with JMX Rickard Öberg JBoss.
Advertisements

TSpaces Services Suite: Automating the Development and Management of Web Services Presenter: Kevin McCurley IBM Almaden Research Center Contact: Marcus.
Web Service Ahmed Gamal Ahmed Nile University Bioinformatics Group
RMI Varun SainiYing Chen. What is RMI? RMI is the action of invoking a method of a remote interface on a remote object. It is used to develop applications.
Remote Method Invocation
Seminarium on Component-based Software Engineering Jan Willem Klinkenberg CORBA.
A DAPT IST Replication Framework: Progress Report Vance Maverick University of Bologna Dec. 11, 2003.
G O B E Y O N D C O N V E N T I O N WORF: Developing DB2 UDB based Web Services on a Websphere Application Server Kris Van Thillo, ABIS Training & Consulting.
Presentation 7 part 2: SOAP & WSDL. Ingeniørhøjskolen i Århus Slide 2 Outline Building blocks in Web Services SOA SOAP WSDL (UDDI)
Introduction to Java 2 Enterprise Edition About myself –Neutrinos, Cancer Research, IT Applications Today’s topic: J2EE –Context –Advantages –Components.
Notes to the presenter. I would like to thank Jim Waldo, Jon Bostrom, and Dennis Govoni. They helped me put this presentation together for the field.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
CS 501: Software Engineering Fall 2000 Lecture 16 System Architecture III Distributed Objects.
October 2003 Iosif Legrand Iosif Legrand California Institute of Technology.
Network Management with JMX Thu Nguyen Oliver Argente CS158B.
Java Server and Servlet CS616 Team 9 Kim Doyle, Susan Kroha, Arunima Palchowdhury, Wei Xu.
12-1 © Prentice Hall, 2004 Chapter 12: Design Elements Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey.
Understanding and Managing WebSphere V5
A Framework for Smart Proxies and Interceptors in RMI Nuno Santos P. Marques, L. Silva CISUC, University of Coimbra, Portugal
Java TM Management Extensions (JMX TM ) Adam Quan.
Course # 3250 Best Practices and Design Patterns for JMX Development Satadip Dutta Justin Murray Hewlett-Packard.
1 3. Implementing Web Services 1.Create SOAP proxy interfaces and WSDL based service descriptions 2.Register/publish services 3.Stores service descriptions.
Original work by David Moran JMX Update Scott Molenaar 11/08/2004.
December 3-6, 2007, Santa Clara Marriott, Santa Clara, CA Wiseman: enabling JMX applications via WS-Management JSR-262(Web Services Connector): JMX apps.
Bologna, September 2003 Giorgia Lodi Department of Computer Science University of Bologna V.Ghini, F. Panzieri.
Enterprise Java Bean Matt. 2 J2EE 3 J2EE Overview.
第十四章 J2EE 入门 Introduction What is J2EE ?
1 HKU CSIS DB Seminar: HKU CSIS DB Seminar: Web Services Oriented Data Processing and Integration Speaker: Eric Lo.
J2EE Structure & Definitions Catie Welsh CSE 432
Enterprise Java v120131Intro to JavaEE1 Java EE 5 TM Introduction.
Cli/Serv.: rmiCORBA/131 Client/Server Distributed Systems v Objectives –introduce rmi and CORBA , Semester 1, RMI and CORBA.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Web Services Description Language CS409 Application Services Even Semester 2007.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
In the name of Allah The Proxy Pattern Elham moazzen.
Mike Dickson Tidal Software
1 Cisco Unified Application Environment Developers Conference 2008© 2008 Cisco Systems, Inc. All rights reserved.Cisco Public Introduction to Etch Scott.
Shannon Hastings Multiscale Computing Laboratory Department of Biomedical Informatics.
RMI remote method invocation. Traditional network programming The client program sends data to the server in some intermediary format and the server has.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Introduction to Spring Remoting Simplifying.
CS 501: Software Engineering Fall 1999 Lecture 12 System Architecture III Distributed Objects.
Configuring & Managing Web Services for Joachim Flammer Integration Team EGEE is a project funded by the European Union under contract IST
Java Management Extensions (JMX) Jmx Introduction.
Jini Architecture Introduction System Overview An Example.
Kemal Baykal Rasim Ismayilov
1 Service Creation, Advertisement and Discovery Including caCORE SDK and ISO21090 William Stephens Operations Manager caGrid Knowledge Center February.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
JMX David Moran 10/20/03. Agenda Overview Managed Beans Services Remote API J2EE Management Implementations Future Directions Demo.
3246 JSF Support in JBuilder 2005 Karl Ewald R&D Engineer Borland Software Corporation.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 32 JavaBeans and Bean.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
(C) 2003 University of ManchesterCS31010 Lecture 14: CORBA.
Interstage BPM v11.2 1Copyright © 2010 FUJITSU LIMITED INTERSTAGE BPM ARCHITECTURE BPMS.
1 CS 501 Spring 2002 CS 501: Software Engineering Lecture 15 System Architecture III.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
BOF-1147, JavaTM Technology and WebDAV: Standardizing Content Management Java and WebDAV Juergen Pill Team Leader Software AG Remy Maucherat Software Engineer.
Java Distributed Computing
Remote Method Invocation
Extending Java RMI for Dynamic Reconfiguration
Java EE Overview The problem Java Enterprise Edition attempts to solve: maximize the use of Java technologies by providing a suite of Java technology specifications.
Managing Components with JMX
Inventory of Distributed Computing Concepts and Web services
Mike Dickson Tidal Software
Java EE Overview The problem Java Enterprise Edition attempts to solve: maximize the use of Java technologies by providing a suite of Java technology specifications.
ESIS Consulting LLC (C) ESIS Consulting LLC. All rights reserved
WebServices Using JAX-RPC
Introduction to Web Services
Java Remote Method Invocation
Knowledge Byte In this section, you will learn about:
Presentation transcript:

Java Management Solutions Borcon 2005 Ken Sipe Borcon 2005 Ken Sipe

All Stuff No Fluff No Fluff ™ 2 Overall Presentation Goal tDefined the problem space and need that JMX solves. tProvided details on the architecture and understanding of the technology tProvide resources need to expound on this learning.

All Stuff No Fluff No Fluff ™ 3 Speaker’s Qualifications t tSun Certified Java 2 Architect. t tInstructor for VisiBroker for Java, OOAD, Rational Rose, and Java Development. t tFrequently speaks on the subject of distributed computing programming, including CORBA and EJB architecture. t tJBoss Certified Developer ;)

All Stuff No Fluff No Fluff ™ 4 Presentation Agenda tJMX Introduction tJMX Architecture Instrumentation Level Agent Level Distributed Services Level JMX Object Naming tLeveraging JMX

All Stuff No Fluff No Fluff ™ 5 What is JMX? t tJava Management Extensions t tProvides runtime application configuration and management. Update services on the fly No downtime t tProvides monitoring services with notification services. Standardized toolsets t tRequired for future J2EE Services

All Stuff No Fluff No Fluff ™ 6 JMX History tJSR – 03 Early need recognition tJMX 1.0 – Sept 2000 t JMX 1.2 – Dec 2002

All Stuff No Fluff No Fluff ™ 7 Implementations of the Spec t Sun tIBM Not really available separately any more, part of WAS 5.x t AdventNet t JBoss t mx4j

All Stuff No Fluff No Fluff ™ 8 Where’s JMX currently used tWAS 5.0 tTomcat 5.0 mx4j tJBoss 2.4.x, 3.x, and 4.0 beta jbossmx tWeblogic 7.x tRequired J2EE 1.4 J2SE 1.5

All Stuff No Fluff No Fluff ™ 9 Related Specifications tJSR-77 J2EE Management API tJSR-88 J2EE Deployment API tJSR-160 JMX Remote API tJSR-174 Monitoring and Management for the JVM machine

All Stuff No Fluff No Fluff ™ 10 J2EE Management API JSR-77 tJ2EE 1.4 Required tProvides API for Managed Objects J2EEDomain JVM SessionBean tState Management tPerformance Monitoring tSNMP Provides a common tool set to provide monitoring tools for any J2EE server.

All Stuff No Fluff No Fluff ™ 11 Java Management Diagram

All Stuff No Fluff No Fluff ™ 12 J2EE Deployment API JSR-88 tJ2EE 1.4 Required tLeverages JSR-77 for Targeting deployment

All Stuff No Fluff No Fluff ™ 13 JMX Remote API JSR -160 tJMX specification since 1.0 defined distributed services as a level of the architecture. However even specification 1.2 merely mentions it and do not define it. tDefines the an interoperable, transparent, secure and flexible solution for clients to connect to JMX servers. tDefines: Connectors Transport Lookup Services Bindings

All Stuff No Fluff No Fluff ™ 14 New to JMX 1.2 tOpen Mbeans manitory tNew interface StandardMBean interface tClass loader repository redesigned and class loading behavior clarified. tNew Security Chapter tUpdates to: Timer service Monitor service ObjectName class

All Stuff No Fluff No Fluff ™ 15 Presentation Agenda tJMX Introduction tJMX Architecture Instrumentation Level Agent Level Distributed Services Level JMX Object Naming tLeveraging JMX

All Stuff No Fluff No Fluff ™ 16 JMX Architecture Diagram

All Stuff No Fluff No Fluff ™ 17 JMX Architecture tInstrumentation Level Defines the implementation of manageable resources commonly referred to as MBeans or Managed Beans. There are several defined types of MBeans which will be outlined in the Instrumentation section. This level essentially defines interfaces and APIs for the developer to adhere to during the implement of an Mbean. tAgent Level Defines the agents and services which will provide access to the managed resources. This level is implemented and provided to the developer providing services and the MBeanServer. tDistributed Level This level is defined in the specification as being needed and provides the details of HTML accessible, or SNMP capable. The specification doesn’t provide a clear direction here, stating that it isn’t in scope for this phase of the specification. Tribal knowledge defines this level as Connectors and Adaptors to the services. Additionally there is JSR-160 which defines JMX remote API, which purpose is to provide JMX agent discovery and access to clients.

All Stuff No Fluff No Fluff ™ 18 Instrumentation Level tMBeans Must provide the following characteristics Public and concrete One public constructor  Does not have to be a no argument constructor Categories Standard MBean Dynamic MBean

All Stuff No Fluff No Fluff ™ 19 Standard MBean tMost Simple tPredefined set of attributes and operations which are fixed in an Interface tTwo Components The interface This interface defines the publicly exposed API It has a specific naming convention* The class implementation Class must implement the defined interface

All Stuff No Fluff No Fluff ™ 20 Standard MBean Interface Example public interface VMMonitorMBean { public String getThreadCount(); public String getFreeMemory(); public String getTotalMemory(); }

All Stuff No Fluff No Fluff ™ 21 Standard MBean Class Example public class VMMonitor implements VMMonitorMBean { public String getThreadCount() { ThreadGroup root = Thread.currentThread().getThreadGroup(); while (root.getParent() != null) root = root.getParent(); return root.activeCount() + " active threads"; } public String getFreeMemory() { return Runtime.getRuntime().freeMemory() + " bytes"; } public String getTotalMemory() { return Runtime.getRuntime().totalMemory() + " bytes"; } }

All Stuff No Fluff No Fluff ™ 22 JMX 1.2 Standard MBean The JMX 1.2 Specification addresses the issue of forcing the MBean notation on an interface name. It allows for the creation of a standard MBean with an interface of an arbitrary name. The relationship of the interface and the implementation is managed by the creation of a StandardMBean object. The new StandardMBean class removes the necessary to follow the previously required naming convention of the MBean interface. Previously the association of the MBean interface to the MBean implementation was by naming convention. The StandardMBean constructor provides the associate in JMX 1.2. This allows the developer to name new interfaces any name desired or to over existing interfaces without change. In our StandardMBean example, the interface VMMonitorMBean could be named VMMonitor. In this case the following would create the StandardMBean which could then be registered with the MBeanServer: Mbean = new StandardMBean(new VMMonitorImpl(), VMMonitor.class);

All Stuff No Fluff No Fluff ™ 23 Dynamic MBean t Does NOT define fixed list of attributes and operations. Attributes and operations are dynamic at runtime. t Must implement the DynamicMBean interface t Types Dynamic MBean Any MBean which is dynamic Model MBean Extends ModelMBean interface, which extends the DynamicMBean interface Open MBean Dynamic MBean which follows specific rules

All Stuff No Fluff No Fluff ™ 24 DynamicMBean Interface public interface DynamicMBean { public MBeanInfo getMBeanInfo(); public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException; public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException; public AttributeList getAttributes(String[] attributes); public AttributeList setAttributes(AttributeList attributes); public Object invoke(String method, Object[] arguments, String[] params) throws MBeanException, ReflectionException; }

All Stuff No Fluff No Fluff ™ 25 Dynamic MBean Characteristics tWorks much like a COM object. tQuery the interface with the getMBeanInfo() tInvoke the method with the invoke() method

All Stuff No Fluff No Fluff ™ 26 MBeanInfo Class public class MBeanInfo implements Cloneable, Serializable { public String getClassName() public String getDescription() public MBeanConstructorInfo[] getConstructors() public MBeanAttributeInfo[] getAttributes() public MBeanOperationInfo[] getOperations() public MBeanNotificationInfo[] getNotifications() }

All Stuff No Fluff No Fluff ™ 27 Dynamic MBean Pros / Cons tPro: Programmatic access to the meta data MBean is not statically bound to Java class. The bean could manage a resource which didn’t exist at the time of development. Faster execution. tCons: Much more to develop.

All Stuff No Fluff No Fluff ™ 28 Model MBeans tMbean which extends the ModelMBean interface. public abstract interface ModelMBean extends DynamicMBean, PersistentMBean, ModelMBeanNotificationBroadcaster { void setModelMBeanInfo(ModelMBeanInfo modelMBeanInfo) throws MBeanException, RuntimeOperationsException; void setManagedResource(Object object, String string) throws MBeanException, RuntimeOperationsException, InstanceNotFoundException, InvalidTargetObjectTypeException; } tPersistentMBean Interfaces adds the signatures necessary to persist the state of the Mbean tModelMBeanNotificationBroadcaster Interface provides the methods necessary to broadcast notifications

All Stuff No Fluff No Fluff ™ 29 Model Mbean Characteristics t Provides a generic template for managing resources. t Provides extensions to the management interfaces, such as attributes, operations, constructors, and notifications. t Defines behavioral properties such as security, transactions, persistence, and caching.

All Stuff No Fluff No Fluff ™ 30 Open MBean t The open in Open MBeans carries the same connotation as open standards. tIt refers to providing MBeans which follow standards in such a way that there is a high degree of interoperability. tUses OpenMBeanInfo vs. MBeanInfo class tImplements the DynamicMBean interface tAll types are constrained to: Java data typesJava Wrapper types (java.lang.Double) java.lang.Stringjava.lang.Void java.util.Date java.math.BigInteger java.math.BigDecimal javax.management.ObjectName Java.management.open mbean.CompositeData java.management.openmbean. TabularData (interface)

All Stuff No Fluff No Fluff ™ 31 XMBeans (Not part of Spec) tTerm first introduced by JBoss Development team. tDefines a Dynamic Mbean which is configured and specified in XML. All the meta-data is described in XML tOther follow: IBM has a XML specification for Mbeans deployed in WAS Common Modeler Used by Tomcat 5

All Stuff No Fluff No Fluff ™ 32 Presentation Agenda tJMX Introduction tJMX Architecture Instrumentation Level Agent Level Distributed Services Level JMX Object Naming tLeveraging JMX

All Stuff No Fluff No Fluff ™ 33 Agent Level tMBean Server MBean Registration Component Communication Channel tPre-defined Service / MBeans M-Let Service Dynamic loading service Timer Service Notification service Monitoring Service Counter Monitor, Gauge Monitor, String Monitor Relation Service Maintains relationship information Notifies on relationship changes

All Stuff No Fluff No Fluff ™ 34 MBeanServer tCreating an MBeanServer MBeanServer server = MBeanServerFactory.createMBeanServer(); MBeanServer server = MBeanServerFactory.createMBeanServer(“server1”); tFinding an MBeanServer ArrayList servers = MBeanServerFactory.findMBeanServer(null); MBeanServer server = (MBeanServer)servers.get(0);

All Stuff No Fluff No Fluff ™ 35 Registering an MBean MBeanServer server = MBeanServerFactory.createMBeanServer(); ObjectName name = new ObjectName("Server:name=Monitor"); server.registerMBean(new VMMonitor(), name);

All Stuff No Fluff No Fluff ™ 36 M-Let Services tMLet Tag constructor arglist tExample

All Stuff No Fluff No Fluff ™ 37 M-Let Dynamic Loading name = new ObjectName(“service:name=MLET"); server.registerMBean(new MLet(), name); server.invoke(name, "getMBeansFromURL", new Object[] {new URL(" new String[]{URL.class.getName()} );

All Stuff No Fluff No Fluff ™ 38 Timer Service tRegistration of 2 Mbeans with MBeanServer Timer - Broadcaster Reciever tStart the timer tInvoke the addNotification method on the Timer taddNotificationListener with a Filter

All Stuff No Fluff No Fluff ™ 39 Timer Registration ObjectName timer = new ObjectName("service:name=timer"); ObjectName receiver = new ObjectName("domain:name=timerlistener"); // Timer: import javax.management.timer.Timer; server.registerMBean(new Timer(), timer); // TimerReciever: is user defined, implements // javax.management.NotificationListener; server.registerMBean(new TimerReceiver(),receiver); server.invoke(timer, "start", null, null);

All Stuff No Fluff No Fluff ™ 40 AddNotification Date date = new Date(System.currentTimeMillis() + Timer.ONE_SECOND * 5); Integer id = (Integer)server.invoke(timer,"addNotification", new Object[] { "timer.event", // type "Notification Message", // message null, // user specific data date // event time }, new String[]{ String.class.getName(), Object.class.getName(), Date.class.getName(), }); server.addNotificationListener(timer, receiver, new ExampleFilter(id), null);

All Stuff No Fluff No Fluff ™ 41 Notification Filter public class ExampleFilter implements NotificationFilter { Integer id; public ExampleFilter(Integer id) { this.id = id; } public boolean isNotificationEnabled(Notification notification) { // check / filter the notification message if(notification.getType().equals("timer.event")) { // we know it is of type TimerNotification TimerNotification timerNote = (TimerNotification) notification; if(timerNote.getNotificationID().equals(id)) // it's a timerNotification and it's this specific timer notification return true; } return false; } }

All Stuff No Fluff No Fluff ™ 42 Presentation Agenda tJMX Introduction tJMX Architecture Instrumentation Level Agent Level Distributed Services Level JMX Object Naming tLeveraging JMX

All Stuff No Fluff No Fluff ™ 43 Distribution Level tVery loose in the specification tTribal definition: Connectors and Adaptors HtmlAdaptorServer HttpAdaptor RMIAdaptor tJSR-160 Remote Access Specification allows any transport RMI ** IIOP ** JMXMP * HTTP SOAP JMS

All Stuff No Fluff No Fluff ™ 44 HtmlAdaptor Example HtmlAdaptorServer adaptor = new HtmlAdaptorServer(); adaptor.setPort(8082); ObjectName adName = new ObjectName("Server:name=HttpAdaptor"); server.registerMBean(adaptor, adName); // start he adaptor service, which blocks the main thread adaptor.start();

All Stuff No Fluff No Fluff ™ 45 Html Console

All Stuff No Fluff No Fluff ™ 46 HttpAdaptor Console

All Stuff No Fluff No Fluff ™ 47 Remote Access JSR-160 tMBeanServerConnection Provides remote access All methods through IOException Must explicitly close connections

All Stuff No Fluff No Fluff ™ 48 Remote / Local Access Comparison  Local access: MBeanServer server = MBeanServerFactory.createMBeanServer(); server.createMBean(className, obName); Object a = server.getAttribute(obName, “Attr”); Set names = server.queryNames(...);  Remote access: JMXConnector c = JMXConnectorFactory.connect(url); MBeanServerConnection server = c.getMBeanServerConnection(); server.createMBean(className, obName); Object a = server.getAttribute(obName, “Attr”); Set names = server.queryNames(...); c.close();

All Stuff No Fluff No Fluff ™ 49 Remote Listeners tCode is the same as local tConnector handles forwarding notifications to remote clients. class MyListener implements NotificationListener {...} NotificationListener l = new MyListener(); server.addNotificationListener(obName, l);

All Stuff No Fluff No Fluff ™ 50 JMX Remote URL tStarts with “service:jmx:” service:jmx:rmi://host/… service:jmx:jmxmp://host:port

All Stuff No Fluff No Fluff ™ 51 Presentation Agenda tJMX Introduction tJMX Architecture Instrumentation Level Agent Level Distributed Services Level JMX Object Naming tLeveraging JMX

All Stuff No Fluff No Fluff ™ 52 ObjectName tDefines a unique name for an Mbean tUsed to distinguish a bean for invocation tUsed to query a server for a specific bean tUsed to manage notification and relationship.

All Stuff No Fluff No Fluff ™ 53 Object Naming Convention t[Domain]:property=value[,otherproperty=othervalue]* tSpecial Characters can not be used in the name Colon (:) Comma(;) Equals(=) Asterisks (*) tExample Names Server:name=Monitor WebSphere:name=server1,process=server1,platform=common,node=fezzik,version =5.0,type=Server,mbeanIdentifier=cells/fezzik/nodes/fezzik/servers/server1/server.x ml#Server_1,cell=fezzik,processType=UnManagedProcess

All Stuff No Fluff No Fluff ™ 54 Querying Object Names t*:*,type=Server,* All Mbeans of type Server t*:*,cell=fezzik All Mbeans on the cell named fezzik

All Stuff No Fluff No Fluff ™ 55 Presentation Agenda tJMX Introduction tJMX Architecture Instrumentation Level Agent Level Distributed Services Level JMX Object Naming tLeveraging JMX Code and Demos

All Stuff No Fluff No Fluff ™ 56 VMMonitor Example public class VMMonitorTester { public static void main(String[] args) throws Exception { MBeanServer server = MBeanServerFactory.createMBeanServer(); // register the new service ObjectName name = new ObjectName("VM"); server.registerMBean(new VMMonitor(), name); // register the http adaptor // HttpAdaptor adaptor = new HttpAdaptor(); HtmlAdaptorServer adaptor = new HtmlAdaptorServer(); adaptor.setPort(8082); ObjectName adName = new ObjectName("Server:name=HttpAdaptor"); server.registerMBean(adaptor, adName); adaptor.start(); }

All Stuff No Fluff No Fluff ™ 57 Working with WAS 5 Starting Server Starting wsadmin Query a MBean object name. Get all attributes for the MBean.

Demos / Code VMMonitor Timer Example WAS 5 VMMonitor Timer Example WAS 5

All Stuff No Fluff No Fluff ™ 59 Need to know Tools tMx4j tEJTools tJakarta Commons Modeler tMBeanInspector - (WebSphere) tSun

All Stuff No Fluff No Fluff ™ 60 Conclusion tJMX is mature tJMX is here to stay tJMX defines the standard for Management and Monitoring

Questions?

Thank You Please fill out the speaker evaluation You can contact me further at... Please fill out the speaker evaluation You can contact me further at...