was85_09lab_helloworld

41

Upload: mayamerto

Post on 16-Jan-2016

12 views

Category:

Documents


0 download

DESCRIPTION

WAS85 HelloWorld

TRANSCRIPT

Page 1: WAS85_09Lab_HelloWorld
Page 2: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

Lab 1: Installing WebSphere V8.5 Liberty Profile

In this lab, you are going to install the Liberty Profile in a disconnected mode, meaning the resources have already been downloaded from the internet and are available locally on the virtual image that has been provided. And, then use you will work with the Liberty profile server in Eclipse to do some simple application development. The Liberty Profile is a lightweight, composable application server runtime that is small to download, easy to install and configure, and very fast to start. Both the Liberty Profile and the Eclipse adapter to use this profile in your development environment are available at no charge for a single user to unit test your applications on the desktop. You can use this environment to develop applications against the lightweight Liberty Profile and then transfer your environment to a production Network Deployment server with full fidelity.

This lab uses a desktop virtual image, and the following components have been previously downloaded from the internet and are available on the virtual image:

__1. Eclipse 3.7.2 - Installed

__2. WebSphere Tools Plug-in for eclipse

__3. Liberty Profile server

The Eclipse Java EE IDE for Web Developers version 3.7.2 (Indigo) platform has been pre-installed on the virtual image. However, it is available as a free download on WASDev at the following URL: http://wasdev.net

The IBM JDK 1.6 has been pre-installed on the virtual image, and is set as the default JRE for the development environment.

Page 2 [Asset Title. Change font to black]

Page 3: WAS85_09Lab_HelloWorld

IBM Software

Windows NOTE:

You may be prompted with a Windows security alert when launching the Liberty Server and deploying an application the server. Just select Unblock, and continue with the lab instructions.

In this exercise, you will:

• Install the WebSphere Application Server V8.5 Liberty Profile in a disconnected mode

Contents Page 3

Page 4: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

• Install the WebSphere tools plug-in for Eclipse in a disconnected mode

• Configure Eclipse to work with your Liberty Profile server

• Use the Eclipse workbench to modify your Liberty Profile server configuration

• Use the Eclipse workbench to publish and modify an existing application

• Customize the Liberty Server JVM Options

• Be introduced to the Liberty Server Bootstrap properties file

• Be introduced to the Liberty Server environment configuration file

To run this lab, your workstation must meet the following requirements:

• Approximately 8GB of storage available for the Windows XP virtual image

• Approximately 1.5 GB of memory free to run the developer workbench and the server

• The lab files for this lab must be unzipped on your workstation; the instructions will refer to the location of the sample files using the <LAB_FILES> variable.

• Connectivity to the internet is NOT required

1.1 Configuring your development environment (Disconnected Scenario)

The Liberty Profile, Eclipse, and the WebSphere Developer Tools to support the Liberty Profile in Eclipse are all available as no-charge downloads for development and evaluation without IBM support. This means that you can set up an end-to-end development environment at no cost!

1.1.1 Install the Liberty Profile in a disconnected mode

1) To install the liberty profile, open a Windows command prompt and go to the directory that contains the wlp-8500.jar file.cd C:\WORKSHOP\Binaries\WAS85\WLP

2) Run the following command to install the Liberty profile into C:\IBM\LibertyProfile directory:java -jar wlp-8500.jar --acceptLicense "C:\IBM\LibertyProfile"

3) You will be left with a folder called C:\IBM\LibertyProfile\wlp

Page 4 [Asset Title. Change font to black]

Page 5: WAS85_09Lab_HelloWorld

IBM Software

4) That’s it! The Liberty Profile is installed and ready to use!

TIP: Alternatively, the Liberty package can be downloaded and installed from the internet. The basic steps are illustrated in Appendix A.

5) Explore the content of <LIBERTY_ROOT>. Open a file system browser or terminal session and go look at the content of the C:\IBM\LibertyProfile\wlp folder.

6) Use a text editor to open the README.TXT file. It explains how to install and start the server, and contains information about how to configure the server, install applications, and so forth. You can close the text file, or keep it open as a reference.

7) A default server is NOT included in the Liberty package. In this step, you will create a new default server.

8) Open a Windows command prompt. Change to the C:\IBM\LibertyProfile\wlp\bin directory. This directory contains the ‘server’ command that can be used to create, stop, and start the Liberty server. It can also be used to dump the configuration to aid in customer support.

9) Enter and execute the following command to create a new server named defaultServer. server create defaultServer

Contents Page 5

Page 6: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

10) Using the Windows Explorer, Look under C:\IBM\LibertyProfile\wlp\usr\servers\defaultServer. The folder name defaultServer indicated the server name. Initially, the server contains a server.xml file with the JSP feature enabled, and defaultt HTTP(S) endpoints configured. You can open server.xml file in a text editor and view it:

11) In this exercise, you will not be modifying the server configuration files directly – rather, you will set up your server configuration in the next sections, using Eclipse.

12) Notice that the server.xml file has the featureManager section with the jsp-2.2 feature enabled on this server. To see which feature options are available for the Liberty Profile, open the C:\IBM\LibertyProfile\wlp\lib\features folder and look through the list of .mf files. These files represent all of the features that you can enable in your Liberty Profile server.

13) In terms of feature names, the string you need to include in the server.xml file to enable a feature corresponds to the name portion of the feature’s .mf file. Consider the file jsp-2.2.mf. Remove the file extension (.mf), and you are left with jsp-2.2. The string jsp-2.2 represents the feature name you would use in your server.xml configuration, as you can see in the sample server.xml file above.

14)

Start the server.

1) Open a command prompt or terminal session and navigate to C:\IBM\LibertyProfile\wlp\bin

2) Use the run option to start your server so that you can see the timestamp messages; you will not specify a server name, so the default server will be used.server.bat runThe server will start very quickly. You should have noticed that the server started in just a few seconds.

Page 6 [Asset Title. Change font to black]

Page 7: WAS85_09Lab_HelloWorld

IBM Software

3) You will not be doing anything with the server now, so type CTRL+C in your command prompt to kill the server process.

4) When prompted to terminate the batch job, type Yes.

1.1.2 Launch the Eclipse Indigo Development Environment

Launch the Eclipse Indigo for Java EE Developers (3.72) that has already been installed in the virtual machine.

The Eclipse Indigo development environment is available as a free download, as a compressed archive file, from http://wasdev.net. The compressed archive is approximately 215 MB.

1) sing the Windows Explorer, navigate to the eclipse directory, C:\eclipse.

2) Inside of C:\eclipse, locate the eclipse.exe file and open it (for example, by double-clicking it in your file browser).

3) When the Eclipse launcher prompts you to Select a workspace, ensure the workspace is set to C:\workspace\LibertyProfile. And then click OK. Your Eclipse IDE will open to the Welcome page. Click the Workbench icon in the upper right to continue to your workbench and begin using Eclipse.

Contents Page 7

Page 8: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

TIP: As mentioned before, the Eclipse Indigo for Java EE Developers (3.7.2) can be downloaded from the internet. The basic steps are illustrated in Appendix B.

1.1.3 Configure your Liberty server in Eclipse in a disconnected mode

1) You should have WebSphere Liberty Profile developer tools plug-in for Eclipse installed previously from another lab. If you have not installed it, please follow the steps in the previous lab.Configure a Liberty server instance in Eclipse.

2) At the bottom of the IDE workbench, select the Servers tab, then right-click in the server list area and choose New > Server from the context menu.

3) In the Define a New Server dialog, expand the IBM folder, and select WebSphere Application Server V8.5 Liberty Profile. Keep the default host and server names, and click Next.

Page 8 [Asset Title. Change font to black]

Page 9: WAS85_09Lab_HelloWorld

IBM Software

4) In the WebSphere Runtime Environment dialog, click Browse… to open the file system browser. Navigate to C:\IBM\LibertyProfile\wlp and click OK.

Contents Page 9

Page 10: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

TIP: The virtual image has the IBM JDK 6 installed, and we will use that for the Liberty server. Liberty can also run with the IBM JDK 7 and the Oracle Hotspot JDK 6 or 7.

Notice that, if you do not have the Liberty profile installed yet, you can easily download and install it using the links on this panel. Click Next to continue.

5) In the WebSphere Server dialog, notice that the WebSphere server field is set to your defaultServer instance.

6) For this exercise, create a new instance for your development environment by clicking the New… button.

Page 10 [Asset Title. Change font to black]

Page 11: WAS85_09Lab_HelloWorld

IBM Software

7) In the new server panel, locate the Server name field and type labServer. You will be using this server to run a simple servlet sample application. Click Finish.

Contents Page 11

Page 12: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

8) You will notice that the server contains the jsp-2.2 feature enabled and a default HTTP Endpoint definition. In the New Server dialog, click Finish.

9) Now your server is defined!

__g. Start the server.

__h. From the Servers view, select your labServer instance and click the Start the server button ( ). Alternatively, you can also right-click the server name and choose the Start option from the context menu.

Page 12 [Asset Title. Change font to black]

Page 13: WAS85_09Lab_HelloWorld

IBM Software

1) You may notice and error message below. This will appear if one of the servers used in a previous lab is still running. We could either shut down that server, or we can change the port numbers this server is doing. We will show you how to change the ports

__a. In the Servers view, double-click on your labServer server to open the configuration editor (or right-click and select Open from the context menu).

__b. On the Overview page, locate the Liberty Profile Settings section, and click the Open server configuration link to open the server.xml editor.

Contents Page 13

Page 14: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

__c. On the Server Configuration page, we can change the Port values, by selecting the HTTP Endpooint, and changing the Port and Secure port to available port values. In our case the next available port values arePort: 9083Secure Port: 9446

__d. Save your changes and try to start the Server again!

__e. Switch to the Console view. Look at the messages to see how fast your server starts!

2) Now lets change some more configurations. In the Servers view, double-click on your labServer server to open the configuration editor.

Page 14 [Asset Title. Change font to black]

Page 15: WAS85_09Lab_HelloWorld

IBM Software

3) First, expand the Publishing section and notice that the server is set to automatically detect and publish changes. Keep this default setting.

4) In this exercise, you will be deploying a simple servlet application, so try enabling the servlet feature on this server. On the Overview page, locate the Liberty Profile Settings section, and click the Open server configuration link to open the server.xml editor.

5) Start by providing a meaningful description for your server. In the Configuration Structure area, highlight the Server Configuration item in the list. In the Configuration Details area on the right, delete the default description for your server and provide something more meaningful, such as Liberty server for labs.

6) To add a feature, such as servlet-3.0, go back in the Configuration Structure area, and determine if the Feature Manager has already been added to the configuration.

__a. The Feature Manager will already exist in the configuration if the Liberty Server configuration already has features defined, such as jsp-2.2.

__b. Review the Feature Manager settings. In this lab, the Feature Manager has already been added to the configuration profile because of the jsp-2.2 feature having been included in the labServer you created earlier by default.

Contents Page 15

Page 16: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

7) To add an additional feature (servlet-3.0), select Feature Manager located under the Configuration Structure area.

8) Highlight Feature Manager in the Server Configuration list. On the right side, in the Feature Manager Details area, click the Add button. Then, use the menu to select the servlet-3.0 feature. Click OK

Page 16 [Asset Title. Change font to black]

Page 17: WAS85_09Lab_HelloWorld

IBM Software

9) In the server.xml editor, switch to the Source tab at the bottom to see the XML source for this configuration file. You will see that a new featureManager element has been added, and that it contains the servlet-3.0 feature.

10) Now you have a server that is configured to use the servlet-3.0 feature. Click the Save button ( ) to save your changes (or use CTRL+S).

11) Switch to the Console panel at the bottom of the workbench and review the latest messages. These messages are showing that your Liberty server automatically detected the configuration update, processed the feature that you enabled, and is now listening for incoming requests.

__a. You will notice that the server configuration was automatically updated and the feature update was completed very quickly. In this example, it was one second.

Contents Page 17

Page 18: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

12) Now you are ready to start working with a sample application that uses the Servlet or JSP features.

Page 18 [Asset Title. Change font to black]

Page 19: WAS85_09Lab_HelloWorld

IBM Software

1.2 Deploying a sample application to the Liberty Profile

1.2.1 Import a sample application into Eclipse

A simple servlet WAR file has been provided for this exercise; import it into your workbench.

1) In Eclipse, go to File > Import. Expand the Web section, then select WAR file. Click Next.

2) In the WAR file field, select Browse. Navigate to C:\WORKSHOP\Applications\LibertyProfile\Sample1.war and click Open.

Contents Page 19

Page 20: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

3) Set the Target runtime to WebSphere Application Server V8.5 Liberty Profile. Click Finish

4) Now, you have a Sample1 web project in your workspace. You can expand it in the Enterprise Explorer view to see the different components of the project.

Page 20 [Asset Title. Change font to black]

Page 21: WAS85_09Lab_HelloWorld

IBM Software

5) Start the sample application. In the Enterprise Explorer pane, navigate to the SimpleServlet.java as shown below. Sample1 -> Java resources -> src -> wasdev.sample -> SimpleServlet.java

6) Right-click on SimpleServlet.java.

7) From the context menu, select Run As > Run on Server.

Contents Page 21

Page 22: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

8) In the Run On Server dialog, verify that Choose an existing server is chosen.

9) Under localhost, select the WebSphere Application Server V8.5 Liberty Profile server that you defined earlier. The server should be listed in Started state.

10) Click Finish.

Page 22 [Asset Title. Change font to black]

Page 23: WAS85_09Lab_HelloWorld

IBM Software

11) After a moment, your application will be installed and started. See the Console pane for the corresponding messages.

12) In the main panel of the workbench, a browser also opened, pointing to http://localhost:9083/Sample1/SimpleServlet.

13) If you receive a 404 the first time, try to refresh the browser once the application is completely deployed and started. At this point, you should see the rendered HTML content generated by the simple servlet.

1.2.2 Modify the application

1) Open the servlet source.

__a. In the Enterprise Explorer panel, expand the Sample1 project, then go to Sample1 > Servlets. Double-click the wasdev.sample.SimpleServlet entry to open the Java editor for the servlet.

Contents Page 23

Page 24: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

Page 24 [Asset Title. Change font to black]

Page 25: WAS85_09Lab_HelloWorld

IBM Software

__b. This is how the SimpleServlet.java source looks in the editor:

__c. This is a very simple servlet with a doGet() method that sends out an HTML snippet string as a response. Your doGet() method will look similar to this (some of the HTML tags might be a little different – that is ok).

2) Modify the application and publish the change.

__a. In the doGet() method, Locate the <h1> heading element of the HTML string, and notice that it contains a font tag to set the color to green. Modify this string by changing the text green to purple, so your font tag will look read <font color=purple>.

response.getWriter().print("<h1><font color=purple>Simple Servlet ran successfully</font></h1>"+ "Powered by WebSphere Application Server V8.5 Liberty Profile");

__b. Save your changes to the Java source file by either clicking the Save button ( ) or using CTRL+S.

__c. Recall that your server configuration is setup to automatically detect and publish application changes immediately. By saving the changes to your Java source file, you automatically triggered an application update on the server.

Contents Page 25

Page 26: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

__d. To see this, go to the Console view at the bottom of the workbench. The application update started almost immediately after you saved the change to the application, and the update completed in seconds.

3) Access the updated application.

__a. Refresh the browser in your workbench to see the application change. The title should now be rendered in purple text.

__b. Optionally continue to play around with application modifications and see how quickly those changes are available in the deployed application. Maybe put in some additional text to display on the page, or add extra HTML tags to see formatting changes (you could add a title tag to set the text displayed in the browser title bar, for example, <head><title>Liberty Profile</title></head>).

__c. The key is that this edit / publish / debug cycle is very simple and fast!

Page 26 [Asset Title. Change font to black]

Page 27: WAS85_09Lab_HelloWorld

IBM Software

1.2.3 Investigate and Modify the server configurations

__1. Open the server configuration editor.

__a. In the Servers view, double-click on the labServer server to open the configuration Overview page (or right-click the labServer server and choose Open).

__b. In the Liberty Profile Settings section, select the Open server configuration link to open the server.xml editor.

__c. Ensure you are in the Design mode by selecting the Design tab on the Server Configuration editor.

Contents Page 27

Page 28: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

__d. Under the Server Configuration section, Click on Application: Sample1 and look at the Application Details. From here, you can set basic application parameters, including the context root for the application.

__e. Select the Application Monitoring item in the Server Configuration and look at its configuration details. You can see that the monitor polls for changes every 500ms using an mbean trigger.

Page 28 [Asset Title. Change font to black]

Page 29: WAS85_09Lab_HelloWorld

IBM Software

__f. Select the Feature Manager item to see the features that are configured on your server. You added the servlet-3.0 feature because you knew that you were going to be running a servlet application. But the development tools automatically added the localConnector-1.0 feature to your server to support notifications and application updates. In fact, you would not have needed to add the servlet feature to your server at the beginning at all – the tools would have automatically enabled that feature, based on the content of the application.

Contents Page 29

Page 30: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

1.2.4 Add INFO logging output to the Console

By default, the Liberty profile Server has the console log level set to AUDIT. In this section, you will change the level of log messages written to the console from AUDIT to INFO.

You will perform this activity in the server.xml file using the UI. It is also possible to set default logging options in the bootstrap.properties file. If the logging options are set in the bootstrap.properties file, the logging options will take effect for ALL servers that are defined.

1) Open the server configuration editor.

__a. In the Servers view, double-click on the labServer server to open the configuration Overview page (or right-click the labServer server and choose Open).

__b. In the Liberty Profile Settings section, select the Open server configuration link to open the server.xml editor.

__c. Ensure you are in the Design mode by selecting the Design tab on the Server Configuration editor.

2) Add the Logging configuration option to the server

Page 30 [Asset Title. Change font to black]

Page 31: WAS85_09Lab_HelloWorld

IBM Software

__a. Under the Configuration Structure section, Click on Server Configuration. And, then click the Add button.

__b. On the Add Item dialog, select Logging, And, then click the OK button.

Contents Page 31

Page 32: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

__c. The logging page displays the properties for the logging configuration, such as the name of the log files, the maximum size of log files, and the maximum number of log files to retain. Additional configuration information is displayed regarding tracing. Notice that the Console Log Level is set to AUDIT by default.

__d. Change the Console log level to INFO using the pull down menu.

__e. Switch to the Source view for the server.xml file to see the configuration changes added to server.xml. <logging consoleLogLevel="INFO"/>

__f. Save the configuration file.

__g. Stop and restart the server. The changes you made are dynamic and take effect immediately. However, running the SimpleServlet does not produce INFO messages because the Servlet has already been initialized in the environment. When you restart the server, you will immediately see INFO messages in the console.

Page 32 [Asset Title. Change font to black]

Page 33: WAS85_09Lab_HelloWorld

IBM Software

1.2.5 Update Trace Specification

By default, the Liberty profile Server trace specification is set to *=info=enabled. This is the same for Traditional WAS.

Updating the trace specification for debugging is easily performed using the server configuration editor. You can specify the trace specification in the UI, or copy / paste the trace specification directly into the server.xml file. In this section, you will specify a trace specification using the configuration editor. And, then, you will look at the result in the server.xml source file

1) Open the server configuration editor, if it is not already opened.

2) Update the Trace Specification under the logging configuration.

__a. Click on Logging under the Server Configuration section. This displays the logging and trace details.

Contents Page 33

Page 34: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

__b. Update the Trace Specification field with the following trace string:

webcontainer=all=enabled:*=info=enabled

__c. Switch to the Source tab on the configuration editor and view the logging configuration. :

<logging traceSpecification="webcontainer=all=enabled:*=info=enabled"/>

__d. Save the configuration changes.

3) Run the SimpleServlet to produce trace messages.

__a. Navigate to SimpleServlet.java

__b. Using the menus, run the SimpleServlet on the Liberty Server. Right click on Java Resources/src/wasdev.sample/SimplerServlet.java, select Run As >> Run On Server

4) Verify that the trace.log file contains trace data.

__a. From a Windows Explorer, navigate to the server logs directory.C:\IBM\LibertyProfile\wlp\usr\servers\labServer\logsThe trace.log file has been created and contains content.

__b. You can view the trace.log file using Notepad.

Note: To open the trace.log file using Wordpad, you must first stop the Liberty server.

5) Very important: reset the trace specification back to the default value.

__a. Switch to the Source tab on the configuration editor and update the logging configuration to:

logging consoleLogLevel="INFO" traceSpecification="*=info=enabled "/>

__b. Save the configuration.

1.3 Customizing the Liberty JVM Options

The generic JVM arguments are used to configure and adjust how the JVM executes.

Page 34 [Asset Title. Change font to black]

Page 35: WAS85_09Lab_HelloWorld

IBM Software

The WebSphere Application Server Liberty profile is pre-configured with minimal settings defined. The following steps will direct you how to define custom generic JVM arguments such as heap settings for a Liberty server.

1) Create a text file named jvm.options in the ${server.config.dir} directory.

TIP: On the virtual image for this lab, the ${server.config.dir} is “C:\IBM\LibertyProfile\wlp\usr\servers\labServer”

The built in environment variables in the Liberty profile are discussed I the next section of this lab.

__a. Open the Enterprise Explorer view in eclipse

__b. Navigate to WebSphere Application Server V8.5 Liberty profile Servers labServer.

__c. Right mouse click on the labServer folder. And, then select New File from the context menu.

__d. Create new file named jvm.options in the labServer folder

Contents Page 35

Page 36: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

2) Insert your generic JVM options, one per line, into the jvm.options file.

__a. Double click to open the file in the eclipse text editor

__b. Enter the following two lines in the jvm.options file to set the minimum and maximum heap size for eth labServer server. The following options will set the min / max JVM heap size to 25 MB and 500 MB respectively. -Xms25m

-Xmx500m

TIP:

• The default minimum and maximum heap size values of the JVM heap size is:

–Xms4m and –Xmx488m

• Verbose garbage collection can be enabled by specifying -verbose:gc in the jvm.options file.

• Verbose garbage collection output will be logged to the following location by default:

<wlp.install.directory>/usr/servers/<serverName>/logs/console.log

TIP: Depending on your preferences, you might configure a single JVM or all Liberty JVMs with your options file.

To apply these settings to a single server, save jvm.options at:

${server.config.dir}/jvm.options

TIP: On the virtual image for this lab, the ${server.config.dir} is“C:\IBM\LibertyProfile\wlp\usr\servers\labServer”

__c. To apply these settings to all Liberty Servers, save jvm.options at:${wlp.install.dir}/etc/jvm.options

Page 36 [Asset Title. Change font to black]

Page 37: WAS85_09Lab_HelloWorld

IBM Software

TIP: On the virtual image for this lab, the ${wlp.install.dir} is “C:\IBM\LibertyProfile\wlp\”

The changes will take effect for all JVMs that do not have a locally defined jvm.options file.

3) Restart the server to enable changes.

This concludes the customization portion of the lab. In the next sections, you will be introduced to the Liberty configuration files for customizing the server initialization and environment settings.

1.4 Introducing the Liberty Environment Variable configuration

You can customize the Liberty profile environment using certain specific variables to support the placement of product binaries and shared resources.

The Liberty environment variables are specified using server.env file.

You can use server.env file at the installation and server levels to specify environment variables such as JAVA_HOME, WLP_USER_DIR and WLP_OUTPUT_DIR.

NOTE: You will not modify the default environment configuration in this lab.

Review the information in this section to become familiar with the environment variables that are available for customizing the Liberty environment.

The following Liberty profile specific variables can be used to customize the Liberty profile environment:

• ${wlp.install.dir}

This configuration variable has an inferred location. The installation directory is always set to the parent of the directory containing the launch script or the parent of the /lib directory containing the target jar files.

TIP: On the virtual image for this lab, the ${wlp.install.dir} is “C:\IBM\LibertyProfile\wlp”

• WLP_USER_DIR

This environment variable can be used to specify an alternate location for ${wlp.install.dir}. This variable can only be an absolute path. If this is specified, the runtime environment looks for shared resources and server definition in the specified directory.

The ${server.config.dir} is equivalent to ${wlp.user.dir}/servers/serverName.

Contents Page 37

Page 38: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

TIP: On the virtual image for this lab, the ${server.config.dir} is “C:\IBM\LibertyProfile\wlp\usr\servers\labServer”

• WLP_OUTPUT_DIR

This environment variable can be used to specify an alternate location for server generated output such as logs, the workarea directory and generated files. This variable can only be an absolute path.

If this environment variable is specified, ${server.output.dir} is set to the equivalent of WLP_OUTPUT_DIR/serverName. If not, the ${server.output.dir} is the same as ${server.config.dir} .

TIP: On the virtual image for this lab, the ${server.output.dir} is “C:\IBM\LibertyProfile\wlp\usr\servers\labServer”, which is the same as ${server.config.dir}.

1.5 Introducing the Liberty Bootstrap Properties

In this section of the lab, you will gain an understanding of how and when bootstrap properties are required during environment initialization.

NOTE: You will not modify any of the default environment initialization. This information is provided in the lab for your reference.

Bootstrap properties are used to initialize the runtime environment for a particular server. Generally, they are attributes that affect the configuration and initialization of the runtime.

Bootstrap properties are set in a text file named bootstrap.properties. This file should be located in the server directory alongside the configuration root file server.xml.

By default, the server directory is usr/servers/server_name.

The bootstrap.properties file contains two types of properties: • A small, predefined set of initialization properties.• Any custom properties you choose to define which you can then use as variables in other

configuration files (that is, server.xml and included files).

You can edit the bootstrap.properties file using a text editor, or using the editor that is part of the Liberty profile developer tools.

Changes to the bootstrap.properties file are applied when the server is restarted.

TIP:

As an example, the logging service can be controlled through the server configuration (server.xml) file. Occasionally you need to set logging properties so they can take effect before the server configuration files are processed;

Page 38 [Asset Title. Change font to black]

Page 39: WAS85_09Lab_HelloWorld

IBM Software

In this case you set them in the bootstrap.properties file instead of the server configuration.

You do not usually need to do this to get logging from your own code, which is loaded after server configuration processing, but you might need to do this to analyze problems in early server start or configuration processing.

This completes the lab exercise.

1.6 Summary

In this exercise, you:

• Installed the WebSphere Application Server V8.5 Liberty Profile

• Installed the Liberty Profile tools plug-in

• Configured a Liberty Profile server in your Eclipse environment and modified the server configuration

• Deployed a sample application and experienced the rapid edit / deploy cycle that is supported by this environment

• Added additional server features

• Modified the HTTP Endpoint configuration

• Customized the JVM options for the lab server to setup the min / max heap sizes for the lab server.

• Familiarized yourself with the environment initialization, (bootstrap.properties) file.

• Familiarized yourself with the environment configuration options, (server.env) file for the Liberty profile.

1.7 Appendix A: Downloading the Liberty Profile from WasDev

Contents Page 39

Page 40: WAS85_09Lab_HelloWorld

WebSphere Version to Version Migration Workshop

The Liberty package can be downloaded and installed from the internet. For your reference, the basic steps are illustrated below.

This is for your reference only. Do not download the resources from the internet in this lab.

__a. Open a web browser and go to http://wasdev.net

__b. Go to the Download tab.

__c. In the main area at the top of the page, locate the Just want the Liberty Profile section, and click the button to download the Liberty Profile (the text here, shown below).

Page 40 [Asset Title. Change font to black]

Page 41: WAS85_09Lab_HelloWorld

IBM Software

1.8 Appendix B: Downloading Eclipse from WasDev

As mentioned before, the Eclipse Indigo for Java EE Developers (3.7.2) can be downloaded from the internet using these simple steps.

This is for your reference only. Do not download the resources from the internet in this lab.

In your browser, go back to http://wasdev.net and go to the Download section.

From the main download area at the top of the page, locate Step 1, to download and install Eclipse. Click the link Eclipse Indigo for Java EE Developers (3.7.2). This will re-direct you to the Eclipse download page.

__a.

The Eclipse package is approximately 200MB in size, and may take several minutes to download.

Contents Page 41