BEA WebLogic Server

wlshell provides a connector to access BEA WebLogic Server versions 6.1, 7.0, 8.1, 9.2 and 10.

The protocols in the URL to use the connector for WebLogic are: "t3", "t3s", "http", "https" and "service:jmx:t3" (WLS version 9.2 and 10)

The connector for WebLogic is used to connect to WebLogic Servers, and can be used in any of the three configurations described in the Architecture section.

wlshell needs to be configured to use the WebLogic libraries, by configuring the files "wlsh(.cmd/.sh)" and "env4wls(.cmd/.sh)" (see installation).

Example:

wlsh [not connected]> connect t3://localhost:7001 weblogic weblogic

The following sections provide version specific information:

WebLogic version 9 and 10

WebLogic Server versions 9 and 10 have a number of changes in the JMX implementation.

WebLogic includes JMX 1.2 implementation from JDK 1.5. The JMX remote API 1.0 can be used to connect to JMX agents defined in WebLogic Server.

The MBeans in the Domain Administration Server are now organized in three MBean servers: Edit, Domain Runtime and Runtime. A Managed Server has only one Runtime MBean server.

Detailed information can be found here:

Connecting to All MBean Servers

When using the URL "t3://host:port", wlshell will try to connect to all MBean servers defined in that WebLogic server instance. If the instance is an administration server, then it will connect to the Edit, Domain Runtime and Runtime MBean servers. If the instance is a managed server, then it will connect only to the Runtime MBean server.

When wlshell connects to several MBean servers, it uses a "prefix" to diferentiate between JMX domains defined in each MBean server. It prepends "edit.", "domain." and "runtime." to the names of the JMX domains defined in Edit, Domain and Runtime MBean servers respectively.

In the following example, there is a connection to an administration server with three MBean servers. Each MBean server has three JMX domains:

  • JMImplementation
  • Security
  • com.bea

Each JMX domain can be referenced using the corresponding prefix. For instance, to shutdown the admin server, use the following command:

  invoke runtime.com.bea:/ServerRuntime/AdminServer/forceShutdown

Connecting to a Specific MBean Server

In addition to the method explained in the previous section, wlshel can be used to connect to a specific MBean server, using a JMX remote API URL.

The Runtime MBean server can be found at the Administration and Managed servers, with the following URL:

service:jmx:t3://host:port/jndi/weblogic.management.mbeanservers.runtime

The Edit MBean server can be found at the Administration server only, with the following URL:

service:jmx:t3://host:port/jndi/weblogic.management.mbeanservers.edit

The Domain Runtime MBean server can be found at the Administration server only, with the following URL:

service:jmx:t3://host:port/jndi/weblogic.management.mbeanservers.domainruntime

When connecting to a single MBean server, wlshell doesn't prepend any prefix to the name of the JMX domains in that server. The following example, shows the explorer connected to the Domain Runtime MBean server with the following connect command:

connect service:jmx:t3://localhost:7091/jndi/weblogic.management.mbeanservers.domainruntime

Changing the Domain Configuration

WebLogic versions 9 and 10 have a new procedure to change the domain configuration:

  1. create an edit session
  2. make changes in the Edit MBean Server (create MBeans, change MBean attributes, etc...)
  3. save and activate changes made during the edit session

See also Managing a Domain's Configuration with JMX.

Examples:

#Some convenient definitions
configMan = edit.com.bea:/weblogic.management.mbeanservers.edit.ConfigurationManagerMBean/ConfigurationManager
start     = $configMan/startEdit
save      = $configMan/save
activate  = $configMan/activate
validate  = $configMan/validate
cancel    = $configMan/cancelEdit

keys Type Name

run $start 60000 120000

#Change Domain configuration
edit.com.bea:
cd /Domain/myDomain
run createServer myNewServer
set /Server/myNewServer/ListenPort 7003

#Save and activate
run $save

run $activate 120000

Creating and Destroying WebLogic MBeans in Versions 9 and 10

WebLogic MBeans representing Domain resources (server, services, etc...) can only be created and destroyed through operations of each resource's parent.

See also mkdir, rmdir and Scripts

Examples:

#Start an edit session
run $start 60000 120000

#Create a new managed server
cd /Domain/myDomain
name = run createServer myNewServer

#Create a new JMS server and target it to a server
run createJMSServer myJMSServer

run /JMSServer/myJMSServer/addTarget $name

#Remove target
cd /JMSServer/myJMSServer
targets = get Targets
run removeTarget $targets[0]

#Alternatively
run removeTarget $name

#Destroy managed server
cd /Domain/myDomain

name = run lookupServer myNewServer
run destroyServer $name

#Save and activate changes.
run $save
run $activate 120000
edit.com.bea:
cd /Domain/myDomain    
sr = run createJDBCSystemResource myDataSource    

Creating General JMX MBeans

Note: General JMX MBeans are also known as Standard JMX MBeans or Custom MBeans.

General JMX MBeans can be created and registered in WebLogic 9 and 10 using the mkdir (md) wlshell command. The fully-qualified Java class name of the MBean to register has to be added at the end. Here is an example:

md runtime.wlshell:/etc/utils wlshell.serverside.jmx.Utils

In the example, the MBean is registered on the "runtime" MBean Server with the Object Name shown below. The active path key list is [Type, Name].

wlshell:Type=etc,Name=utils

When connecting to all MBean servers, the name of the MBean server must be specified ("runtime" in the example). This is required in order to select the server where the MBean will be created, from the three available servers. It is not required when connecting to a specific MBean server.

General MBeans cannot be registered in a domain used by WebLogic MBeans, i.e.: "JMImplementation", "Security" and "com.bea".

The Java class of the MBean being registered must be in the system classpath of the WebLogic Server. It doesn't need to be in the classpath of wlshell.

The Object Name of the MBean is generated using the active path key list. The list can be changed using the keys command.

General MBeans can be also created under the special "all " notation to provide an arbitrary Object Name. In that case, the active path key list is ignored. Here is an example:

md "runtime.mydomain:/all/application=myapp,id=counters" com.acme.myapp.Counters

Here is another example connecting to a specific MBean server (runtime).

wlsh [not connected]> connect service:jmx:t3://localhost:7091/jndi/weblogic.management.mbeanservers.runtime
connecting to MBeanServer(s) as weblogic...done

setting recommended path keys [Type, Name]...done

type "info" for connection information

wlsh JMImplementation:/> mkdir wlshell:/etc/utils wlshell.serverside.jmx.Utils
creating wlshell:/etc/utils...done
wlshell:/etc/utils

WebLogic versions 6, 7 and 8

General Considerations

The path key list for these versions of WebLogic is [Type, Name] and cannot be changed.

Creating and Destroying WebLogic MBeans

In WebLogic 6.1, 7.0 and 8.1, the first level directories represent MBean types and the second level represent MBeans. When creating a first level directory (e.g. /JMSQueue), wlshell creates an MBean type, necessary to create MBeans of that type. When creating a second level directory (e.g. /JMSQueue/myQueue), an MBean is created on the server. The name of the MBean is the name provided in the command and its type is the name of the parent directory.

On WebLogic, the creation of an MBean of a particular type causes the creation of a resource of that type in the domain. In the example, the creation of the /JMSQueue/myQueue directory implies the creation of a JMS Queue with name 'myQueue'.

When creating a second level directory (an MBean), wlshell takes care of the creation of the first level one (the MBean type) if it doesn't previously exist (see example).

See also mkdir and rmdir.

Examples:

md /JMSQueue/myQueue

#which is equivalent to:
md /JMSQueue
md /JMSQueue/myQueue
#... if /JMSQueue doesn't previously exist

Creating and Destroying General JMX MBeans

Note: General JMX MBeans are also known as Standard JMX MBeans or Custom MBeans.

General JMX MBeans can be created and registered in WebLogic 6.1, 7.0 and 8.1 using wlshell. The command is the same as with WebLogic MBeans (mkdir), adding the fully-qualified Java class name of the MBean to register at the end. Here is an example:

mydomain:
md /etc/utils wlshell.serverside.jmx.Utils

JMX MBean registered:
mydomain:Type=etc,Name=utils

The Java class of the MBean being registered must be in the system classpath of the WebLogic Server. It doesn't need to be in the classpath of wlshell.

Since the path key list for these versions of WebLogic is [Type, Name] and cannot be changed, the new MBean will be created with those two keys.

New general JMX MBeans must be created under existing domains.