IBM WebSphere 9.0.5 笔记大全
IBM WebSphere note
author: joey_lee
Docker安裝WebSphere
拉取websphere镜像:
docker pull ibmcom/websphere-traditional:9.0.5.9
使用镜像生成容器并且启动容器:
docker run --name websphere9.0.5.9 -h websphere -e UPDATE_HOSTNAME=true -p 9043:9043 -p 9443:9443 -p 9080:9080 --restart=always -d ibmcom/websphere-traditional:9.0.5.9docker run #启动容器的命令,后面跟各种参数 + 容器镜像信息--name websphere #指定启动的容器名为 websphere-e UPDATE_HOSTNAME=true #访问websphere的ip不是localhost时需要此参数-p 9043:9043 #指定访问端口号-d ibmcom/websphere-traditional:8.5.5.12-profile #后台运行该镜像生成的容器
查看生成登录的密码:
docker exec websphere9.0.5.9 cat /tmp/PASSWORD
通过浏览器访问websphere:
https://127.0.0.1:9043/ibm/console/login.do?action=secure127.0.0.1 #当前虚拟机的ip地址(每个人的都不一样)9043 #设定访问websphere的端口号
登录的账号密码
账号 : wsadmin密码 : T52Rp3Mm (就是前面使用 docker exec websphere cat /tmp/PASSWORD 命令输出的内容,每个人的都不一样)
提示
如果忘记了websphere的密码,可以使用docker exec websphere cat /tmp/PASSWORD 命令来查看登录该容器的密码,账号都统一为 wsadmin。 (websphere为容器名)如果容器启动不正常,可以使用 docker logs -f websphere 命令来查看容器启动的日志信息,确定错误原因。(websphere为容器名)
docker exec websphere9.0.5.9 cat /tmp/PASSWORD
Docker-Compose安裝WebSphere
文件示例
version: '3'
services:was:# 镜像image: "ibmcom/websphere-traditional:latest"#端口映射ports:- "9043:9043"- "9443:9443"- "9080:9080"- "9060:9060"- "8880:8880"- "9403:9403"# 绑定与宿主机的目录volumes:- /data/was:/data/was
启动
cd /data/was
docker-compose up
后台启动
docker-compose up -d
查看密码
管理控制台用户 ID 默认为wsadmin
,初始 wsadmin 用户密码为/tmp/PASSWORD
docker-compose exec was cat /tmp/PASSWORD
进入终端
docker exec -it was_was_1 /bin/bash
windows命令(管理员运行)
储存库密码
admin
123@163.com
进入bin目录
cd C:\Program Files\IBM\WebSphere\AppServer\bin
WAS操作
进入bin目录
C:
cd /d C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\bin
启动Was
startServer server1 -profileName AppSrv01
如下所示,表示启动成功:
C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\bin>startServer server1 -profileName AppSrv01
ADMU0116I: 正在文件 C:\ProgramFiles\IBM\WebSphere\AppServer\profiles\AppSrv01\logs\server1\startServer.log中记录工具信息
ADMU0128I: 正在启动具有 AppSrv01 概要文件的工具
ADMU3100I: 正在从服务器读取配置:server1
ADMU3200I: 服务器已启动。正在等待初始化状态。
ADMU3000I: 为电子商务开放服务器 server1;进程标识为 7068
停止Was
stopServer server1 -profileName AppSrv01 -user admin -password admin
注:
-user <名称>
如果在服务器中启用了安全性,则指定用于身份验证的用户名。作用与 -username 选项相同。
-password <密码>
如果在服务器中启用了安全性,则指定用于身份验证的密码。
重启Was
stopServer server1
startServer server1
查看状态
serverStatus server1 -user admin -password admin
查看版本
C:
cd C:\Program Files\IBM\WebSphere\AppServer\bin
versionInfo.bat
示例结果
C:\Program Files\IBM\WebSphere\AppServer\bin>serverStatus server1 -user admin -password admin
ADMU0116I: 正在文件 C:\ProgramFiles\IBM\WebSphere\AppServer\profiles\AppSrv01\logs\server1\serverStatus.log中记录工具信息
ADMU0128I: 正在启动具有 AppSrv01 概要文件的工具
ADMU0500I: 正在检索 server1 的服务器状态
ADMU0508I: Application Server“server1”处于 STARTED 状态
使用wasdeploy
C:\Program Files\IBM\WebSphere\AppServer\bin\wsadmin.bat -user admin -password admin -f E:\Work\forward-server-jndi.jacl
maven打包
E:
cd E:\Work\code\gitlab\pbhk\mbk-server\common
mvn install -U --settings E:\Work\code\gitlab\pbhk\mbk-server\document\maven\settings.xml -Dmaven.test.skip=true
cd E:\Work\code\gitlab\pbhk\mbk-server\common\common-call
mvn install -U --settings E:\Work\code\gitlab\pbhk\mbk-server\document\maven\settings.xml -Dmaven.test.skip=true
cd E:\Work\code\gitlab\pbhk\mbk-server\common\common-call-test
mvn install -U --settings E:\Work\code\gitlab\pbhk\mbk-server\document\maven\settings.xml -Dmaven.test.skip=true
cd E:\Work\code\gitlab\pbhk\mbk-server\common\common-call-test-jndi
mvn package -U --settings E:\Work\code\gitlab\pbhk\mbk-server\document\maven\settings.xml -Dmaven.test.skip=true
根据jacl命名脚本文件启动
安装应用
C:
cd C:\Program Files\IBM\WebSphere\AppServer\bin
wsadmin.bat -user admin -password admin -f "E:\Work\websphere application server\common-call-test-jndi\common-call-test-jndi_install.jacl"
注:
user 用户名
password 密码
f 指定jacl文件
更新应用
C:
cd C:\Program Files\IBM\WebSphere\AppServer\bin
wsadmin.bat -user admin -password admin -f "E:\Work\websphere application server\common-call-test-jndi\common-call-test-jndi_update.jacl"
注:
user 用户名
password 密码
f 指定jacl文件
WebSphere 控制台页面
https://localhost:9043/ibm/console/logon.jsp
用户名/密码
admin/admin
查看日志
#查看应用日志
cd C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\logs\server1
cat TextLog_22.06.23_00.44.18_server1.log
测试接口路径
http://localhost:8081/http/v1/testJNDI
was路径
http://localhost:9080/common-call-test-jndi/http/v1/testJNDI
Linux命令
进入docker
docker exec -it websphere9.0.5.9 /bin/bash
查找安装目录
-type d:查找目录。
find / -type d -name WebSphere
WAS操作
进入bin目录
cd /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin
启动Was
startServer.sh server1 -profileName AppSrv01
如下所示,表示启动成功:
ADMU0116I: 正在文件 C:\ProgramFiles\IBM\WebSphere\AppServer\profiles\AppSrv01\logs\server1\startServer.log中记录工具信息
ADMU0128I: 正在启动具有 AppSrv01 概要文件的工具
ADMU3100I: 正在从服务器读取配置:server1
ADMU3200I: 服务器已启动。正在等待初始化状态。
ADMU3000I: 为电子商务开放服务器 server1;进程标识为 7068
停止Was
stopServer.sh server1 -profileName AppSrv01 -user admin -password admin
注:
-user <名称>
如果在服务器中启用了安全性,则指定用于身份验证的用户名。作用与 -username 选项相同。
-password <密码>
如果在服务器中启用了安全性,则指定用于身份验证的密码。
重启Was
stopServer.sh server1
startServer.sh server1
查看状态
serverStatus.sh server1 -user wsadmin -password pwd
输出
[was@websphere bin]$ serverStatus.sh server1 -user wsadmin -password pwd
ADMU0116I: Tool information is being logged in file/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/server1/serverStatus.log
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU0500I: Retrieving server status for server1
ADMU0508I: The Application Server "server1" is STARTED
查看版本
versionInfo.sh
示例结果
[was@websphere bin]$ versionInfo.sh
WVER0010I: Copyright (c) IBM Corporation 2002, 2012; All rights reserved.
WVER0012I: VersionInfo reporter version 1.15.1.48, dated 2/8/12--------------------------------------------------------------------------------
IBM WebSphere Product Installation Status Report
--------------------------------------------------------------------------------Report at date and time September 1, 2022 8:54:16 AM UTCInstallation
--------------------------------------------------------------------------------
Product Directory /opt/IBM/WebSphere/AppServer
Version Directory /opt/IBM/WebSphere/AppServer/properties/version
DTD Directory /opt/IBM/WebSphere/AppServer/properties/version/dtd
Log Directory /opt/IBM/WebSphere/AppServerIMData/logsProduct List
--------------------------------------------------------------------------------
JAVA8 installed
BASE installedInstalled Product
--------------------------------------------------------------------------------
Name IBM SDK, Java Technology Edition, Version 8
Version 8.0.7.6
ID JAVA8
Build Level pxa6480sr7fp6-20220330_01
Build Date 03/30/22
Architecture x86-64 (64 bit)Installed Product
--------------------------------------------------------------------------------
Name IBM WebSphere Application Server
Version 9.0.5.9
ID BASE
Build Level f5092134.01
Build Date 8/23/21
Package com.ibm.websphere.ILAN.v90_9.0.5009.20210823_0038
Architecture x86-64 (64 bit)
Installed Features WebSphere Application Server traditionalEJBDeploy tool for pre-EJB 3.0 modulesEmbeddable EJB containerStand-alone thin clients and resource adapters--------------------------------------------------------------------------------
End Installation Status Report
--------------------------------------------------------------------------------
使用wasdeploy
wsadmin.sh -user admin -password admin -f E:\Work\forward-server-jndi.jacl
查看日志
#查看应用日志
cd /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/server1
cat SystemOut.log
控制台查看日志
https://www.ibm.com/support/pages/how-view-logging-information-inside-websphere-application-server
Jython
wsadmin 工具支持两种脚本语言:Jacl 和 Jython。使用脚本时有五个对象可用:
- AdminControl:用于运行操作命令。
- AdminConfig:用于运行配置命令以创建或修改 WebSphere Application Server 配置元素。
- AdminApp:用于管理应用程序。
- AdminTask:用于运行管理命令。
- 帮助:用于获得一般帮助。
进入控制台
cd /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin
wsadmin.sh -user wsadmin -password pwd
cd /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin
wsadmin.sh -user admin1 -password admin1
使用 wsadmin 脚本的 AdminConfig 对象的命令
https://www.ibm.com/docs/en/was-nd/9.0.5?topic=scripting-commands-adminconfig-object-using-wsadmin
使用 wsadmin 脚本的 AdminApp 对象的命令
https://www.ibm.com/docs/en/was-nd/9.0.5?topic=scripting-commands-adminapp-object-using-wsadmin
使用 wsadmin 脚本的 AdminTask 对象的命令
https://www.ibm.com/docs/en/was-nd/9.0.5?topic=scripting-commands-admintask-object-using-wsadmin
AdminConfig 命令参考
wsadmin>print AdminConfig.help()
WASX7053I: The AdminConfig object communicates with the Config Service in aWebSphere server to manipulate configuration data for a WebSphereinstallation. AdminConfig has commands to list, create, remove,display, and modify configuration data, as well as commands to displayinformation about configuration data types.Most of the commands supported by AdminConfig operate in two modes:the default mode is one in which AdminConfig communicates with theWebSphere server to accomplish its tasks. A local mode is alsopossible, in which no server communication takes place. The localmode of operation is invoked by bringing up the scripting client withno server connected using the command line "-conntype NONE" optionor setting the "com.ibm.ws.scripting.connectionType=NONE" property inthe wsadmin.properties.The following commands are supported by AdminConfig; more detailedinformation about each of these commands is available by using the"help" command of AdminConfig and supplying the name of the commandas an argument.attributes Shows the attributes for a given type
checkin Checks a file into the configuration repository
convertToClusterConverts a server to be the first member of a new ServerCluster
create Creates a configuration object, given a type, a parent, anda list of attributes, and optionally an attribute name for thenew object
createClusterMemberCreates a new server that is a member of an existing cluster
createDocument Creates a new document in the configuration repository
createUsingTemplateCreates an object using a particular template type
defaults Displays the default values for attributes of a given type
deleteDocument Deletes a document from the configuration repository
existsDocument Tests for the existence of a document in the configurationrepository
extract Extracts a file from the configuration repository
getCrossDocumentValidationEnabledReturns true if cross-document validation is enabled
getid Shows the configuration ID of an object, given a string versionof its containment
getObjectName Given a configuration ID, returns a string version of theObjectName for the corresponding running MBean, if any
getObjectType Given a configuration ID, returns a string version of theobject type
getSaveMode Returns the mode used when "save" is invoked
getValidationLevelReturns the validation used when files are extracted from therepository.
getValidationSeverityResultReturns the number of messages of a given severity from themost recent validation
hasChanges Returns true if unsaved configuration changes exist
help Shows help information
installResourceAdapterInstalls a J2C resource adapter with the given rar file nameand an option string in the node
list Lists all configuration objects of a given type
listTemplates Lists all available configuration templates of a given type
modify Changes specified attributes of a given configuration object
parents Shows the objects which contain a given type
queryChanges Returns a list of unsaved files
remove Removes the specified configuration object
required Displays the required attributes of a given type.
reset Discards unsaved configuration changes
resetAttributes Resets value of the specified attributes.
save Commits unsaved changes to the configuration repository
setCrossDocumentValidationEnabledSets the cross-document validation enabled mode.
setSaveMode Changes the mode used when "save" is invoked
setValidationLevelSets the validation used when files are extracted from therepository.
show Shows the attributes of a given configuration object
showall Recursively shows the attributes of a given configurationobject, and all the objects contained within each attribute.
showAttribute Displays only the value for the single attribute specified.
types Shows the possible types for configuration
uninstallResourceAdapterUninstalls a J2C resource adapter with the given resourceadapter configuration ID.
unsetAttributes Unsets value of the specified attributes.
validate Invokes validation
AdminApp 命令参考
wsadmin>AdminApp.help()
u'WASX7095I: The AdminApp object allows application objects to be manipulated\n\t-- this includes installing, uninstalling, editing, and listing. Most\n\tof the commands supported by AdminApp operate in two modes: the default\n\tmode is one in which AdminApp communicates with the WebSphere server to\n\taccomplish its tasks. A local mode is also possible, in which no\n\tserver communication takes place. The local mode operation is invoked\n\tby bringing up the scripting client with no server connected using the\n\tcommand line "-conntype NONE" option tor setting the\n\t"com.ibm.ws.scripting.connectionType=NONE" property in the\n\twsadmin.properties.\n\n\tThe following commands are supported by AdminApp; more detailed\n\tinformation about each of these commands is available by using the\n\t"help" command of AdminApp and supplying the name of the command\n\tas an argument.\n\ndeleteUserAndGroupEntries \n\t\tDeletes all the user/group information for all the roles and\n\t\tall the user name/password information for RunAs roles for a\n\t\tgiven application\nedit\t\tEdits the properties of an application\neditInteractive\tEdits the properties of an application interactively\nexport\t\tExports application to a file\nexportDDL\tExports DDL from application to a directory\nexportFile\tExports content of a single file from an application to a file\ngetDeployStatus\tReturns the combined Deployment status of the application\nhelp\t\tShows help information\ninstall\t\tInstalls an application, given a file name and an option string\ninstallInteractive\n\t\tInstalls an application in interactive mode, given a file name\n\t\tand an option string\nisAppReady\tChecks whether the application is ready to be run\nlist\t\tLists all installed applications\nlistModules\tLists the modules in a specified application\noptions\t\tShows the options available, for a given file, application,\n\t\tor in general\nrenameApplication\tRename a given application\npublishWSDL\tPublishs WSDL files for a given application\nsearchJNDIReferences\n\t\tLists application that refers to the given JNDIName on a given\n\t\tnode\ntaskInfo\tShows detailed information pertaining to a given install task\n\t\tfor a given file\nuninstall\tUninstalls an application, given an application name and\n\t\tan option string\nupdate\t\tUpdates an installed application\nupdateAccessIDs\tUpdates the user/group binding information with accessID\n\t\tfrom user registry for a given application\nupdateInteractive\tUpdates an installed application interactively\nview\t\tViews an application or module, given an application or\n\t\tmodule name'
wsadmin>print AdminApp.help()
WASX7095I: The AdminApp object allows application objects to be manipulated-- this includes installing, uninstalling, editing, and listing. Mostof the commands supported by AdminApp operate in two modes: the defaultmode is one in which AdminApp communicates with the WebSphere server toaccomplish its tasks. A local mode is also possible, in which noserver communication takes place. The local mode operation is invokedby bringing up the scripting client with no server connected using thecommand line "-conntype NONE" option tor setting the"com.ibm.ws.scripting.connectionType=NONE" property in thewsadmin.properties.The following commands are supported by AdminApp; more detailedinformation about each of these commands is available by using the"help" command of AdminApp and supplying the name of the commandas an argument.deleteUserAndGroupEntries Deletes all the user/group information for all the roles andall the user name/password information for RunAs roles for agiven application
edit Edits the properties of an application
editInteractive Edits the properties of an application interactively
export Exports application to a file
exportDDL Exports DDL from application to a directory
exportFile Exports content of a single file from an application to a file
getDeployStatus Returns the combined Deployment status of the application
help Shows help information
install Installs an application, given a file name and an option string
installInteractiveInstalls an application in interactive mode, given a file nameand an option string
isAppReady Checks whether the application is ready to be run
list Lists all installed applications
listModules Lists the modules in a specified application
options Shows the options available, for a given file, application,or in general
renameApplication Rename a given application
publishWSDL Publishs WSDL files for a given application
searchJNDIReferencesLists application that refers to the given JNDIName on a givennode
taskInfo Shows detailed information pertaining to a given install taskfor a given file
uninstall Uninstalls an application, given an application name andan option string
update Updates an installed application
updateAccessIDs Updates the user/group binding information with accessIDfrom user registry for a given application
updateInteractive Updates an installed application interactively
view Views an application or module, given an application ormodule name
AdminControl 命令参考
WASX7027I: The AdminControl object enables the manipulation of MBeans runningin a WebSphere server process. The number and type of MBeans availableto the scripting client depends on the server to which the client isconnected. If the client is connected to a Deployment Manager, thenall the MBeans running in the Deployment Manager are visible as are allthe MBeans running in the Node Agents connected to this DeploymentManager, and all the MBeans running in the application servers on thosenodes.The following commands are supported by AdminControl; more detailedinformation about each of these commands is available by using the"help" command of AdminControl and supplying the name of the commandas an argument.Note that many of these commands support two different sets ofsignatures: one that accepts and returns strings, and one low-levelset that works with JMX objects like ObjectName and AttributeList.In most situations, the string signatures are likely to be more useful,but JMX-object signature versions are supplied as well. Each of theseJMX-object signature commands has "_jmx" appended to the command name.Hence there is an "invoke" command, as well as a "invoke_jmx" command.completeObjectNameReturns a String version of an object name given a templatename
getAttribute_jmxGiven ObjectName and name of attribute, returns value ofattribute
getAttribute Given String version of ObjectName and name of attribute,returns value of attribute
getAttributes_jmxGiven ObjectName and array of attribute names, returns AttributeList.
getAttributes Given String version of ObjectName and attribute names,returns String of name value pairs. Given String versionof ObjectName, returns String of all name value pairs.
getCell Returns the cell name of the connected server
getConfigId Given String version of ObjectName, return a configurationID for the corresponding configuration object, if any
getDefaultDomainReturns "WebSphere"
getDomainName Returns "WebSphere"
getHost Returns String representation of connected host
getMBeanCount Returns number of registered beans
getMBeanInfo_jmxGiven ObjectName, returns MBeanInfo structure for MBean
getNode Returns the node name of the connected server
getObjectInstanceGiven String version of ObjectName, returns ObjectInstanceobject that match.
getPort Returns String representation of port in use
getType Returns String representation of connection type in use
help Shows help information
invoke_jmx Given ObjectName, name of method, array of parameters andsignature, invokes method on MBean specified
invoke Invokes a method on the specified MBean
isRegistered_jmxReturns true if supplied ObjectName is registered
isRegistered Returns true if supplied String version of ObjectName isregistered
makeObjectName Returns an ObjectName built with the given string
queryNames_jmx Given ObjectName and QueryExp, retrieves set of ObjectNamesthat match.
queryNames Given String version of ObjectName, retrieves String ofObjectNames that match
queryMBeans Given String version of ObjectName, returns a set ofObjectInstances object that match
reconnect Reconnects with server
setAttribute_jmxGiven ObjectName and Attribute object, sets attribute for MBeanspecified
setAttribute Given String version of ObjectName, attribute name andattribute value, sets attribute for MBean specified
setAttributes_jmxGiven ObjectName and AttributeList object, sets attributes forthe MBean specified
setAttributes Given String version of ObjectName, attribute nameand value pairs, sets attributes for the MBean specified
startServer Given the name of a server, starts that server
stopServer Given the name of a server, stops that server
testConnection Tests the connection to a DataSource object
trace Sets the wsadmin trace specification
用户操作
控制台操作
左侧 Users and Groups
搜索用户
样本
要搜索具有主体名称的所有用户,请发出以下命令:
AdminTask.searchUsers(['-principalName', '*'])
输出
wsadmin>AdminTask.searchUsers(['-principalName', '*'])
u'uid=admin1,o=defaultWIMFileBasedRealm\nuid=wsadmin,o=defaultWIMFileBasedRealm'
要搜索具有以字母“d”开头的 uid 的所有用户,请发出以下命令:
AdminTask.searchUsers(['-uid', 'd*'])
输出
wsadmin>AdminTask.searchUsers(['-uid', '*'])
u'uid=wsadmin,o=defaultWIMFileBasedRealm'
创建用户
要求不得出现共用特权管理账号,管理账号必须按角色分配用户角色为 monitor(监控员)、Configurator(配置员)、Operator(操作员)Administrator(管理员) 之一
参数
-uid uid
指定要创建的用户的唯一 ID。Virtual member manager 然后为用户创建一个 uniqueId 值和一个 uniqueName 值。此参数映射到虚拟成员管理器中的 uid 属性。
-password密码
指定用户的密码。此参数映射到 virtual member manager 中的密码属性。
-confirmPassword密码
再次指定密码以验证它是如何在密码参数中输入的。此参数映射到 virtual member manager 中的密码属性。
-cn通用名
指定用户的名字或名字。此参数映射到虚拟成员管理器中的 cn 属性。
-sn姓氏
指定用户的姓氏或姓氏。此参数映射到 virtual member manager 中的 sn 属性。
**-**mail邮件
指定用户的电子邮件地址。此参数映射到 virtual member manager 中的 ibm-PrimaryEmail 属性。
-parent*父母*
指定要在其中创建用户的存储库。此参数映射到 virtual member manager 中的 parent 属性。
-securityDomainName域名
指定唯一标识安全域的名称。如果不指定此参数,则该命令使用全局联合存储库。
样本
要创建一个名为 Dan Meyers 的用户,其唯一 ID 为 dmeyers,电子邮件地址为 dmeyers@acme.com,密码为 tempPass,请发出以下命令:
$AdminTask createUser {-uid dmeyers -password admin1 -confirmPassword admin1-cn admin1 -sn admin1 -mail dmeyers@acme.com}
示例:
AdminTask.createUser(['-uid', 'admin1', '-password', 'admin1', '-confirmPassword', 'admin1', '-cn', 'administrator', '-sn', 'administrator'])
输出
u'uid=administrator,o=defaultWIMFileBasedRealm'
删除用户
参数
-uniqueName 唯一名称
指定要删除的用户的唯一名称值。此参数映射到 virtual member manager 中的 uniqueName 属性。
-securityDomainName域名
指定唯一标识安全域的名称。如果不指定此参数,则该命令使用全局联合存储库。
样本
要删除唯一名称为 uid=dmeyers,cn=users,dc=yourco,dc=com 的用户 Dan Meyers,请发出以下命令:
$AdminTask deleteUser {-uniqueName uid=dmeyers,cn=users,dc=yourco,dc=com}
示例:
AdminTask.deleteUser ('[-uniqueName uid=admin1,cn=administrator1,dc=yourco,dc=com]')
AdminTask.deleteUser ('[-uniqueName uid=admin1,o=defaultWIMFileBasedRealm]')
输出
u'uid=administrator,o=defaultWIMFileBasedRealm'
将用户设置为管理员
AdminTask.mapUsersToAdminRole('[-roleName administrator -userids uid=admin1,o=defaultWIMFileBasedRealm]')
配置JMS、MQ
配置队列连接工厂
获取节点和单元标识符
AdminConfig.getid("/Node:DefaultNode01")
输出
wsadmin>AdminConfig.getid("/Node:DefaultNode01")
u'DefaultNode01(cells/DefaultCell01/nodes/DefaultNode01|node.xml#Node_1)'
wsadmin>
创建工厂
创建请求连接工厂,指定节点、JNDI名称
AdminTask.createWMQConnectionFactory("DefaultNode01(cells/DefaultCell01/nodes/DefaultNode01|node.xml#Node_1)", ["-name esb_req_factory -jndiName 'jms/cf/esb_req_factory' -type CF -description 'lee`s req_factory' -qmgrName ESB_REQ -qmgrHostname 127.0.0.1 -qmgrPortNumber 11517 -qmgrSvrconnChannel CHL_CONN"])
AdminConfig.save()
输出:
u'esb_req_factory(cells/DefaultCell01/nodes/DefaultNode01|resources.xml#MQConnectionFactory_1662098926715)'
创建响应连接工厂,指定节点、JNDI名称
AdminTask.createWMQConnectionFactory("DefaultNode01(cells/DefaultCell01/nodes/DefaultNode01|node.xml#Node_1)", ["-name esb_res_factory -jndiName 'jms/cf/esb_res_factory' -type CF -description 'lee`s res_factory' -qmgrName ESB_RES -qmgrHostname 127.0.0.1 -qmgrPortNumber 11518 -qmgrSvrconnChannel CHL_CONN"])
AdminConfig.save()
输出:
u'esb_res_factory(cells/DefaultCell01/nodes/DefaultNode01|resources.xml#MQConnectionFactory_1662099030776)'
新建完成后,可在控制台 Resources-JMS-Connection factories 查看
创建队列
创建请求队列,指定节点、JNDI名称
AdminTask.createWMQQueue("DefaultNode01(cells/DefaultCell01/nodes/DefaultNode01|node.xml#Node_1)", ["-name esb_req -jndiName jms/queues/esb_req -queueName Q_ESB_LJ"])
AdminConfig.save()
输出:
u'esb_req(cells/DefaultCell01/nodes/DefaultNode01|resources.xml#MQQueue_1662099054288)'
创建响应队列,指定节点、JNDI名称
AdminTask.createWMQQueue("DefaultNode01(cells/DefaultCell01/nodes/DefaultNode01|node.xml#Node_1)", ["-name esb_res -jndiName jms/queues/esb_res -queueName Q_RCVR_LJ"])
AdminConfig.save()
输出:
u'esb_res(cells/DefaultCell01/nodes/DefaultNode01|resources.xml#MQQueue_1662099080480)'
更新
更新工厂
AdminTask.modifyWMQConnectionFactory("esb_req_factory(cells/DefaultCell01/nodes/DefaultNode01|resources.xml#MQConnectionFactory_1662108208851)", [" -description 'lee`s req_factory' -qmgrName QM_HBK_CLIENT -qmgrHostname 127.0.0.1 -qmgrPortNumber 11520 -qmgrSvrconnChannel CHL_CONN"]) AdminTask.modifyWMQConnectionFactory("esb_res_factory(cells/DefaultCell01/nodes/DefaultNode01|resources.xml#MQConnectionFactory_1662108208851)", [" -description 'lee`s res_factory' -qmgrName QM_HBK_SERVER -qmgrHostname 127.0.0.1 -qmgrPortNumber 11521 -qmgrSvrconnChannel CHL_CONN"])
更新队列
AdminTask.modifyWMQQueue("esb_req(cells/DefaultCell01/nodes/DefaultNode01|resources.xml#MQQueue_1662605238946)", ["-queueName Q_ESB_LJ"]) AdminTask.modifyWMQQueue("esb_res(cells/DefaultCell01/nodes/DefaultNode01|resources.xml#MQQueue_1662605238946)", ["-queueName Q_RCVR_LJ"])
查看
查看队列工厂
AdminTask.listWMQConnectionFactories("DefaultNode01(cells/DefaultCell01/nodes/DefaultNode01|node.xml#Node_1)")
输出
u'esb_req_factory(cells/DefaultCell01/nodes/DefaultNode01|resources.xml#MQConnectionFactory_1662108208851)\nesb_res_factory(cells/DefaultCell01/nodes/DefaultNode01|resources.xml#MQConnectionFactory_1662605238475)'
查看队列
AdminTask.listWMQQueues("DefaultNode01(cells/DefaultCell01/nodes/DefaultNode01|node.xml#Node_1)")
输出
u'esb_req(cells/DefaultCell01/nodes/DefaultNode01|resources.xml#MQQueue_1662605238946)\nesb_res(cells/DefaultCell01/nodes/DefaultNode01|resources.xml#MQQueue_1662605239088)'
删除
删除工厂
AdminTask.deleteWMQConnectionFactory("esb_req_factory(cells/DefaultCell01/nodes/DefaultNode01|resources.xml#MQConnectionFactory_1662108208851)")
AdminTask.deleteWMQConnectionFactory("esb_res_factory(cells/DefaultCell01/nodes/DefaultNode01|resources.xml#MQConnectionFactory_1662605238475)")
删除队列
AdminTask.deleteWMQQueue("esb_req_req(cells/DESKTOP-BOMMDG2Node01Cell/nodes/DESKTOP-BOMMDG2Node01|resources.xml#MQQueue_1661475789072)")
输出
u''
保存配置
AdminConfig.save()
新建完成后,可在控制台 Resources-JMS-Queues 查看
部署War
将war包拷贝到服务器
Linux
scp user@10.31.27.29:E:/Work/code/gitlab/pbhk/mbk-server/common/common-call-test-jndi/target/common-call-test-jndi.war /data/was
user为Windows用户名,10.150.69.247为Windows的ip,/home/zhao/data/test.txt(/home/zhao/data)为想要将文件复制到linux的哪个文件(文件夹)
Windows
scp "D:\work\code\gitlab\pbhk\mbk-server\common\common-call-test-jndi\target\common-call-test-jndi.war" user@127.0.0.1:/home/user
输入密码
Aa@123456
scp "D:\work\code\gitlab\pbhk\mbk-server\common\common-call-test-jndi\target\common-call-test-jndi.war" user@127.0.0.1:/home/user
输入密码
Formssi@dz
切换root用户
sudo su -
Aa@123456
移动文件到docker挂载目录
mv /home/user/common-call-test-jndi.war /data/was/common-call-test-jndi.war
如果没有挂载则需要拷贝进docker容器内部
docker cp /home/forms/common-call-test-jndi.war websphere9.0.5.9:/common-call-test-jndi.war
进入容器并进入wasadmin控制台
docker exec -it was_was_1 /bin/bash
cd /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin
wsadmin.sh -user wsadmin -password pwd
安装应用
AdminApp.install('/data/was/common-call-test-jndi.war','[-appname common-call-test-jndi-lee -contextroot /common-call-test-jndi-lee -node DefaultNode01 -cell DefaultCell01 -server server1 -MapWebModToVH [[.* .* default_host]]]')
输出
wsadmin>AdminApp.install('/data/was/common-call-test-jndi.war','[-appname common-call-test-jndi-lee -contextroot /common-call-test-jndi-lee -node DefaultNode01 -cell DefaultCell01 -server server1 -MapWebModToVH [[.* .* default_host]]]')
AdminConfig.save()
WASX7327I: Contents of was.policy file://
// Template policy file for enterprise application.
// Extra permissions can be added if required by the enterprise application.
//
// NOTE: Syntax errors in the policy files will cause the enterprise application FAIL to start.
// Extreme care should be taken when editing these policy files. It is advised to use
// the policytool provided by the JDK for editing the policy files
// (WAS_HOME/java/jre/bin/policytool).
//grant codeBase "file:${application}" {
};grant codeBase "file:${jars}" {
};grant codeBase "file:${connectorComponent}" {
};grant codeBase "file:${webComponent}" {
};grant codeBase "file:${ejbComponent}" {
};ADMA5016I: Installation of common-call-test-jndi-lee started.
ADMA5058I: Application and module versions are validated with versions of deployment targets.
ADMA5005I: The application common-call-test-jndi-lee is configured in the WebSphere Application Server repository.
ADMA5005I: The application common-call-test-jndi-lee is configured in the WebSphere Application Server repository.
ADMA5081I: The bootstrap address for client module is configured in the WebSphere Application Server repository.
ADMA5053I: The library references for the installed optional package are created.
ADMA5005I: The application common-call-test-jndi-lee is configured in the WebSphere Application Server repository.
ADMA5001I: The application binaries are saved in /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/wstemp/Script18315ed39f9/workspace/cells/DefaultCell01/applications/common-call-test-jndi-lee.ear/common-call-test-jndi-lee.ear
ADMA5005I: The application common-call-test-jndi-lee is configured in the WebSphere Application Server repository.
SECJ0400I: Successfully updated the application common-call-test-jndi-lee with the appContextIDForSecurity information.
ADMA5005I: The application common-call-test-jndi-lee is configured in the WebSphere Application Server repository.
ADMA5005I: The application common-call-test-jndi-lee is configured in the WebSphere Application Server repository.
ADMA5113I: Activation plan created successfully.
ADMA5011I: The cleanup of the temp directory for application common-call-test-jndi-lee is complete.
ADMA5013I: Application common-call-test-jndi-lee installed successfully.
u''
安装完保存
AdminConfig.save()
安装完成后,可在控制台 Applications-Application Types-WebSphere nterprise Applications 查看
更新应用
print AdminApp.update('common-call-test-jndi-lee', 'file', '[-operation update -contents /data/was/common-call-test-jndi.war -contenturi common-call-test-jndi.war]')
AdminConfig.save()
输出
wsadmin>print AdminApp.update('common-call-test-jndi-lee', 'file', '[-operation update -contents /data/was/common-call-test-jndi.war -contenturi common-call-test-jndi.war]')
am=AdminControl.queryNames('cell=DefaultCell01,node=DefaultNode01,type=ApplicationManager,process=server1,*')
ADMA5078I: Update of common-call-test-jndi-lee has started.
ADMA5058I: Application and module versions are validated with versions of deployment targets.
ADMA5009I: Extracting application archive to /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/wstemp/appmgmt/mbean/AppManagement_18311c60ee2_1/app_183161b6147/ext.
ADMA5064I: FileMergeTask completed successfully for common-call-test-jndi-lee.
ADMA5005I: The application common-call-test-jndi-lee is configured in the WebSphere Application Server repository.
ADMA5005I: The application common-call-test-jndi-lee is configured in the WebSphere Application Server repository.
ADMA5005I: The application common-call-test-jndi-lee is configured in the WebSphere Application Server repository.
ADMA5113I: Activation plan created successfully.
ADMA5005I: The application common-call-test-jndi-lee is configured in the WebSphere Application Server repository.
ADMA5011I: The cleanup of the temp directory for application common-call-test-jndi-lee is complete.
ADMA5079I: Update of common-call-test-jndi-lee has ended. The application or its web modules may require a restart when a save is performed.
更新完保存
AdminConfig.save()
更新完成后,可在控制台 Applications-Application Types-WebSphere nterprise Applications 查看
卸载应用
print AdminApp.uninstall('common-call-test-jndi-lee')
输出
wsadmin>print AdminApp.uninstall('common-call-test-jndi-lee')
ADMA5017I: Uninstallation of common-call-test-jndi-lee started.
ADMA5104I: The server index entry for WebSphere:cell=DefaultCell01,node=DefaultNode01 is updated successfully.
ADMA5102I: The configuration data for common-call-test-jndi-lee from the configuration repository is deleted successfully.
ADMA5011I: The cleanup of the temp directory for application common-call-test-jndi-lee is complete.
ADMA5106I: Application common-call-test-jndi-lee uninstalled successfully.
卸载完保存
AdminConfig.save()
卸载完成后,可在控制台 Applications-Application Types-WebSphere nterprise Applications 查看验证
启动单个应用
am=AdminControl.queryNames('cell=DefaultCell01,node=DefaultNode01,type=ApplicationManager,process=server1,*')
AdminControl.invoke(am, 'startApplication', '[common-call-test-jndi-lee]')
测试接口
http://127.0.0.1:9080/common-call-test-jndi-lee/esb/testJNDI
http://127.0.0.1:9080/common-call-test-jndi-lee/esb/call
停止单个应用
am=AdminControl.queryNames('cell=DefaultCell01,node=DefaultNode01,type=ApplicationManager,process=server1,*')
AdminControl.invoke(am, 'stopApplication', '[common-call-test-jndi-lee]')
Jacl
- 【英文全称】 Java Application Control Language
- 【中文意思】 Java应用程序控制语言
部署War
启动应用
# 停止应用
# 识别应用程序所在的服务器的应用程序管理器 MBean,并将其指定给 appManager 变量
set appManager [$AdminControl queryNames cell=DESKTOP-BOMMDG2Node01Cell,node=DESKTOP-BOMMDG2Node01,type=ApplicationManager,process=server1,*]# 使用程序内部数据源
#appname 应用名称
#target 将模块映射至服务器
#MapWebModToVH 使用指定host
#contextroot 为 Web 模块映射上下文根
# 安装
$AdminApp install "E:/Work/code/gitlab/pbhk/mbk-server/common/common-call-test-jndi/target/common-call-test-jndi.war" {-appname common-call-test-jndi -target WebSphere:cell=DESKTOP-BOMMDG2Node01Cell,node=DESKTOP-BOMMDG2Node01,server=server1 -MapWebModToVH{{.* .* default_host}} -contextroot /common-call-test-jndi}# 安装后需要保存配置
$AdminConfig save# STEP 4 启动应用
# 识别应用程序所在的服务器的应用程序管理器 MBean,并将其指定给 appManager 变量
set appManager [$AdminControl queryNames cell=DESKTOP-BOMMDG2Node01Cell,node=DESKTOP-BOMMDG2Node01,type=ApplicationManager,process=server1,*] # 启动单个应用
# myapp:被启动的服务名
$AdminControl invoke $appManager startApplication common-call-test-jndi
更新应用
# STEP 1 停止应用
# 识别应用程序所在的服务器的应用程序管理器 MBean,并将其指定给 appManager 变量
set appManager [$AdminControl queryNames cell=DESKTOP-BOMMDG2Node01Cell,node=DESKTOP-BOMMDG2Node01,type=ApplicationManager,process=server1,*]# 更新
$AdminApp update common-call-test-jndi file {-operation update -contents "E:/Work/code/gitlab/pbhk/mbk-server/common/common-call-test-jndi/target/common-call-test-jndi.war" -contenturi common-call-test-jndi.war}# 安装后需要保存配置
$AdminConfig save# STEP 4 启动应用
# 识别应用程序所在的服务器的应用程序管理器 MBean,并将其指定给 appManager 变量
set appManager [$AdminControl queryNames cell=DESKTOP-BOMMDG2Node01Cell,node=DESKTOP-BOMMDG2Node01,type=ApplicationManager,process=server1,*] # 启动单个应用
# myapp:被启动的服务名
$AdminControl invoke $appManager startApplication common-call-test-jndi
停止单个应用
# 停止单个应用
# $AdminControl invoke $appManager stopApplication forward-server-jndi
启动单个应用
# 启动单个应用
# myapp:被启动的服务名
$AdminControl invoke $appManager startApplication common-call-test-jndi
卸载应用
$AdminApp uninstall forward-server-jndi
# 需要保存配置
$AdminConfig save
部署脚本集合
配置MQ脚本
AdminTask.createWMQConnectionFactory("DefaultNode01(cells/DefaultCell01/nodes/DefaultNode01|node.xml#Node_1)", ["-name esb_req_factory -jndiName 'jms/cf/esb_req_factory' -type CF -description 'Must remember to keep each of these connection factories in sync with the IBM MQ queue manager to which they refer' -qmgrName ESB_REQ -qmgrHostname 127.0.0.1 -qmgrPortNumber 11517 -qmgrSvrconnChannel CHL_CONN"])AdminTask.createWMQConnectionFactory("DefaultNode01(cells/DefaultCell01/nodes/DefaultNode01|node.xml#Node_1)", ["-name esb_res_factory -jndiName 'jms/cf/esb_res_factory' -type CF -description 'Must remember to keep each of these connection factories in sync with the IBM MQ queue manager to which they refer' -qmgrName ESB_RES -qmgrHostname 127.0.0.1 -qmgrPortNumber 11518 -qmgrSvrconnChannel CHL_CONN"]) AdminTask.createWMQQueue("DefaultNode01(cells/DefaultCell01/nodes/DefaultNode01|node.xml#Node_1)", ["-name esb_req -jndiName jms/queues/esb_req -queueName Q_ESB_LJ"]) AdminTask.createWMQQueue("DefaultNode01(cells/DefaultCell01/nodes/DefaultNode01|node.xml#Node_1)", ["-name esb_res -jndiName jms/queues/esb_res -queueName Q_RCVR_LJ"])
AdminConfig.save()
安装启动war包
AdminApp.install('/data/was/common-call-test-jndi.war','[-appname common-call-test-jndi-lee -contextroot /common-call-test-jndi-lee -node DefaultNode01 -cell DefaultCell01 -server server1 -MapWebModToVH [[.* .* default_host]]]')
AdminConfig.save()
am=AdminControl.queryNames('cell=DefaultCell01,node=DefaultNode01,type=ApplicationManager,process=server1,*')
AdminControl.invoke(am, 'startApplication', '[common-call-test-jndi-lee]')
更新启动war包
print AdminApp.update('common-call-test-jndi-lee', 'file', '[-operation update -contents /data/was/common-call-test-jndi.war -contenturi common-call-test-jndi.war]')
am=AdminControl.queryNames('cell=DefaultCell01,node=DefaultNode01,type=ApplicationManager,process=server1,*')
AdminConfig.save()
am=AdminControl.queryNames('cell=DefaultCell01,node=DefaultNode01,type=ApplicationManager,process=server1,*')
AdminControl.invoke(am, 'startApplication', '[common-call-test-jndi-lee]')
IBM WebSphere 9.0.5 笔记大全相关推荐
- IBM MQ 9.2.4 笔记大全
IBM MQ note author: joey_lee 官方文档 将测试消息放入本地队列 https://www.ibm.com/docs/en/ibm-mq/9.2?topic=queue-put ...
- IBM Websphere MQ 基础0:Linux下安装IBM MQ 7.5
背景 无.公司就是用的IBM WebSphere MQ作为消息中间件,本文记载how install it. 一. 安装包检查与准备 1. 检查 通过rpm –qa检查是否已经安装 IBM MQ,若已 ...
- ibm服务器安装aix系统,在aix下安装ibm websphere MQ 7.0
最近为项目设置灾难恢复环境(包括和应用程序的灾难恢复). Oracle同步已通过DATAGUARD实现. 现在要将应用程序部署到灾难恢复室中的服务器,该应用程序软件使用ibm Websphere. M ...
- IBM WebSphere Portal 6.0的主题与皮肤开发
1 .1 入门: Portal 的主题与皮肤开发 要了解如何开发 P ortal 的主题,首先要了解 IBM WebSphere Portal 的显示流程. IBM WebSphere Porta ...
- IBM WebSphere Application Server 9.0.0.2 部署Spring Boot 2.x
IBM WebSphere Application Server 9.0.0.2 部署Spring Boot2.x 项目 目录 1:创建JDBC 提供程序 2:创建数据源 3:创建数据源认证信息(JA ...
- Could not resolve: com.ibm.websphere:uow:6.0.2.17
目录 背景 问题分析 解决方案 背景 导入Spring源码时,总是无法下载com.ibm.websphere:uow:6.0.2.17包,原来的地址https://repo.spring.io/lib ...
- 在Websphere 8.0上安装Liferay 6.2 Enterprise Edition
为Liferay准备Websphere 当应用服务器二进制文件均已安装完毕,启动WebSphere应用服务器(WAS) 配置文件管理工具来创建一个配置文件适用于Liferay的和遵循的指示说明这里正式 ...
- ibm服务器的虚拟控制台,IBM Worklight 6.0 - 开发服务器/控制台问题
在Worklight v5.0.6中预览Worklight Console的MBS中的混合应用程序非常简单,因为它的工作原理非常简单.IBM Worklight 6.0 - 开发服务器/控制台问题 W ...
- IBM WebSphere MQ 7.5基本用法
一.下载7.5 Trial版本 http://www.ibm.com/developerworks/downloads/ws/wmq/ 这是下载网址,下载前先必须注册IBM ID,下载完成后一路Nex ...
最新文章
- 【公开课预告】AutoML知多少
- Linux 执行文件查找命令 which 详解
- Gym - 102361A Angle Beats(几何)
- valueOf()、toString()
- 【POI2007】OSI-Axes of Symmetry【计算几何】【manacher】
- jquery ajax 异步分页,jquery 分页 Ajax异步
- linux命令之which
- 1-2 输出N个数的平方和立方值
- spark如何防止内存溢出_什么叫内存溢出?内存泄漏的定义又是什么?使用中如何避免?...
- java中nul值的处理
- MATLAB输出白色背景图片
- coursera和udacity_三大MOOC平台Coursera、EdX和Udacity的可用性比较研究
- win10升级2004失败?
- MySQL笔记---DQL语言
- vscode无法识别头文件“cannot open source file “gnu/stubs-64.h“”
- 所有用户登陆后都在桌面上显示计算机图标,如何在Win10桌面上显示计算机.控制面板.网络.用户的文件图标?...
- 学习半年Java的初次经验分享
- S7200SMART 软件在虚拟机中连接PLC笔记
- 商业落地的 DeFi 热潮中,公链们或殊途而同归
- 查看MySQL数据库的命令