Configuring Domains and Servers

Tutorial 1: Creating a WebLogic Domain and Server Instance for Development

In this tutorial you use the WebLogic Server Configuration Wizard to create a domain and server necessary to deploy and run the MedRec applications.The tutorial also shows you how to start the server.

The Configuration Wizard asks for information about the domain you want to create based on the configuration template you select, and then creates a config.xml file for the domain based on your responses. The Configuration Wizard also creates startup scripts for the server instances in the domain, and other helper files and directories to help you start and use the new domain and its servers. You will work with these scripts and directories in later tutorials.

The tutorial includes the following sections:

- Prerequisites
- Procedure
- Best Practices
- The Big Picture
- Related Reading

Prerequisites

Before starting this tutorial:

- Make sure WebLogic Server 8.1 and the server samples are installed on your computer.
- Read Overview of the Avitek Medical Records Development Tutorials.

Procedure

To create the MedRec domain and the WebLogic Server instance to which you will deploy MedRec, follow these steps. You will use the domain and server in later tutorials.

- Step 1: Create the MedRec domain and MedRec server.
- Step 2: Edit the server startup script.
- Step 3: Start the MedRec server.

Step 1: Create the MedRec domain and MedRec server.

The MedRec domain includes one server that will host the MedRec back-end services, the MedRec Administration application, and the Patient application (both applications are Web applications). As you create the domain and server, click Next at the end of each step to continue to the next step in the procedure.

1. Launch the Configuration Wizard:

   Start—>Programs—>BEA WebLogic Platform 8.1—>Configuration Wizard

2. In the Create or Extend a Configuration window, select Create a new WebLogic configuration.

3. In the Select a Configuration Template window, select Basic WebLogic Server Domain.

   You select the Basic WebLogic Server Domain template instead of the Avitek Medical Records Sample Domain template because this tutorial is designed to show you how to create an application from the very beginning. The Avitek Medical Records Sample Domain template includes configuration settings for the sample domain which would enable you to skip some configuration steps.

4. In the Choose Express or Custom Configuration window, select Custom.

5. In the Configure the Administration Server window, enter or select:

   - MedRecServer for Name.

   - 127.0.0.1 for Listen Address.

   - 7101 for Listen Port. If necessary, enter a different value to avoid network communication conflicts with other server instances, such as the Examples server. The port must be dedicated TCP/IP port for the Administration Server. The port number can be any integer from 1 to 65535.

   - The SSL Enabled check box.

   - 7102 for SSL Listen Port. If necessary, enter a different value to avoid network communication conflicts with other server instances, such as the Examples server. The port must be dedicated TCP/IP port and cannot be the same as the Server Listen Port. The port number can be any integer from 1 to 65535.

6. In the following windows, select No:

   - Managed Servers, Clusters, and Machines Options

   - Database (JDBC) Options

   - Messaging (JMS) Options

7. In the Configure Administrative Username and Password window, enter or select:

   - weblogic for Name

   - weblogic for Password

   - No for Configure additional users, groups, and global roles

   You use this username and password when you boot the server and log in to the Administration Console.

   Note: In a production environment the user name and password should not be the same.

8. In the Configure Windows Options window, select:

   - Yes for Create Start Menu

   - No for Install Administrative Server as Service

9. In the Build Start Menu Entries window, accept the defaults.

10. In the Configure Server Start Mode and Java SDK window, select:

    - Development Mode for WebLogic Configuration Startup Mode

    - Sun SDK 1.4.1_XX for Java SDK Selection

    The Sun SDK is the default choice for Development mode. You can select either the Sun SDK or the JRockit SDK. The Sun SDK offers faster startup times, where as the JRockit SDK offers faster runtime performance on Intel architectures.

11. In the Create WebLogic Configuration window:

    1. Enter MedRecDomain as the Configuration Name.

    2. Click Create to create the MedRec domain in the folder displayed in Configuration Location. When the Configuration Wizard finishes creating the domain, the WebLogic Configuration Created Successfully message is displayed.

    3. Click Exit or Done to close the Configuration Wizard.

Step 2: Edit the server startup script.

The MedRec application suite uses log4j for logging application messages. You must copy the log4j properties file from the pre-configured MedRec domain and identify it using a startup option in MedRecServer startup script. For Web Services, you must also identify the .wsdl and the incoming directory for XML files. To complete these steps:

1. Copy the log4j properties file from the pre-configured MedRec domain to the new domain you just created. For example, in a command-line shell, enter:

   >     copy c:\bea\weblogic81\samples\domains\medrec\log4j.properties
   >     c:\bea\user_projects\domains\MedRecDomain

2. Open the startWebLogic.cmd script for your new domain in a text editor. For example:

   >     notepad
   >     c:\bea\user_projects\domains\MedRecDomain\startWebLogic.cmd

3. Find the following line in the startWebLogic.cmd script:

   >     set JAVA_VENDOR=Sun

4. Add the following line immediately after the "set JAVA_VENDOR" line:

   >     Set JAVA_OPTIONS=-Dlog4j.config=log4j.properties
   >     -Dcom.bea.medrec.xml.incoming=incoming
   >     -Dphys.app.wsdl.url=http://127.0.0.1:7101/ws_medrec/MedRecWebSe
   >     rvices?WSDL

5. Save the file and exit your text editor.

Step 3: Start the MedRec server.

From the Start menu:

Start—>Programs—>BEA—>WebLogic Platform 8.1—>User Projects—>MedRecDomain—>Start Server

From a script:

1. In a command-line shell, go to the root directory of the MedRec domain, typically c:\bea\user_projects\domains\MedRecDomain. For example, from the c:\ prompt, enter:

   >     cd bea\user_projects\domains\MedRecDomain

2. Invoke the startWebLogic.cmd script to start the MedRec server:

   Windows: startWebLogic.cmd

   UNIX: startWeblogic.sh

Best Practices

- Use the Configuration Wizard to create and configure domains. The Configuration Wizard creates the necessary configuration file (config.xml), directory structure, and startup scripts for each new domain.
- Create domain directories outside the WebLogic Server program files. It is best not to mix application files with the application server files. By default, the Configuration Wizard creates domain directories in bea_home\user_projects\domains directory, typically c:\bea\user_projects\domains, which is parallel to the directory in which WebLogic Server program files are stored, typically c:\bea\weblogic81.

The Big Picture

This tutorial is the basis for setting up your development environment. Before you can deploy applications to a server, you must first configure the domains and servers to which you want to deploy the applications. In this tutorial, you created the MedRec domain, which includes one server to host the MedRec applications. You use this domain for most tutorials.

Related Reading

- Creating Domains and Servers Using the Configuration Wizard in Configuring and Managing WebLogic Server
- Starting and Stopping Servers: Quick Reference in Configuring and Managing WebLogic Server
- Starting Administration Servers in the Administration Console Online Help