将axis2-1.3部署到websphere6.0上遇到了不少问题,下面就记录我所遇到的问题以及解决办法。
1、使用java2wsdl工具生成wsdl文件,再使用wsdl2java工具生成服务器端代码,将所有代码编译打包成aar文件,最后使用axis2的管理控制台上传aar文件,结果出现无法发布服务的异常。上网查资料,得知要想正确部署使用wsdl2java生成的服务器端,必须在服务器的classpath里包含wsdl4j.jar文件,且版本必须在1.5以上。在axis2-1.3-war的WEB-INF/lib文件夹里有一个wsdl4j-1.6.2.jar文件,而websphere的lib文件夹里也有一个wsdl4j.jar文件,该文件的版本是1.4.x的。问题就出在websphere没有使用axis2-1.3-war的WEB-INF/lib文件夹里那个wsdl4j-1.6.2.jar文件,而是使用了自带的wsdl4j.jar文件。要想解决该问题,必须在websphere的管理控制台设置应用程序的类载入方式。具体设置方法:应用程序-企业应用程序-axis2_war(我的应用程序名)-类装入和文件更新检测,将类载入器方式设置为最后装入父类;应用程序-企业应用程序-axis2_war(我的应用程序名)-web模块-axis2.war(我的web模块名),将类载入器方式设置为最后装入父类。
2、完成第一步后使用web浏览器访问axis2,结果发现无法使用axis2。查看websphere的日志。出现了以下异常:
未捕捉到 service() 异常的根本原因 /axis2-web/HappyAxis.jsp:java.lang.ExceptionInInitializerError
at com.ibm._jsp._HappyAxis.invokeTheService(_HappyAxis.java:353)
at com.ibm._jsp._HappyAxis._jspService(_HappyAxis.java:501)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:88)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:629)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:117)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionServletWrapper.handleRequest(JSPExtensionServletWrapper.java:171)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionProcessor.handleRequest(JSPExtensionProcessor.java:230)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2841)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1681)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:421)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:367)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:94)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)
Caused by: org.apache.commons.logging.LogConfigurationException: The chosen LogFactory implementation does not extend LogFactory. Please check your configuration. (Caused by java.lang.ClassCastException: The application has specified that a custom LogFactory implementation should be used but Class 'com.ibm.ws.commons.logging.TrLogFactory' cannot be converted to 'org.apache.commons.logging.LogFactory'. The conflict is caused by the presence of multiple LogFactory classes in incompatible classloaders. Background can be found in http://jakarta.apache.org/commons/logging/tech.html. If you have not explicitly specified a custom LogFactory then it is likely that the container has set one without your knowledge. In this case, consider using the commons-logging-adapters.jar file or specifying the standard LogFactory from the command line. Help can be found @http://jakarta.apache.org/commons/logging/troubleshooting.html.)
at org.apache.commons.logging.LogFactory.createFactory(LogFactory.java:1200)
at org.apache.commons.logging.LogFactory$2.run(LogFactory.java:994)
at java.security.AccessController.doPrivileged1(Native Method)
at java.security.AccessController.doPrivileged(AccessController.java(Compiled Code))
at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:991)
at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:572)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:645)
at org.apache.axis2.context.ConfigurationContextFactory.<clinit>(ConfigurationContextFactory.java:50)
... 22 more
Caused by: java.lang.ClassCastException: The application has specified that a custom LogFactory implementation should be used but Class 'com.ibm.ws.commons.logging.TrLogFactory' cannot be converted to 'org.apache.commons.logging.LogFactory'. The conflict is caused by the presence of multiple LogFactory classes in incompatible classloaders. Background can be found in http://jakarta.apache.org/commons/logging/tech.html. If you have not explicitly specified a custom LogFactory then it is likely that the container has set one without your knowledge. In this case, consider using the commons-logging-adapters.jar file or specifying the standard LogFactory from the command line. Help can be found @http://jakarta.apache.org/commons/logging/troubleshooting.html.
at org.apache.commons.logging.LogFactory.createFactory(LogFactory.java:1149)
... 29 more
原来是websphere的日志系统在捣蛋。在apache的commons-logging项目的网站上有该问题的说明。可以通过设置websphere的环境变量来解决,具体设置方法是:服务器-应用程序服务器-server1(我的应用程序服务器名)-java和进程管理-进程定义-java虚拟机-定制属性,添加一个条目,名称为 org.apache.commons.logging.LogFactory,值为org.apache.commons.logging.impl.LogFactoryImpl。最后重启websphere。
3、完成第二步后使用web浏览器访问axis2,当点击validate链接时出现错误,查看websphere日志,显示以下异常:
java.lang.ClassCastException: org.apache.xerces.jaxp.SAXParserFactoryImpl
at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)
at com.ibm.websphere.product.xml.BaseFactory.createReader(BaseFactory.java:257)
at com.ibm.websphere.product.xml.BaseFactory.load(BaseFactory.java:183)
at com.ibm.websphere.product.xml.BaseFactory.load(BaseFactory.java:175)
at com.ibm.websphere.product.WASProduct.loadVersionInfo(WASProduct.java:1956)
at com.ibm.websphere.product.WASProduct.getVersionInfo(WASProduct.java:1908)
at com.ibm.websphere.product.WASProduct.getPlatform(WASProduct.java:900)
at com.ibm.ws.webcontainer.webapp.WebApp.getServerInfo(WebApp.java:1992)
at com.ibm.ws.webcontainer.facade.ServletContextFacade.getServerInfo(ServletContextFacade.java:192)
at com.ibm._jsp._HappyAxis._jspService(_HappyAxis.java:514)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:88)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:629)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:117)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionServletWrapper.handleRequest(JSPExtensionServletWrapper.java:171)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionProcessor.handleRequest(JSPExtensionProcessor.java:230)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2841)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1681)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:421)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:367)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:94)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)
后来我发现在websphere的java/jre/lib目录下有一个xml.jar文件,该文件包括xalan、xerces以及xml-apis这三个项目。而在axis2-1.3-war的WEB-INF/lib文件夹里也有这三个项目的jar文件。因此我就将axis2-1.3-war的WEB-INF/lib文件夹里的那三个jar文件删除了。结果问题解决。
4、当向服务器传递经过签名并加密的消息后,却收到了“security processing failed”异常消息。经过调查,发现是wss4j-1.5.3.jar文件的问题。于是下载了wss4j-1.5.3的源代码。原来,要想正常使用wss4j-1.5.3,除了axis2-1.3-war的WEB-INF/lib文件夹里的jar文件以及rampart-1.3所提供的jar文件外,还必须两个jar文件,axis-1.4.jar和axis-jaxrpc-1.4.jar。
axis2部署到websphere问题
最新推荐文章于 2024-08-31 17:17:30 发布