Sun ONE Application Server 7 Getting Started Guide |
Chapter 9
Exploring the Server FurtherNow 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 NumberWhen you need to change the HTTP listener port number to avoid conflicts with other servers, you can easily do so via the administrative console:
- Access the administrative console.
- Expand the HTTP Server and HTTP Listeners folders under the application server instance.
- Click the listener named http-listener-1.
- Change the port number to another value.
- Click Save.
- Select the instance node named server1.
- Click Apply Changes. (No server restart is required).
- Using a browser, access the HTTP server on the newly specified port.
Adding a New HTTP ListenerAlthough 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:
- Access the administrative console.
- Expand HTTP Server
- Click HTTP Listeners.
- Click New.
- Enter the information as listed in the following table:
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
- Click OK.
- Select the instance node server1.
- Click Apply Changes.
- Restart the server instance.
- Using a browser, access the HTTP server on both port numbers.
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 ServerIn 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.
- Access the administrative console.
- Expand HTTP Server
- Following the steps above, create a new HTTP Listener that will be associated with the new virtual server.
- Click Virtual Servers
- Click New.
- Enter the information as shown in the following table:
- Click OK
- Select the instance node named server1.
- Click Apply Changes.
- Restart the server instance.
- Using a browser, access the HTTP listener port associated with the new virtual server.
Adding a Server InstanceIf 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:
- Access the administrative console.
- Select Application Server Instances.
- Click New.
- Enter a server instance name (for example, my-new-server) and a port number for the initial HTTP Listener.
- Click OK
- Select the new server instance in the list of instances.
- Click Apply Changes.
- Click Start.
- Using a browser, access the HTTP listener port associated with the new server instance.
- Navigate to the domain1 directory of your installation:
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
If you are using the application server that was installed as part of a Solaris 9 bundled installation, you already used the asadmin CLI to create a new administrative domain. If this is the case, proceed to the final section, Chapter 10, "Summary and Next Steps".
For all other situations, use the following instructions to create a new domain named mydomain, start the domain and access the administrative server that manages this domain.
Since domain creation and deletion is available only through the asadmin CLI, you must use the command line to create the new domain.
- From the command line, execute the following command to create a new administrative domain named mydomain:
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.
- Execute the list-domains subcommand to display a list of all of the domains configured for the application server installation.
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.
- Now start the new domain by executing the following command:
asadmin start-domain --domain mydomain
This command simply starts the administrative server of the newly created domain.
- 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:
http://localhost:9999
- 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.
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".