最近公司测试服务器上的WAS通过windows服务管理器进行重启和停止时发现没有作用,虽然看起来像是完成了整个操作,但Java进程不变任然存在,后台stopServer.log报出了错误,如下:
************ Start Display Current Environment ************
Host Operating System is Windows Server 2008, version 6.1 build 7600
Java version = J2RE 1.6.0 IBM J9 2.4 Windows Server 2008 amd64-64 jvmwa6460-20080816_22093 (JIT enabled, AOT enabled)
J9VM – 20080816_022093_LEdSMr
JIT – r9_20080721_1330ifx2
GC – 20080724_AA, Java Compiler = j9jit24, Java VM name = IBM J9 VM
was.install.root = C:\Program Files\IBM\WebSphere\AppServer
user.install.root = C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01
Java Home = C:\Program Files\IBM\WebSphere\AppServer\java\jre
ws.ext.dirs = C:\\Program Files\\IBM\\WebSphere\\AppServer\\java\\lib;C:\\Program Files\\IBM\\WebSphere\\AppServer\\classes;C:\\Program Files\\IBM\\WebSphere\\AppServer\\lib;C:\\Program Files\\IBM\\WebSphere\\AppServer\\installedChannels;C:\\Program Files\\IBM\\WebSphere\\AppServer\\lib\\ext;C:\\Program Files\\IBM\\WebSphere\\AppServer\\web\\help;C:\\Program Files\\IBM\\WebSphere\\AppServer\\deploytool\\itp\\plugins\\com.ibm.etools.ejbdeploy\\runtime
Classpath = C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\properties;C:\Program Files\IBM\WebSphere\AppServer\properties;C:\Program Files\IBM\WebSphere\AppServer\lib\startup.jar;C:\Program Files\IBM\WebSphere\AppServer\lib\bootstrap.jar;C:\Program Files\IBM\WebSphere\AppServer/lib/lmproxy.jar;C:\Program Files\IBM\WebSphere\AppServer/lib/urlprotocols.jar;C:\Program Files\IBM\WebSphere\AppServer\java\lib\tools.jar
Java Library path = C:\Program Files\IBM\WebSphere\AppServer\java\jre\bin\default;C:\Program Files\IBM\WebSphere\AppServer\java\jre\bin;.;C:\Program Files\IBM\WebSphere\AppServer\bin;C:\Program Files\IBM\WebSphere\AppServer\java\bin;C:\Program Files\IBM\WebSphere\AppServer\java\jre\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;
Current trace specification = *=info:com.ibm.*=all
************* End Display Current Environment *************
[14-10-17 15:29:49:312 CST] 00000000 ManagerAdmin I TRAS0017I: 启动跟踪状态是 *=info:com.ibm.*=all。
[14-10-17 15:29:49:343 CST] 00000000 WsServerContr 1 Executing executeUtilityOnWindows with args: C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\config WIN-APKCNRO4348Node01Cell WIN-APKCNRO4348Node01 server1 -fromWinService \\.\pipe\w6SvcPipe_29F1A_15E15 -username wasadmin -password ********
[14-10-17 15:29:49:343 CST] 00000000 WsServerContr 1 invokedByWindowsService has been set to true earlier
[14-10-17 15:29:49:343 CST] 00000000 ManagerAdmin I TRAS0018I: 跟踪状态已更改。新的跟踪状态是 *=info。
[14-10-17 15:29:49:500 CST] 00000000 AdminTool A ADMU0128I: 正在启动具有 AppSrv01 概要文件的工具
[14-10-17 15:29:49:500 CST] 00000000 AdminTool A ADMU3100I: 正在从服务器读取配置:server1
[14-10-17 15:29:49:546 CST] 00000000 ModelMgr I WSVR0801I: 正在初始化所有服务器配置模型
[14-10-17 15:29:51:671 CST] 00000000 SSLConfig W CWPKI0041W: 一个或多个密钥库正在使用缺省密码。
[14-10-17 15:29:51:687 CST] 00000000 SSLConfigMana I CWPKI0027I: 对 HTTPS URL 连接禁用缺省主机名验证。
[14-10-17 15:29:51:703 CST] 00000000 SecurityObjec I Client code attempting to load security configuration
[14-10-17 15:29:53:000 CST] 00000000 SecurityObjec I Client code attempting to load security configuration
[14-10-17 15:29:53:265 CST] 00000000 WsServerStop E ADMU3002E: 尝试处理服务器 server1 时发生异常
[14-10-17 15:29:53:265 CST] 00000000 WsServerStop E ADMU3007E: 异常 javax.management.JMRuntimeException: ADMN0022E: 由于凭证不足或凭证为空,无法对 Server MBean 的 stop 操作进行访问。
[14-10-17 15:29:53:265 CST] 00000000 WsServerStop A ADMU3007E: 异常 javax.management.JMRuntimeException: ADMN0022E: 由于凭证不足或凭证为空,无法对 Server MBean 的 stop 操作进行访问。
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.handleAdminFault(SOAPConnectorClient.java:945)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invokeTemplateOnce(SOAPConnectorClient.java:910)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invokeTemplate(SOAPConnectorClient.java:675)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invokeTemplate(SOAPConnectorClient.java:665)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invoke(SOAPConnectorClient.java:651)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invoke(SOAPConnectorClient.java:473)
at $Proxy0.invoke(Unknown Source)
at com.ibm.ws.management.AdminClientImpl.invoke(AdminClientImpl.java:224)
at com.ibm.ws.management.tools.WsServerStop.sendWaitStop(WsServerStop.java:535)
at com.ibm.ws.management.tools.WsServerStop.runTool(WsServerStop.java:410)
at com.ibm.ws.management.tools.AdminTool.executeUtility(AdminTool.java:272)
at com.ibm.ws.management.tools.WsServerController.executeUtilityOnWindows(WsServerController.java:136)
at com.ibm.ws.management.tools.WsServerStop.main(WsServerStop.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:599)
at com.ibm.wsspi.bootstrap.WSLauncher.launchMain(WSLauncher.java:213)
at com.ibm.wsspi.bootstrap.WSLauncher.main(WSLauncher.java:93)
at com.ibm.wsspi.bootstrap.WSLauncher.run(WSLauncher.java:74)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:599)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:340)
at org.eclipse.core.launcher.Main.basicRun(Main.java:282)
at org.eclipse.core.launcher.Main.run(Main.java:981)
at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:341)
at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:111)
[14-10-17 15:29:53:296 CST] 00000000 AdminTool A ADMU4113E: 验证用户名和密码信息是否正确。如果要从命令行运行工具,请传递正确的 -username 和 -password。或者,更新 <conntype>.client.props 文件。
[14-10-17 15:29:53:296 CST] 00000000 AdminTool A ADMU1211I: 要获取故障的全部跟踪,使用 -trace 选项。
[14-10-17 15:29:53:296 CST] 00000000 AdminTool A ADMU0211I: 在文件 C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\logs\server1\stopServer.log 中可看到错误的详细信息
根据这个错误信息和windows服务管理器查出的信息可以判断wasservice.exe在执行停止WAS操作的时候传递了错误的账号或者密码
sc qc “IBMWAS70Service – WIN-APKCNRO4348Node01”
[SC] QueryServiceConfig 成功
SERVICE_NAME: IBMWAS70Service – WIN-APKCNRO4348Node01
TYPE : 10 WIN32_OWN_PROCESS
START_TYPE : 2 AUTO_START
ERROR_CONTROL : 1 NORMAL
BINARY_PATH_NAME : “C:\Program Files\IBM\WebSphere\AppServer\bin\wasse
rvice.exe” “IBMWAS70Service – WIN-APKCNRO4348Node01”
LOAD_ORDER_GROUP :
TAG : 0
DISPLAY_NAME : IBM WebSphere Application Server V7.0 – WIN-APKCNRO
4348Node01
DEPENDENCIES :
SERVICE_START_NAME : LocalSystem
那么既然找到问题所在,就要想办法修改这个密码了,根据提示到<profile_home>\properties修改<conntype>.client.props发现符合条件的有两个,一个是SOAP一个sas,查询得知wasservice.exe在执行停止WAS操作时默认使用的是SOAP连接方式,这个通过WAS报出的错误信息也可以得以验证
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.handleAdminFault(SOAPConnectorClient.java:945)
于是修改了soap.client.props的两个属性分别如下:
com.ibm.SOAP.loginUserid=username
com.ibm.SOAP.loginPassword=password
修改完密码后考虑到明文储存存在安全隐患,于是通过<profile_home>\PropFilePasswordEncoder.bat将密码进行加密,执行命令如下:
<profile_home>\PropFilePasswordEncoder.bat ..\properties\soap.client.props com.ibm.SOAP.loginPassword -noBackup
再打开该文件时发现密码已经被加密了
com.ibm.SOAP.loginPassword={xor}Lz4sLCgwLTs=
于是,在命令行调用<profile_home>\topServer.bat就不需要再输入密码了,但是使用wasservice.exe执行停止WAS的操作时任然报出同样的错误,查看wasservice.exe的帮助文档,发现该程序停止WAS所使用的密码并不是引用的<profile_home>\properties\soap.client.props文件中的密码,而是在之前安装WAS时已经指定好了,这时候我突然想起来,管理员密码在WAS安装之后进行过一次修改,于是使用命令修改停止WAS时指定的用户名和密码
WASService.exe -add “WIN-APKCNRO4348Node01” -serverName server1 -profilePath “C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01” -stopArgs “-username wasadmin -password password” -encodeParams
这个命令需要注意的是当add参数后面跟着的serviceName已经存在的时候,执行的是update操作,到这里这个问题就算是解决了,使用windows服务管理时停止和重启操作也是真是有效的了。最终原因分析是因为安装WAS之后,对管理员密码进行了一次修改操作,而wasservice.exe调用的密码就是过时的了,所以才会出现凭证无效的情况。