Thursday, January 29, 2015

WLST: Understanding WebLogic Server MBean Tree


The JMX specification does not impose a model for organizing MBeans. However, because the configuration of a WebLogic Server domain is specified in an XML document, WebLogic Server organizes its MBeans into a hierarchical model that reflects the XML document structure.[1]

With WLST, you can navigate the hierarchy in a filesystem-like structure with subdirectories representing parent-child relationships. There are also "soft-links" with the ability to use the cd command to jump to other positions in the tree (very similar to what can be done on UNIX using the ln -s command).

In this article, we will cover different MBeen trees implemented in the WebLogic Server 12c.

Configuration vs. Runtime


There are two main kinds of MBeans in WLS:
  • Configuration
    • Used to configure WLS
    • To navigate to a configuration MBean from the runtime hierarchy, enter the serverConfig or domainConfig () command.
    • To edit configuration beans, you must be connected to an Administration Server, and you must navigate to the edit tree (see below) and start an edit session, as described in edit and startEdit, respectively.[7]
  • Runtime
    • Used to monitor WLS and for some operation control—starting and stopping servers, shrinking data source connection pools.
    • The root of the runtime MBeans is ServerRuntimeMBean
    • When connected to 
      • Administration Server
        • You access the runtime MBean hierarchy by entering the serverRuntime() or the domainRuntime() command
      • Managed Server
        • You access the runtime MBean hierarchy by entering the serverRuntime() command

MBean Tree


WLS provides the following bean trees:
  • edit
    • Only available on the admin server, used to modify the configurationconfig.xml and system resource files.
    • In the configuration hierarchy, the root directory is DomainMBean; the MBean type is a subdirectory under the root directory; each instance of the MBean type is a subdirectory under the MBean type directory; and MBean attributes and operations are nodes (like files) under the MBean instance directory. 
  • runtime
    • Available on every server, used to view the configuration that server is using, and to access its monitoring data
  • domain runtime
    • Only available on the admin server, shadows the runtime beans of all of the running servers, provides single point of access for monitoring

Tree Commands


WLST provides simplified access to MBeans. While JMX APIs require you to use JMX object names to interrogate MBeans, WLST enables you to navigate a hierarchy of MBeans in a similar fashion to navigating a hierarchy of files in a file system.  Tree commands in WLST can be used to access to all the bean trees within a domain, 
  • edit
    • You can update an existing WebLogic domain in two modes:[6]
      • Offline mode[3]
      • Online mode[4]
    • When you connect to admin server, WLST first connects to a WebLogic Server instance at the root of the server's configuration MBeans, a single hierarchy whose root is DomainMBean. WLST commands provide access to all the WebLogic Server MBean hierarchies within a WebLogic domain, such as a server's run-time MBeans, run-time MBeans for domain-wide services, and an editable copy of all the configuration MBeans in the domain. For more information, see "Tree Commands"[8]
  • runtime
    • When connected to either an admin server or a managed server, you can access the run-time MBean hierarchy by entering the serverRuntime() command
      • The serverRuntime() command places WLST at the root of the server run-time management objects, ServerRuntimeMBean.
  • domain runtime
    • When connected to an admin server,  you can access the domain run-time MBean hierarchy by entering domainRuntime() command.
      • The domainRuntime() command places WLST at the root of the domain-wide run-time management objects, DomainRuntimeMBean.

References

  1. WebLogic Server MBean Data Model
  2. Navigating and Interrogating MBeans
  3. Using WLST Offline to Update an Existing WebLogic Domain
  4. Using WLST Online to Update an Existing WebLogic Domain
  5. Editing Commands Reference
  6. WLST: Offline and Online Modes (Xml and More)
  7. Configuration MBean Hierarchy
  8. WebLogic Scripting Tool Command Reference

Sunday, January 25, 2015

Java Evolution: JDK and JRE File Structure

"JDK and JRE File Structure" describes the most important files and directories required to develop applications for the Java platform. In [1], it states that there will be new changes in coming Java 9 such as:
  • JRE and JDK images now have identical structures.
    • Previously a JDK image embedded the JRE in a jre subdirectory; now a JDK image is simply a run-time image that happens to contain the full set of development tools and other items historically found in the JDK.
  • The internal files rt.jar, tools.jar, and dt.jar have been removed.
  • The extension mechanism has been removed.
  • The endorsed-standards override mechanism has been removed.

In this article, we will take one step back to see how "JDK and JRE File Structure" has evolved from Java 6 to 8. Note that the file structure of the JRE is identical to that of the JDK's jre directory.

Java 6


Assuming the JDK software is installed at /jdk1.6.0, here are some of the most important directories:[2]


               jdk1.6.0
        ___________|____________________ ________________________
       |           |                    |                        |
      bin         lib                  jre                     include     
       |           |          __________|_____________________
   java.exe    tools.jar     |                                |        
   javac.exe   dt.jar       bin                              lib                
   javap.exe            _____|____ __________         ________|_______ ________ ________        
   javah.exe           |          |          |       |        |       |        |        |
   javadoc.exe     java.exe    client      server  rt.jar    ext  security  applet    fonts
                   java.dll       |          |   charsets.jar |                  
                   awt.dll     jvm.dll    jvm.dll        localedata.jar      

Java 7


As part of the Java 7 release, the Java Development Kit (JDK) now includes the SDK for developing JavaFX applications and, more importantly, the JavaFX Runtime is now installed with the JRE.[3] In addition, there is new db sub-folder under the root directory of JDK software installation.

Assuming the JDK software is installed at /jdk1.7.0, here are some of the most important directories:[4]


               jdk1.7.0
        ___________|____________________ __________________________ _______
       |           |                    |                          |       |

      bin         lib                  jre                      include    db
       |           |          __________|________________________
   java.exe  ant-javafx.jar  |                                   |        
   javac.exe   dt.jar       bin                                 lib                
   javap.exe tools.jar  _____|____ __________          __________|_______ ________ ________        
   javah.exe           |          |          |        |          |       |        |        |
   javadoc.exe     java.exe    client      server   rt.jar      ext  security  applet    fonts
                   java.dll       |          |    charsets.jar   |                  
                   awt.dll     jvm.dll    jvm.dll   jfxrt.jar  localedata.jar      

Java 8


In Java 8, jfxrt.jar has become one of the optional packages (what used to be known as standard extensions).[6] So, it has been moved into /lib/ext.

Assuming the JDK software is installed at /jdk1.8.0, here are some of the most important directories:


               jdk1.8.0
        ___________|____________________ __________________________ _______
       |           |                    |                          |       |

      bin         lib                  jre                      include    db
       |           |          __________|________________________
   java.exe  ant-javafx.jar  |                                   |        
   javac.exe   dt.jar       bin                                 lib                
   javap.exe tools.jar  _____|____ __________          __________|_______ ________ ________        
   javah.exe           |          |          |        |          |       |        |        |
   javadoc.exe     java.exe    client      server   rt.jar      ext  security  applet    fonts
                   java.dll       |          |    charsets.jar   |                  
                   awt.dll     jvm.dll    jvm.dll              localedata.jar    
                                                               jfxrt.jar

Directory Summary


Directory
Contains
Setup
<jdk1.x.0>/bin
Executables for all the development tools contained in the JDK.
The PATH environment variable should contain an entry for this directory.
<jdk1.x.0>/lib Files used by the development tools.
<jdk1.x.0>/jre Root directory of the Java Runtime Environment (JRE) used by the JDK development tools. This is the directory referred to by the java.home system property.
<jdk1.x.0>/jre/bin Executable files for tools and libraries used by the Java platform.
The executable files are identical to files in /jdk1.x.0/bin.

This directory does not need to be in the PATH environment variable.
<jdk1.x.0>/jre/lib Code libraries, property settings, and resource files used by the JRE.
<jdk1.x.0>/jre/lib/ext Default installation directory for extensions to the Java platform.
See The Extension Mechanism
<jdk1.x.0>/jre/lib/security Contains files used for security management. These include the security policy java.policy and security properties java.security files.
<jdk1.x.0>/jre/lib/amd64 Contains the .so (shared object) files used by the architecture amd64 release of the Java platform

<jdk1.x.0>/jre/lib/amd64/server Contains the .so file used by the Java HotSpot VM server.
<jdk1.x.0>/jre/lib/applet JAR files that contain support classes for applets can be placed in the lib/applet/ directory.
This reduces startup time for large applets by allowing applet classes to be preloaded from the local file system by the applet class loader and provides the same protections as though they had been downloaded over the Internet.

<jdk1.x.0>/jre/lib/fonts Font files used by the platform.


References

  1. Project Jigsaw: Modular run-time images
  2. JDK and JRE File Structure (Java 6, Linux version)
  3. Java 7 Now Includes JavaFX
  4. JDK and JRE File Structure (Java 7, Linux version)
  5. JDK and JRE File Structure (Java 8, Linux version)
  6. Extension Mechanism Architecture
  7. WebLogic's Classloading Framework (Xml and More)
  8. java.lang.UnsatisfiedLinkError: Setting Environment Variable (Xml and More)