Question & Answer
Question
How do you create, start, and install Applications into a Liberty server?
Answer
The following will outline the steps required to create, start, and install Applications into a Liberty server.
Variables
1) Open a command prompt via Qshell. Then, change the directory to <wlp.install.dir>/ bin/.
Example:
STRQSH
cd /QIBM/ProdData/WebSphere/LibertyServer/Express/bin/
2) Run the following command to create a new Liberty application server.
If you do not specify a server name, the name "defaultServer" will be used.
<code>server create server_name</code>
where server_name is the name of the Liberty application server you want to create.
Example:
server create libertyServer
Server libertyServer created.
CPC221C: 2 objects successfully changed.
CPC221C: 411 objects successfully changed.
$
3) Modify the server.xml file to customize the HTTP and HTTPS port to your preference.
By default, the server directory is /QIBM/UserData/WebSphere/LibertyServer/Express/wlp/usr/servers/<serverName>
.
You can change the server directory as described
Example:
/QIBM/UserData/WebSphere/LibertyServer/Express/wlp/usr/servers/libertyServer/server.xml
Locate the following:
<httpEndpoint id="defaultHttpEndpoint"
host="localhost"
httpPort="9080"
httpsPort="9443" />
The httpPort and httpsPort values can be customized to fix the user's needs.
Deploy an Application
1) Create a directory apps for application deployment under the newly created server directory. The directory should be like /QIBM/UserData/WebSphere/LibertyServer/Express/wlp/usr/servers/libertyServer/apps
2) Copy the application into the apps directory created.
3) Configure the application by updating the server.xml as follows:
Example using helloworld.war:
<server description="Hello World Server">
<featureManager>
<feature>servlet-3.0</feature>
</featureManager>
<httpEndpoint id="defaultHttpEndpoint" host="*" httpPort="9090" />
<application context-root="helloworld" type="war" id="helloworld"
location="helloworld.war" name="helloworld"/>
</server>
Where context-root specifies the entry point of the deployed application.
Additional features may be required depending on application.
Start the Liberty Server
1) Start the Liberty Server by running the "server start" command.
Example:
STRQSH
cd /QIBM/ProdData/WebSphere/LibertyServer/Express/bin/
server start libertyServer
CPC1221: Job 622758/QEJBSVR/LIBERTYSER submitted to job queue QWASJOBQ in
library QWAS85.
Server libertyServer started.
$
Misc Liberty server commands.
server status libertyServer
Sample Output:
Server libertyServer is running with process ID 28590.
$
server version libertyServer
Sample Output:
WebSphere Application Server wlp-1.0.0.20120428-1251(websphere-kernel_1.0.0)
on IBM J9 VM, version jvmap3260_26sr4-20121025_01
$
Variables
| <wlp.install.dir> = /QIBM/ProdData/WebSphere/LibertyServer/Express/ |
| <server.config.dir> = /QIBM/UserData/WebSphere/LibertyServer/Express/wlp/usr/servers/<serverName> |
| <server.output.dir> = /QIBM/UserData/WebSphere/LibertyServer/Express/wlp/output/servers/<serverName> |
Create the Liberty server:
1) Open a command prompt via Qshell. Then, change the directory to <wlp.install.dir>/ bin/.
Example:
STRQSH
cd /QIBM/ProdData/WebSphere/LibertyServer/Express/bin/
2) Run the following command to create a new Liberty application server.
If you do not specify a server name, the name "defaultServer" will be used.
<code>server create server_name</code>
where server_name is the name of the Liberty application server you want to create.
Example:
server create libertyServer
Server libertyServer created.
CPC221C: 2 objects successfully changed.
CPC221C: 411 objects successfully changed.
$
3) Modify the server.xml file to customize the HTTP and HTTPS port to your preference.
By default, the server directory is /QIBM/UserData/WebSphere/LibertyServer/Express/wlp/usr/servers/<serverName>
.
You can change the server directory as described
Example:
/QIBM/UserData/WebSphere/LibertyServer/Express/wlp/usr/servers/libertyServer/server.xml
Locate the following:
<httpEndpoint id="defaultHttpEndpoint"
host="localhost"
httpPort="9080"
httpsPort="9443" />
The httpPort and httpsPort values can be customized to fix the user's needs.
Deploy an Application
1) Create a directory apps for application deployment under the newly created server directory. The directory should be like /QIBM/UserData/WebSphere/LibertyServer/Express/wlp/usr/servers/libertyServer/apps
2) Copy the application into the apps directory created.
3) Configure the application by updating the server.xml as follows:
Example using helloworld.war:
<server description="Hello World Server">
<featureManager>
<feature>servlet-3.0</feature>
</featureManager>
<httpEndpoint id="defaultHttpEndpoint" host="*" httpPort="9090" />
<application context-root="helloworld" type="war" id="helloworld"
location="helloworld.war" name="helloworld"/>
</server>
Where context-root specifies the entry point of the deployed application.
Additional features may be required depending on application.
Start the Liberty Server
1) Start the Liberty Server by running the "server start" command.
Example:
STRQSH
cd /QIBM/ProdData/WebSphere/LibertyServer/Express/bin/
server start libertyServer
CPC1221: Job 622758/QEJBSVR/LIBERTYSER submitted to job queue QWASJOBQ in
library QWAS85.
Server libertyServer started.
$
Misc Liberty server commands.
server status libertyServer
Sample Output:
Server libertyServer is running with process ID 28590.
$
server version libertyServer
Sample Output:
WebSphere Application Server wlp-1.0.0.20120428-1251(websphere-kernel_1.0.0)
on IBM J9 VM, version jvmap3260_26sr4-20121025_01
$
[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m3p0000000rYtAAI","label":"WebSphere Application Server-\u003ELiberty"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]
Was this topic helpful?
Document Information
Modified date:
30 October 2024
UID
nas8N1019776