1、Window配置liberty

websphere liberty是IBM公司推出的web应用容器,类似于tomcat,以下是liberty的优点
1.1.配置简单;
1.2, 更改配置不需要重新启动服务,tomcat是需要的。
1.3, 多应用部署效率高,稳定性比Tomcat要好不少。
 
二 简单配置一个应用
下面主要是针对在window环境的配置,linux环境配置和window类似
 2.1  以下为liberty应用的主要目录
主要用到的几个目录
 
bin:              应用的命令目录,主要用到的命令是server 
templates: 模板目录,里面有一些简单的demo
usr:               用户目录,类似于工作区域,是发布应用服务的目录
2.2 重模板目录中复制默认的服务到用户的工作区域
在模板的servers目录下,copy一个默认的服务到usr的servers,并且重命名为wasdemo
服务的主要目录
apps目录:      用于放置要发布的war
dropins目录: 用于放置插件
server.xml :  服务的配置文件
2.3 修改 server.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">
<!-- Enable features -->
<featureManager>
<feature>javaee-8.0</feature>
</featureManager>
<!-- This template enables security. To get the full use of all the capabilities, a keystore and user registry are required. -->
<!-- For the keystore, default keys are generated and stored in a keystore. To provide the keystore password, generate an
encoded password using bin/securityUtility encode and add it below in the password attribute of the keyStore element.
Then uncomment the keyStore element. -->
<!--
<keyStore password=""/>
-->
<!--For a user registry configuration, configure your user registry. For example, configure a basic user registry using the
basicRegistry element. Specify your own user name below in the name attribute of the user element. For the password,
generate an encoded password using bin/securityUtility encode and add it in the password attribute of the user element.
Then uncomment the user element. -->
<basicRegistry id="basic" realm="BasicRealm">
<!-- <user name="yourUserName" password="" /> -->
</basicRegistry>
<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<!--host目录代表配置的ip地址,如果不配置host的话,应用只能通过127.0.0.1访问 -->
<httpEndpoint id="defaultHttpEndpoint" host="*"
httpPort="9080"
httpsPort="9443" />
<!-- Automatically expand WAR files and EAR files -->
<!-- <applicationManager autoExpand="true"/> -->
<!--配置要发布的war包 localtion代表着war的位置,mo默认指向apps目录下面,
如需要放在 apps/war目录下面的话,localtion则改为 war/Test.war -->
<application id="Test" location="Test.war" name="Test" type="war"/>
</server>
2.4.把要发布的war放到apps目录下面
2.5启动 wasdemo 服务
切换目录到  wlp/bin目录下面,然后用 server命令 启动应用,was默认目录的名称就是服务名称
启动:   server start wasdemo
停止:   server stop wasdemo
注意: 如果server 命令不加服务名称,他会启动 templates目录下的defaultserver 服务

原文地址:https://www.cnblogs.com/karlz/p/14356861.html