wlshell provides a connector to access to Local JMX Agents, i.e. JMX Agents running on the same JVM as wlshell. It supports JMX 1.2. Some implementations of this specification are J2SE 5.0 and MX4J.
The protocol in the URL to use the Local JMX Connector is "local".
The Local JMX Connector is used to connect to the JMX Agent running on the same JVM as wlshell. This is the case when using the TELNET Protocol Adaptor and a TELNET client. See configuration #3 in the Architecture section.
wlshell needs to be configured to use a JMX 1.2 implementation, by configuring the files "wlsh(.cmd/.sh)" and "env4jmx(.cmd/.sh)" (see installation).
Example:
wlsh [not connected]> connect local://
The following screenshot shows the explorer displaying the MBeans created by J2SE 5.0 on the local MBeanServer:
Objects implemented as MBeans can be registered with the Local JMX Agent (MBean Server) using the mkdir command. The syntax of the mkdir command is:
md <directory> [ <name> ]
The following example illustrates how to register a new MBean. The class used in the example ("Utils") is included in the wlshell distribution.
md mydomain:/Utils wlshell.serverside.jmx.Utils
The object name can be specified in two different ways:
When using the active path key list, the object name for the registration is derived from the provided directory and the active path key list. Directories can be relative to the current directory or fully-qualified (with and without the domain name). For more information see The File System Metaphor and the keys command. Here are some valid examples:
md /Utils/util wlshell.serverside.jmx.Utils md mydomain:/mytype/myname com.acme.mbeans.Sample cd /mydir md sample com.acme.mbeans.Sample
Alternatively, new MBeans can be registered by providing a list of property-values, similarly to JMX MBeans object names. In that case, the list of property-values must be specified under the special "all" directory. The actual object name is created by using the domain and the property-values list, not taking into account the active path key list.
wlshell notation: [domainName]:/all/property=value[,property=value]* JMX object name equivalent: [domainName]:property=value[,property=value]*
New directories can be specified with this notation using either relative or fully-qualified names. Here are some valid examples:
md "wlshell:/all/type=Utils,name=util" wlshell.serverside.jmx.Utils mydomain: md "/all/type=mytype,name=myname" com.acme.mbeans.Sample mydomain: cd /all md "type=sample" com.acme.mbeans.Sample
The JMX technology is included with Sun's J2SE 5.0 as documented here.
The Local JMX Agent can be enabled by starting the JVM with the following property:
-Dcom.sun.management.jmxremote
More information can be found in the following articles:
Once the Local JMX Agent is configured, the following URL can be used with the wlshell connect command:
connect local://
wlshell should be started using J2SE 5.0 and the JMX environment. See the installation section for more information.
In the following example, we will start wlshell with the Local JMX Agent enabled and connect to the Local JMX Agent. The example is for the Windows platform.
In a command window, start wlshell and connect to the Local JMX Agent. wlshell is configured to use Sun J2SE 5.0 JMX and to start the Local JMX Agent (file "env4jmx.cmd"):
file "env4jmx.cmd": @set PROPS=-Dcom.sun.management.jmxremote command window: set WLSHELL_HOME=c:\wlshell-2.1.0 cd %WLSHELL_HOME%\bin wlsh wlsh [not connected]> connect local:// connecting to MBeanServer(s) as weblogic...done type "info" for connection information wlsh JMImplementation:/> domains [JMImplementation, java.lang, java.util.logging] wlsh JMImplementation:/> explore