As we’ve already seen, all WebLogic instances and their resources exist within the context of an organizational unit called a WebLogic domain. Within the domain, you can set up multiple servers, customize their network configurations, and deploy multiple J2EE applications and any required resources. You may even set up WebLogic clusters using a subset of the servers in the domain. All servers in the cluster can then work together to provide support for failover and load balancing.
One server in the domain is vital to its existence: the Administration Server that manages the configuration for the entire domain. This includes the configuration of all servers within the domain, and all applications and services deployed to these servers. Other servers in the domain, called Managed Servers, host the actual J2EE applications and resources such as JDBC connection pools, data sources, JMS connection factories, topics and queues, RMI objects, and so on. The Administration Server merely manages the entire configuration of these servers. In a single-server domain, you have little choice but to deploy your applications to the Administration Server itself. However, in a production environment, we recommend you deploy your applications to a separate server.
WebLogic is fairly flexible about how you configure the servers in the domain. So long as all Managed Servers in the domain can reach the Administration Server over the same network, WebLogic doesn’t care whether the servers in the domain run on the same machine or on their own hardware.
Let’s now quickly look at how to create a single-server WebLogic domain so that you can start the Administration Server. Once you’re able to access the domain’s configuration using the Administration Console, you know that you have a working WebLogic domain. This should be a good starting point for you to start building J2EE applications for WebLogic, and trying out any examples that you encounter as you read this book. Chapter 13 shows you how to expand on this configuration to build more complex domains.
In order to set up a running WebLogic instance that you can work with, you need to first create a WebLogic domain. When you’ve successfully done so, you can deploy your J2EE applications to the Administration Server itself. Later on, as you become more comfortable with WebLogic Server, you can add more servers to the domain and move your applications to the Managed Servers.
For WebLogic 8.1, start up the Domain Configuration Wizard by selecting the program from your operating system’s Start menu. Select the Basic WebLogic Server Domain option from the list, and choose the express setup route. You then need to supply the username and password for the system administrator. Remember these details, as you won’t be able to start or access the Administration Console successfully without them. After selecting from the installed SDKs to use, provide a name for the domain and a location on the filesystem where you want to store the domain. Finally, choose Create. The domain set up in this manner will automatically bind to all available IP addresses and listen on port 7001.
For WebLogic 7.0, start up the Domain Configuration Wizard by running the dmwiz script located under the WL-HOME/common/bin folder, or by selecting the program from your operating system’s Start menu. Select the WLS Domain option from the list, supply a name for the new domain, and then choose the Single Server (Standalone Server) option. Then you need to supply the full path of the directory under which all domain-related files are stored. After this, you need to configure the standalone server. For this, you need to specify the server’s name, IP address or hostname, and the listen port on which the server is available. If you do not specify an address for the standalone Administration Server, the server automatically binds to all available IP addresses. Finally, you need to supply the username and password for the system administrator. Ensure that the single server doesn’t run as an OS service.
In order to run the standalone server, you need to navigate to the domain’s root directory, locate the startweblogic shell script for your OS, and run it. The server won’t start unless you also supply the username and password of the administrator configured earlier during the creation of the domain. Ensure that you’ve installed the proper WebLogic licenses or else the server aborts its boot sequence. You’ll know that the server has successfully completed its startup sequence when you see the following in the console log window:
<20-Apr-03 23:26:57 BST> <Notice> <WebLogicServer> <000365> <Server state changed to RUNNING> <20-Apr-03 23:26:57 BST> <Notice> <WebLogicServer> <000360> <Server started in RUNNING mode>
The Domain Configuration Wizard lets you install domains already populated with applications. The “examples” domain is very useful, as it contains code and examples for most aspects of WebLogic.
Under the domain’s root directory, you’ll find the config.xml file that captures the entire configuration of the domain. Any changes made to the domain’s configuration are persisted to the config.xml file. The domain log file domain-name.log also lives under the domain’s root folder. Log files for the Administration Server are placed under the domain-name/server-name folder.
Once you’ve successfully started the domain’s Administration Server, you can use the Administration Console to configure, manage, and monitor the domain and all its resources. Now if you’ve bound the Administration Server to the IP address 10.0.10.10, for instance, and set its listen port to 7001, you can invoke the Administration Console through your web browser by navigating to http://10.0.10.10:7001/console/. Here again, you need to supply the administrator’s login credentials (username/password) in order to view the domain’s configuration.
Once the user’s credentials have been successfully authenticated, you can access all areas of the Administration Console. On the left pane, you’ll notice a graphical tree menu that lets you navigate to the different resources located in a WebLogic domain. Ensure that you have installed a Java plug-in for the browser, or else the menu applet will not render successfully.
Figure 1-2 illustrates the navigation menu for the Administration Console. We recommend that you familiarize yourself with these menu options. The rest of the book frequently will refer to the left pane of the Administration Console because it provides the primary means for manipulating the domain’s configuration. For instance, you’ll often come across the instruction “Select the desired server instance from the left pane of the Administration Console.” Assuming that you’ve configured the server myserver within a WebLogic domain mydomain, this means that you need to navigate to the mydomain/Servers/myserver node of the tree menu in the left pane. Then, clicking the myserver node from the left pane automatically displays the server’s configuration settings in the right frame of your browser window.
Similarly, by clicking any WebLogic resource from the left pane, you can view and modify the associated configuration settings in the right pane of the Administration Console. Moreover, WebLogic maintains runtime statistics for each deployed resource, which you can view through the Monitoring tab in the right pane.
The graphical tree menu also lets you perform specific operations on a resource by right-clicking the particular tree node. For instance, you can view the server’s JNDI tree by right-clicking the myserver node in the left pane, and then choosing the “View JNDI tree” option from the pop-up menu.
Now that you’ve set up your domain and understand the essentials of using the Administration Console to view the domain’s configuration and monitor the various domain resources, you are ready to proceed on a journey into the world of WebLogic Server.