Oracle Fusion Middleware Developing Java EE Management Applications for Oracle WebLogic Server. 12c ( )

Similar documents
Developing Java EE Management Applications for Oracle WebLogic Server c (12.1.3)

1 Introduction and Roadmap

1 Introduction and Roadmap

BEAWebLogic Server. Monitoring and Managing with the Java EE Management APIs

BEAWebLogic. Server. Monitoring and Managing with the J2EE Management APIs

BEAWebLogic. Server. Monitoring and Managing with the J2EE Management APIs

Microsoft Active Directory Plug-in User s Guide Release

Oracle Fusion Middleware Creating Domain Templates Using the Domain Template Builder. 12c ( )

Oracle Fusion Middleware

Oracle Enterprise Manager

Oracle Database Appliance Accessibility Guide. Release

Oracle Fusion Middleware Known Issues in Oracle Stream Analytics

Oracle Identity Manager Connector Guide for Dropbox. Release

Microsoft Internet Information Services (IIS) Plug-in User s Guide Release

Oracle NoSQL Database Integration with SQL Developer. Release 18.1

Oracle Cloud Using Oracle E-Business Suite Adapter Endpoint Configuration Wizard. Release 17.3

Oracle SQL Developer Web Accessibility Guide. Release 18.1

Oracle Cloud Getting Started with Oracle WebCenter Portal Cloud Service

Database Change Reference Release 6.3

Oracle Linux. UEFI Secure Boot Signing Key Update Notice

Oracle Cloud Known Issues for Trial and Paid Subscriptions. Release 18.1

Oracle Cloud E

Oracle Hospitality OPERA Exchange Interface Cloud Authentication. October 2017

Oracle Communications Configuration Management

Oracle Banking Channels Bank User Base

Microsoft.NET Framework Plug-in User s Guide Release

What s New for Cloud at Customer What's New for the Cloud Services on Oracle Cloud at Customer New Documentation for Oracle Cloud at Customer

Oracle Cloud Using the Google Calendar Adapter with Oracle Integration

Oracle Cloud What's New for Oracle WebCenter Portal Cloud Service

What s New for Oracle Cloud Stack Manager. Topics: July Oracle Cloud. What's New for Oracle Cloud Stack Release

WebLogic Tuxedo Connector Quick Start Guide for Oracle WebLogic Server 11g Release 1 (10.3.6)

Oracle Fusion Middleware Oracle Cloud Adapters Postinstallation Configuration Guide. 12c Release ( )

Oracle Fusion Middleware Installing and Configuring Oracle SOA Suite and Oracle Business Process Management. 12c ( )

Oracle Cloud Using the Google Calendar Adapter. Release 17.3

Oracle Cloud E

Oracle Cloud. Oracle Cloud Adapters Postinstallation Configuration Guide E

Oracle Utilities Work and Asset Management Integration to Primavera P6 Enterprise Project Portfolio Management

Oracle Fusion Middleware Oracle Technology Adapters Release Notes. 12c ( )

Oracle Fusion Middleware Planning an Installation of Oracle Fusion Middleware. 12c ( )

Oracle Utilities Advanced Spatial and Operational Analytics

Oracle Enterprise Manager Ops Center. Introduction. What You Will Need. Installing and Updating Local Software Packages 12c Release

Oracle SQL Developer Data Modeler Accessibility Guide. Release 18.1

Oracle Fusion Middleware

Oracle Fusion Middleware

Release for Microsoft Windows

Oracle SQL Developer Accessibility Guide. Release 18.1

Creating Domain Templates Using the Domain Template Builder 11g Release 1 (10.3.6)

Oracle Enterprise Manager Ops Center. Introduction. What You Will Need. Hardware and Software Configuration

Oracle Utilities Opower Custom URL Configuration

Oracle Agile Product Lifecycle Management for Process Reporting User Guide Release E

Oracle. Field Service Cloud Using the Parts Catalog

Oracle Enterprise Data Quality for Product Data

Oracle Cloud. Using Oracle Eloqua Adapter Release E

Oracle Enterprise Manager Ops Center. Introduction. What You Will Need. Creating vservers 12c Release 1 ( )

Export generates an empty file

Oracle Agile Product Lifecycle Management for Process

Oracle Enterprise Manager Ops Center. Introduction. What You Will Need

Oracle Hospitality Suite8 Export to Outlook User Manual Release 8.9. July 2015

JD Edwards World. Service Enablement Guide Release A9.3 E

PeopleSoft Fluid Required Fields Standards

Oracle Cloud Using the Eventbrite Adapter with Oracle Integration

Oracle Cloud Using the Trello Adapter. Release 17.3

Oracle Communications Convergent Charging Controller. Sample Message Flows Reference Guide Release 6.0.1

Report Management and Editor!

Oracle Fusion Middleware Oracle Business Process Management Release Notes. 12c ( )

Security Guide Release 4.0

Oracle Utilities Customer Care and Billing

Modeling Network Integrity Release 7.3.1

Oracle Hospitality Query and Analysis Languages and Translation Configuration Guide. March 2016

Oracle Banking APIs. Part No. E Third Party Simulation Guide Release April 2018

Oracle Cloud. Using the Google Calendar Adapter Release 16.3 E

Oracle Cloud Using the Microsoft Adapter. Release 17.3

PeopleSoft Fluid Icon Standards

Oracle Utilities Smart Grid Gateway

Oracle Fusion Middleware Installing and Configuring Oracle Business Intelligence. 12c ( )

Oracle Enterprise Manager Ops Center

Oracle Fusion Middleware Developing Custom Jars and Custom Stages in Oracle Stream Analytics

IBM WebSphere Portal Reference Guide Release 9.2.x

Insbridge Enterprise Rating Portal Configuration Guide

Oracle Virtual Desktop Client for ipad. Release Notes for Release 1.2

Oracle Fusion Middleware

Oracle Hospitality MICROS Commerce Platform Release Notes Release Part Number: E December 2015

Java Platform, Standard Edition Java Flight Recorder Command Reference. Release 10

Oracle Insurance. Implementing a. Release 5.6

Oracle Hospitality Suite8 XML Export of Invoice Data for Hungarian Tax Authority Release and Higher E November 2016

Oracle Fusion Middleware

Oracle Cloud Using the UiPath Robotic Process Automation Adapter with Oracle Integration F

Oracle Real-Time Scheduler

Taleo Enterprise Deep Linking Configuration Guide Release 17

Oracle Cloud Using the Evernote Adapter. Release 17.3

Oracle. Applications Cloud Using Functional Setup Manager. Release 13 (update 18A)

Oracle Fusion Middleware Installing and Configuring Oracle Managed File Transfer. 12c ( )

Oracle Fusion Middleware

Managing Zone Configuration

Oracle Cloud Using the Eventbrite Adapter. Release 17.3

Oracle Fusion Middleware Oracle Stream Analytics Release Notes. 12c Release ( )

Oracle Fusion Middleware

Oracle Utilities Work and Asset Management

Recipe Calculation Survey. Materials Control. Copyright by: MICROS-FIDELIO GmbH Europadamm 2-6 D Neuss Date: August 21 st 2007.

Oracle Fusion Middleware

Transcription:

Oracle Fusion Middleware Developing Java EE Management Applications for Oracle WebLogic Server 12c (12.2.1.3.0) E80441-01 August 2017

Oracle Fusion Middleware Developing Java EE Management Applications for Oracle WebLogic Server, 12c (12.2.1.3.0) E80441-01 Copyright 2015, 2017, Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable: U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, delivered to U.S. Government end users are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agencyspecific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, shall be subject to license terms and license restrictions applicable to the programs. No other rights are granted to the U.S. Government. This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. This software or hardware and documentation may provide access to or information about content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services, except as set forth in an applicable agreement between you and Oracle.

Contents Preface Documentation Accessibility Conventions v v 1 Introduction and Roadmap 1.1 Document Scope and Audience 1-1 1.2 Guide to This Document 1-1 1.3 Related Documentation 1-1 1.4 New and Changed Features in this Release 1-2 2 Using the Java EE Management APIs 2.1 Understanding the Java EE Management Model and APIs 2-1 2.1.1 JMO Hierarchy 2-1 2.1.2 JMO Object Names 2-2 2.1.3 Optional Features of JMOs 2-2 2.1.4 Accessing JMOs 2-2 2.2 The Java EE Management Model on WebLogic Server 2-2 2.3 Accessing the MEJB on WebLogic Server 2-3 2.3.1 Example: Querying Names of JMOs 2-3 2.4 WebLogic Server Extensions 2-4 iii

iv

Preface This preface describes the document accessibility features and conventions used in this guide Developing Java EE Management Applications for Oracle WebLogic Server. Documentation Accessibility Conventions For information about Oracle's commitment to accessibility, visit the Oracle Accessibility Program website at http://www.oracle.com/pls/topic/lookup? ctx=acc&id=docacc. Access to Oracle Support Oracle customers that have purchased support have access to electronic support through My Oracle Support. For information, visit http://www.oracle.com/pls/topic/ lookup?ctx=acc&id=info or visit http://www.oracle.com/pls/topic/lookup?ctx=acc&id=trs if you are hearing impaired. The following text conventions are used in this document: Convention boldface italic monospace Meaning Boldface type indicates graphical user interface elements associated with an action, or terms defined in text or the glossary. Italic type indicates book titles, emphasis, or placeholder variables for which you supply particular values. Monospace type indicates commands within a paragraph, URLs, code in examples, text that appears on the screen, or text that you enter. v

1 Introduction and Roadmap This chapter describes the contents and audience for this guide Developing Java EE Management Applications for Oracle WebLogic Server. This chapter includes the following sections: Document Scope and Audience Guide to This Document Related Documentation New and Changed Features in this Release 1.1 Document Scope and Audience This document is a resource for software developers who develop management services for Java EE applications and for software vendors who develop JMXcompatible management systems. It also contains information that is useful for business analysts and system architects who are evaluating WebLogic Server or considering the use of JMX for a particular application. The information in this document is relevant during the design and development phases of a software project. The document does not address production phase administration, monitoring, or performance tuning topics. For links to WebLogic Server documentation and resources for these topics, see Related Documentation. It is assumed that the reader is familiar with Java EE and general application management concepts. This document emphasizes a hands-on approach to developing a limited but useful set of JMX management services. For information on applying JMX to a broader set of management problems, refer to the JMX specification or other documents listed in Related Documentation. 1.2 Guide to This Document This document is organized as follows: This chapter, Introduction and Roadmap, describes the scope and organization of this guide. Using the Java EE Management APIs, introduces JMX and describes common ways to use it in conjunction with other WebLogic Server management features and describes WebLogic-specific extensions to JSR 77. 1.3 Related Documentation Oracle has a Web site that provides links to books, white papers, and additional information on JMX: http://www.oracle.com/technetwork/java/javase/tech/ javamanagement-140525.html. 1-1

Chapter 1 New and Changed Features in this Release To view the JMX 1.2 specification and API documentation, download it from http:// jcp.org/aboutjava/communityprocess/final/jsr003/index3.html. To view the JMX Remote API 1.0 specification and API documentation, download it from http://jcp.org/aboutjava/communityprocess/final/jsr160/index.html. For guidelines on developing other types of management services for WebLogic Server applications, see the following documents: Adding WebLogic Logging Services to Applications Deployed on Oracle WebLogic Server describes WebLogic support for internationalization and localization of log messages, and shows you how to use the templates and tools provided with WebLogic Server to create or edit message catalogs that are locale-specific. Configuring and Using the Diagnostics Framework for Oracle WebLogic Server describes how system administrators can collect application monitoring data that has not been exposed through JMX, logging, or other management facilities. For guidelines on developing and tuning WebLogic Server applications, see the following documents: Developing Applications with WebLogic Server is a guide to developing WebLogic Server applications. Developing Manageable Applications Using JMX for Oracle WebLogic Server describes how to create and register custom MBeans. 1.4 New and Changed Features in this Release For a comprehensive listing of the new WebLogic Server features introduced in this release, see What's New in Oracle WebLogic Server 1-2

2 Using the Java EE Management APIs Use the Java EE Management APIs to create a single Java program that can discover and browse resources on any Java EE Web application server. Examples of Java program resources are JDBC connection pools and deployed applications. The Java EE Management APIs are part of the Java EE Management Specification, which requires all Java EE Web application servers to describe their resources in a standard data model. The Java EE Management specification describes a standard data model for monitoring and managing the run-time state of any Java EE Web application server and its resources. It includes standard mappings of the model through a Java EE Management EJB Component (MEJB). The chapter includes the following sections that describe how to use the Java EE Management APIs on WebLogic Server: Understanding the Java EE Management Model and APIs The Java EE Management Model on WebLogic Server Accessing the MEJB on WebLogic Server WebLogic Server Extensions 2.1 Understanding the Java EE Management Model and APIs 2.1.1 JMO Hierarchy The Java EE Management data model defines a set of managed objects that must be provided by the Java EE platform using defined Management EJB interfaces. In the Java EE Management data model, each instance of a Web application server resource type is represented by a Java EE Managed Object (JMO). The Java EE Management Specification describes exactly which types of resources must be represented by a JMO. JMOs themselves contain only a limited set of attributes, which are used to describe the location of the object in the data model. Download the Java EE Management Specification from http://jcp.org/aboutjava/ communityprocess/final/jsr077/index.html. The data model organizes JMOs hierarchically in a tree structure. The root JMO is J2EEDomain, which represents a collection of Web application server instances that are logically related. J2EEDomain contains the object names for all instances of the J2EEServer JMO, each of which represents a server instance in the collection. Java applications can browse the hierarchy of JMOs, recursively querying for object names and looking up the JMOs that are named by the query results. 2-1

Chapter 2 The Java EE Management Model on WebLogic Server 2.1.2 JMO Object Names Each JMO instance is identified by a unique object name of type javax.management.objectname. The names follow this pattern: domain:name=j2eetype=value,name=value,parent-j2eetype[,property=value]* For example, mydomain:j2eetype=j2eedomain,name=mydomain The Java EE Management Specification describes exactly which name/value pairs must be in the object names for each JMO type. The object name for each child JMO contains name/value pairs from its parent JMO's object name. For example, if the JMO for a server instance is named mydomain:j2eetype=j2eeserver,name=myserver then the JMO for a servlet that is part of an application deployed on that server instance would be named: mydomain:j2eeapplication=myapplication,j2eeserver=myserver,webmodule=myapp_mywebmodul e,j2eetype=servlet,name=myservlet_name The name/value pairs can appear in any order. 2.1.3 Optional Features of JMOs 2.1.4 Accessing JMOs The Java EE Management Specification, version 1.0, requires only that Web application servers implement JMOs and provide API access to the JMOs. Optionally, you can implement the JMOs to provide performance statistics, management operations, and to emit notifications when specified events occur. A Java application accesses the JMOs through javax.management.j2ee.management, which is the remote interface for the Management Enterprise Java Bean (MEJB). The Java EE Management Specification requires that the MEJB's home interface be registered in a server's JNIDI tree as ejb.mgmt.mejb. See the API Reference for the javax.management.j2ee package: http:// docs.oracle.com/javaee/6/api/javax/management/j2ee/package-summary.html. 2.2 The Java EE Management Model on WebLogic Server WebLogic Server implements only the required features of the Java EE Management Specification, version 1.1. Therefore, the following limitations are in place: None of the JMOs provide performance statistics, management operations, or emit notifications. There are no mappings to the Common Information Model (CIM). There are no mappings to an SNMP Management Information Base (MIB). 2-2

Chapter 2 Accessing the MEJB on WebLogic Server The MEJB and JMOs are available only on the Administration Server. This is consistent with the Java EE Management Model, which assumes that most Java EE Web servers exist within some logically connected collection and that there is a central point within the collection for accessing or managing the server instances. From the Administration Server, a Java application can browse to the JMO that represents any resource on any server instance in the WebLogic Server domain. Because WebLogic Server implements its JMOs as a wrapper for its MBeans, any changes in a WebLogic Server MBean that corresponds to a JMO is immediately available through the Java EE Management APIs. For all JMO object names on WebLogic Server, the domain: portion of the object name corresponds to the name of the WebLogic Server domain. 2.3 Accessing the MEJB on WebLogic Server You can access the Management Enterprise Bean component (MEJB) interfaces on the Oracle WebLogic server. Use the MEJB component to query and retrieve the WebLogic monitoring data. To retrieve monitoring data through the MEJB: 1. Look up the javax.management.j2ee.managementhome interface through the Administration Servers JNDI tree under the name ejb.mgmt.mejb. 2. Use ManagementHome to construct an instance of javax.management.j2ee.management, which is the MEJB's remote interface. 2.3.1 Example: Querying Names of JMOs Use the javax.management.j2ee.management.querynames method to query the names of JMOs in a WebLogic domain. The example class in Example 2-1 accesses the MEJB for a WebLogic Server domain and invokes javax.management.j2ee.management.querynames method. This method returns the object name for all JMOs in the domain. Example 2-1 Querying Names of JMOs import java.io.ioexception; import java.net.malformedurlexception; import java.util.iterator; import java.util.set; import java.util.properties; import javax.management.j2ee.management; import javax.management.j2ee.managementhome; import javax.management.attributenotfoundexception; import javax.management.instancenotfoundexception; import javax.management.objectname; import javax.management.queryexp; import javax.naming.context; import javax.naming.initialcontext; import javax.naming.namingexception; import javax.ejb.createexception; public class GetJMONames { static String url = "t3://localhost:7001"; static String user = "weblogic"; static String password = "weblogic"; public static void main(string[] args) { try { 2-3

Chapter 2 WebLogic Server Extensions getalljmonames(); catch(exception e){ System.out.println(e); public static Management getmejbremote() throws IOException, MalformedURLException, NamingException,CreateException { Context context = getinitialcontext(); ManagementHome home = (ManagementHome) context.lookup("ejb.mgmt.mejb"); Management bean = home.create(); return bean; public static Context getinitialcontext() throws NamingException { Properties p = new Properties(); p.put(context.initial_context_factory, "weblogic.jndi.wlinitialcontextfactory"); p.put(context.provider_url, url); if (user!= null) { p.put(context.security_principal, user); if (password == null) password = ""; p.put(context.security_credentials, password); return new InitialContext(p); public static void getalljmonames() { try { Management rhome = getmejbremote(); String string = ""; ObjectName name = new ObjectName(string); QueryExp query = null; Set allnames = rhome.querynames(name, query); Iterator nameiterator = allnames.iterator(); while(nameiterator.hasnext()) { ObjectName on = (ObjectName)nameIterator.next(); System.out.println(on.getCanonicalName() + "\n"); catch (Exception ex) { ex.printstacktrace(); 2.4 WebLogic Server Extensions WebLogic Server implements an extension to JSR 77 that gives you access to WebLogic-specific deployment descriptors using the MEJB, just like the standard Java EE deployment descriptors. The productspecificdeploymentdescriptor attribute returns the XML contents of the WebLogic-specific descriptor file. Example 2-2 illustrates calling the method. 2-4

Chapter 2 WebLogic Server Extensions Example 2-2 productspecificdeploymentdescriptor // Get the WLS specific deployment descriptor. // This is similar to the call for the standard descriptor // (i.e., the "deploymentdescriptor" attribute) // dd = (String) managementbean.getattribute(objname, "productspecificdeploymentdescriptor"); // It returns a string containing the contents of the WLS specific deployment // descriptor. This is the XML file contents as a string. 2-5

Chapter 2 WebLogic Server Extensions 2-6