WCS7升级后webservice失效
问题
升级WCS7后,发现以前为WCS6写的webservice全部失效。
以如下URL为例:
系统日志为:
[2/9/12 11:36:04:045 CST] 000000a5 webcontainer E com.ibm.ws.webcontainer.WebContainer handleRequest SRVE0255E: A WebGroup/Virtual Host to handle /webapp/wcs/services/RemoteRegistrantServiceCaller has not been defined.
soupUI的返回测试结果为:
<H1>SRVE0255E: A WebGroup/Virtual Host to handle /webapp/wcs/services/RemoteRegistrantServiceCaller has not been defined.</H1>
<BR>
<H3>SRVE0255E: A WebGroup/Virtual Host to handle cnsha05nb70810.apac.xxx.com:80 has not been defined.</H3>
<BR>
<I>IBM WebSphere Application Server</I>
分析
现象很明显,原因就是找不到webservice。
根据IBM文档,所有webservice应该都在WebServicesRouter 中。(映射的URI为“/webapp/wsc/”)
The WebServicesRouter Web module is mapped to the context root /webapp/wcs. The Web services runtime appends /services/ port type to get the complete URI. The port type is defined in the WSDL where the Web service is declared.
而WebServicesRouter模块也已正常载入,如下:
[2/10/12 10:16:47:951 CST] 00000009 webapp I com.ibm.ws.webcontainer.webapp.WebGroupImpl WebGroup SRVE0169I: Loading Web Module: WebServicesRouter.
[2/10/12 10:17:00:815 CST] 00000009 WASSessionCor I SessionContextRegistry getSessionContext SESN0176I: Will create a new session context for application key WC_default_hostWebServicesRouter
[2/10/12 10:17:06:077 CST] 00000009 servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [WC] [/WebServicesRouter] [com_xxx_service_gcmc_remote_RemoteAddressServiceCaller]: Initialization successful.
[2/10/12 10:17:06:078 CST] 00000009 servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [WC] [/WebServicesRouter] [com_xxx_service_gcmc_remote_RemoteBulkServiceCaller]: Initialization successful.
[2/10/12 10:17:06:079 CST] 00000009 servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [WC] [/WebServicesRouter] [com_xxx_service_gcmc_remote_RemoteTaskServiceCaller]: Initialization successful.
[2/10/12 10:17:06:080 CST] 00000009 servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [WC] [/WebServicesRouter] [OpenWebServiceBinding]: Initialization successful.
[2/10/12 10:17:06:082 CST] 00000009 servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [WC] [/WebServicesRouter] [com_xxx_service_users_UserAccountService]: Initialization successful.
[2/10/12 10:17:06:083 CST] 00000009 servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [WC] [/WebServicesRouter] [com_xxx_service_address_xxxUpdateAddressService]: Initialization successful.
[2/10/12 10:17:06:084 CST] 00000009 servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [WC] [/WebServicesRouter] [com_xxx_service_gcmc_remote_RemoteSponsorServiceCaller]: Initialization successful.
[2/10/12 10:17:06:086 CST] 00000009 servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [WC] [/WebServicesRouter] [com_xxx_service_gcmc_remote_RemoteRegistrantServiceCaller]: Initialization successful.
[2/10/12 10:17:06:087 CST] 00000009 servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [WC] [/WebServicesRouter] [com_xxx_service_gcmc_remote_RemoteUserManagementServiceCaller]: Initialization successful.
[2/10/12 10:17:06:088 CST] 00000009 webcontainer I com.ibm.ws.wswebcontainer.VirtualHost addWebApplication SRVE0250I: Web Module WebServicesRouter has been bound to WC_default_host[*:80,*:443,*:8000,*:8002,*:8004,*:8006,*:8007].
这就让人对webservice加载失败的问题搞得有点摸不着头脑。
解决办法
经过一番捣鼓,发现此问题是WC/META-INF/application中,contex-root的配置错误造成的。
升级WCS7后,context-root变为“WebServicesRouter”。
<module id="Module_1320962769266">
<web>
<web-uri>WebServicesRouter.war</web-uri>
<context-root>WebServicesRouter</context-root>
</web>
</module>
将其改为“/webapp/wcs”即能解决问题。
<module id="Module_1320962769266">
<web>
<web-uri>WebServicesRouter.war</web-uri>
<context-root>/webapp/wcs</context-root>
</web>
</module>