Sun ONE logo      Previous      Contents      Index      Next     

Sun ONE Application Server 7 Getting Started Guide

Chapter 9
Exploring the Server Further

Now that you have gained familiarity with basic application deployment, redeployment and reloading capabilities of the application server, you can learn how to carry out common administrative tasks by performing the following brief exercises.


Changing the HTTP Listener Port Number

When you need to change the HTTP listener port number to avoid conflicts with other servers, you can easily do so via the administrative console:

  1. Access the administrative console.
  2. Expand the HTTP Server and HTTP Listeners folders under the application server instance.
  3. Click the listener named http-listener-1.
  4. Change the port number to another value.
  5. Click Save.
  6. Select the instance node named server1.
  7. Click Apply Changes. (No server restart is required).
  8. Using a browser, access the HTTP server on the newly specified port.


Adding a New HTTP Listener

Although the application server is initially configured with a single HTTP listener, it is straightforward to add another listener. In the following exercise you will create a new non-SSL HTTP listener.

To add a new HTTP listener, perform the following steps:

  1. Access the administrative console.
  2. Expand HTTP Server
  3. Click HTTP Listeners.
  4. Click New.
  5. Enter the information as listed in the following table:
  6. Name

    new-listener

    IP Address

    0.0.0.0 (listens on any interface)

    Port

    select a suitable port

    Return Server Name

    any valid host/interface name for the machine

  7. Click OK.
  8. Select the instance node server1.
  9. Click Apply Changes.
  10. Restart the server instance.
  11. Using a browser, access the HTTP server on both port numbers.
  12. During server restart, notice the following messages in the server instance event log:

    INFO: HTTP3072: HTTP listener http-listener-1 [http://kampfire:88] ready to accept requests

    INFO: HTTP3072: HTTP listener new-listener [http://kampfire:89] ready to accept requests


Adding a Virtual Server

In operational environments, it is common to configure a single HTTP server to host content and web applications for multiple domains. For example, the domains www.abc.com and www.xyz.com can be easily served by separate virtual servers defined on the same HTTP server. The web traffic served by a virtual server can be distinguished either by the interface or port number over which HTTP traffic is received or by the domain name on the incoming HTTP requests.

In this exercise you will use a newly defined HTTP listener to route traffic to a new virtual server.

  1. Access the administrative console.
  2. Expand HTTP Server
  3. Following the steps above, create a new HTTP Listener that will be associated with the new virtual server.
  4. Click Virtual Servers
  5. Click New.
  6. Enter the information as shown in the following table:
  7. ID

    new-virtual-server

    Hosts

    host name expected in the incoming URL (not important in this example because a unique port is being associated with this virtual server).

    MIME Types File

    mime1

    HTTP Listeners

    select the appropriate HTTP listener(s)

    Access Log

    domain_config_dir/domain1/server1/logs/access_log_file_name

  8. Click OK
  9. Select the instance node named server1.
  10. Click Apply Changes.
  11. Restart the server instance.
  12. Using a browser, access the HTTP listener port associated with the new virtual server.


Adding a Server Instance

If you are a developer and need to define a separate “sandbox” in which to experiment with either application server configurations, you may need to define a new application server instance. For example, if you need to upgrade to a new Java 2 SDK (JDK) version and would like to experiment with the newer JDK in one environment yet maintain your stable configuration, it might make sense for you to define a new application server instance.

To add a server instance, perform the following steps:

  1. Access the administrative console.
  2. Select Application Server Instances.
  3. Click New.
  4. Enter a server instance name (for example, my-new-server) and a port number for the initial HTTP Listener.
  5. Click OK
  6. Select the new server instance in the list of instances.
  7. Click Apply Changes.
  8. Click Start.
  9. Using a browser, access the HTTP listener port associated with the new server instance.
  10. Navigate to the domain1 directory of your installation:
  11. domain_config_dir/domain1/

    Note the presence of a new directory representing your newly created instance.

    In the administrative console, under Application Server Instances, note the presence of a new server instance node. Explore this new node to see the default settings associated with the newly created application server instance.


Creating an Administrative Domain

  1. From the command line, execute the following command to create a new administrative domain named mydomain:
  2. asadmin create-domain --adminport 9999 --adminuser admin --adminpassword password mydomain

    where the port number, user and password fields specify the initial settings of the new administrative server defined for the domain.

    Upon execution of this command, you should see the following message:

    Created Domain mydomain successfully

    At this stage, you should see a newly defined directory:

    domain_config_dir/mydomain/

    If domain1 has already been used, execute the create-domain subcommand again with another domain name. You can use periods and other characters in your domain names. You could use your login user name as a qualifier to help ensure that your domain name is unique. For example: ckamps.domain1.

  3. Execute the list-domains subcommand to display a list of all of the domains configured for the application server installation.
  4. For example:

    asadmin list-domains

    domain1 [domain_config_dir/mydomain]

    where the value of domain_config_dir represents either the default location for newly created administrative domains or the value specified on the --path option of the create-domain subcommand.


    Tip

    Overriding the Location of the Administrative Domain Configuration: To override the default location of the newly created administrative domains, use the --path option of the create-domain subcommand. Since the administrative domain configuration will be written to this area, you must have write permissions to the specified location.

    asadmin create-domain --path domain_config_dir --adminport 4848 --adminuser admin --adminpassword password mydomain

    In this example, a new directory named mydomain will be created under the specified domain_config_dir.


  5. Now start the new domain by executing the following command:
  6. asadmin start-domain --domain mydomain

    This command simply starts the administrative server of the newly created domain.

  7. Once the administrative server of the new domain has started, you should be able to start the administrative console of the admin server by using a browser to access the following URL:
  8. http://localhost:9999

  9. After you authenticate to the administrative server, use the administrative console to create a new application server instance and then access its HTTP port via a web browser.
  10. To stop the domain, you can execute the following command:

    asadmin stop-domain --domain mydomain

    Once you have completed these exercises, proceed to the final section Chapter 10, "Summary and Next Steps".



Previous      Contents      Index      Next     


Copyright 2003 Sun Microsystems, Inc. All rights reserved.