A WebLogic domain maintains a domain configuration file, called config.xml, along with security settings, domain and transaction logs, and startup scripts for the Administration Server and Managed Servers on the different machines. WebLogic eases the creation of all of these by providing a tool, the Configuration Wizard, which you can run as part of WebLogic Server installation or after installation. The Configuration Wizard presents a series of templates that you can use to create or extend domains. You can use the tool to create a domain with either a standalone Administration Server, a domain with multiple Managed Servers, or a domain with multiple clustered Managed Servers. In addition, the tool lets you create domains that are preconfigured with example applications.
13.3.1 Directory Layout
All settings for a domain are stored within the domain's root directory. Under the root directory, you will find the configuration file config.xml, startup scripts for Windows and Unix platforms, and subdirectories for the domain-level logs, the security data, and the applications themselves. The root directory always will contain at least the following files:
When WebLogic Server runs in development mode (see Chapter 12 for details), an application poller looks at the applications folder under the domain, picks up any updates to a deployed application, and automatically redeploys the application. So, even though an application can be hosted from anywhere in the filesystem, you should place it under the applications folder if you want to take advantage of automatic redeployment.
The root directory can be placed anywhere on your filesystem, so long as the scripts and applications have access to the WebLogic Server installation and the JDK. You can configure a server to use a particular directory as its root directory by passing in the weblogic.RootDirectory command-line argument. Here is an example:
java -Dweblogic.RootDirectory=/shared/myRoot weblogic.Server
If this argument is not supplied, WebLogic examines the directory from which it was started for a config.xml file. If it finds this file, it assumes that this directory is the root directory. The root directory information also needs to be supplied to the Node Managers using the Remote Start tab. If it is not supplied, each Node Manager will create its own root directory (in BEA_HOMEWL_HOMEcommon odemanager) for each server, as explained later.
Each WebLogic server has a root directory. This does not stop you from sharing a root directory among a number of servers. For example, you may have a shared disk system. In this case, you can configure a number of server instances, possibly on different physical machines, each sharing the same root directory. No conflict will arise, though you must take extra care to ensure that the shared directory remains available at all times.
13.3.2 The Configuration Wizard
The Configuration Wizard is a standalone Java tool that you can use to easily create WebLogic domains from a set of prepared templates. The templates let you choose between creating a domain for the Avitek Medical Records application, a domain for the WebLogic examples, a WebLogic domain with no preconfigured applications, and a domain for WebLogic Workshop. You then can create a domain with either a standalone Administration Server or multiple (clustered) Managed Servers. After creating the domain, you can use the Administration Console later to further modify its configuration as per your needs.
 This is available only in WebLogic 8.1. In WebLogic 7.0, you can choose the PetStore template for a sample domain.
We will focus on the "Basic WebLogic Server Domain" a domain with no preconfigured applications. The same discussion holds for the other options as well, except they create WebLogic domains with a default set of applications.
18.104.22.168 Starting the Configuration Wizard
The Configuration Wizard can be found in the WL_HOME/common/bin/ directory. In WebLogic 8.1, run the config script; in WebLogic 7.0, run the dmwiz script. Depending on your operating system, you also may find a shortcut to this script placed in your launch bar. By default, the Wizard starts up in a GUI mode to start a text-based version of the Wizard, run it in Console Mode by supplying a mode argument:
The Configuration Wizard automatically starts up in Console Mode if your platform doesn't support a graphical display environment.
22.214.171.124 Typical configurations
When creating a basic domain, the most important configuration options are those that determine the structure of the domain:
In all cases, you at least must have configured the Administration Server. Let's examine each option in more detail.
126.96.36.199 Single server
A single-server domain consists of a standalone Administration Server only. This configuration is ideal for development or testing environments when you need to be able to rapidly deploy applications to the domain. While you can deploy applications to the Administration Server, this approach should not be used for production environments. Once you have created the domain, you still can use the Administration Console to adjust the configuration. For instance, you could add one or more Managed Servers, and perhaps organize them in WebLogic clusters.
After selecting this option, you must supply the location of the root directory for the domain. The domain can reside anywhere on your filesystem so long as the WebLogic installation and JDK are accessible to it. After this, you will be prompted for a name for the server, a listen address, a listen port, and an SSL listen port. Finally, you must supply a system username and password needed for the various administration tasks.
188.8.131.52 Domain with Managed Servers
You also can use the Configuration Wizard to create a WebLogic domain with multiple Managed Servers under the control of an Administration Server. In this case, you must supply the name, address, and port details of the Administration Server, and of each Managed Server in the domain.
184.108.40.206 Domain with clustered Managed Servers
The Configuration Wizard can be used to create a domain that has Managed Servers in a cluster. The means that you must supply a name for the cluster, the multicast address, and a selection of which Managed Servers will belong to the cluster. You can learn more about these configuration settings in Chapter 14.
By exploring the Clusters node in the left pane of the Administration Console, you will find an entry for the newly created cluster, along with all of the Managed Servers that are members of the cluster.
220.127.116.11 Using the Configuration Wizard in WebLogic 8.1
The simplest way to create a single-server domain using the Configuration Wizard is to choose the Basic WebLogic Server Domain option, followed by the Express setup. Supply the username and password of the administrative user, choose a location for the domain on your filesystem, and hit Create. The domain will consist of just the Administration Server called myserver, and by default it will bind to all IP addresses on port 7001.
If you choose the Custom setup, you can configure just about every aspect of a domain, right from Managed Servers and clusters up to JDBC and JMS resources. After choosing the Custom setup, your first task will be to define the settings for the Administration Server: the IP address and listen port, the server name, and an SSL port if SSL is enabled.
The rest of the setup is fairly intuitive, and the GUI comes with instructions on how to configure the various domain resources. For example, the Configuration Wizard lets you modify how the domain is distributed across servers, clusters, and physical machines. You can create a number of Managed Servers and clusters, as well as add managed servers to these clusters. You also can create machines and assign WebLogic instances to these machines.
In addition, the Configuration Wizard lets you create any JDBC connection pools and data sources; configure JMS servers, destinations, and connection factories; and set up security. You don't have to perform all of these aspects of your domain from the Configuration Wizard. If you like, you can use the Administration Console later. Finally, you must supply the username and password of an administrative user. Remember these details, as you will need them to access the Administration Console.
The Configuration Wizard is a powerful tool that also supports the creation of custom templates. For example, you can create a standard template for a WebLogic domain that can be used consistently to establish the base configuration for a new domain. Refer to the WebLogic documentation for more information on how to use the template builder.
18.104.22.168 Using the Configuration Wizard in WebLogic 7.0
After starting the Configuration Wizard, choose from the available templates to create a domain. We recommend you select the WLS Domain template because it defines a new domain with no preconfigured applications. You then can choose between Single Server, Admin Server with Managed Servers, and Admin Server with Clustered Managed Servers to create the three types of domains discussed earlier. Note that the Configuration Wizard lets you create only a single cluster, and all managed servers will become members of that cluster automatically. After creating the Managed Servers (if any), you must supply the name and address of the Administration Server, and then the username and password of the administrative user. You will need these details in order to log in to the Administration Console.
13.3.3 Using weblogic.Server
An easy way to create a very basic domain is to use the weblogic.Server command, which is normally used to start a server. You first need to add the relevant libraries to your classpath, which you accomplish by executing the setWLSEnv script located in the WL_HOMEserverin directory. You then need to execute the following command in a clean directory:
java -Dserver.name=myservername weblogic.Server
We have used the server.name property to assign a name to the Administration Server. You then will be prompted for a username and password, and you will be asked whether you wish to create a new domain. This creates a fully functional basic domain, just as if you had used the Configuration Wizard to create a single-server domain. The Administration Server will be bound to all IP addresses, on port 7001.
13.3.4 Starting the Servers
Once you have created a domain, you then can run the Administration Server. Execute the startWeblogic script from the domain's root directory. Once the server has started, you can access the Administration Console using the URL http://hostname:port/console. Here hostname and port must be the listen address and port configured using the Configuration Wizard.
Under the Servers node in the left pane of the Administration Console, you will find entries for each Managed Server created for the domain. You can start each Managed Server from the command line using the startManagedWebLogic script created for your domain. The startup script takes two parameters: the name of the Managed Server to start, and the URL for the Administration Server. A typical invocation looks like this:
startManagedWebLogic servername http://adminaddress:adminport/
Here servername is the name of one of the Managed Servers in the domain, and adminaddress and adminport represent the address and port for the Administration Server. You must execute several such commands, one for each Managed Server in the domain. Later, we will see how you can start a Managed Server remotely from the Administration Console, after setting up a Node Manager on the machine hosting the Managed Server.
Managing the Web Server
Using JNDI and RMI
Using CMP and EJB QL
Packaging and Deployment
Performance, Monitoring, and Tuning
Logging and Internationalization