概述
最近在部署Server方面碰到了一个非常棘手的问题,在WAS5.1上部署App server成功没有任何异常,客户端连接和操作没有任何问题。当用到了一个特殊的服务时,出现了问题,这个服务又和Web Service相关,项目里用到了Web Service作为另一部分的业务支持。但是有意思的是在RAD+WAS Test Environment的开发环境下没有一点问题,却偏偏在本地QA环境下不行。后来发现请求wsdl文件时也会出类似异常。
本地QA环境如下:(真实QA环境部署在Soloris下)
OS: Windows XP
软件架构:WAS 5.1+Sonic MQ6.1 + Oracle10g (全部都是单服务器)
XFire 1.2.5
抛出异常:
[Servlet Error]-[org/codehaus/xfire/xmlbeans/XmlBeansWSDLBuilder]: java.lang.NoClassDefFoundError: org/codehaus/xfire/xmlbeans/XmlBeansWSDLBuilder
at org.codehaus.xfire.xmlbeans.XmlBeansWSDLBuilderFactory.createWSDLBuilder(XmlBeansWSDLBuilderFactory.java:20)
at org.codehaus.xfire.wsdl11.builder.WSDLBuilderAdapter.write(WSDLBuilderAdapter.java:40)
at org.codehaus.xfire.DefaultXFire.generateWSDL(DefaultXFire.java:104)
at org.codehaus.xfire.transport.http.XFireServletController.generateWSDL(XFireServletController.java:380)
at org.codehaus.xfire.transport.http.XFireServletController.doService(XFireServletController.java:125)
at org.codehaus.xfire.transport.http.XFireServlet.doGet(XFireServlet.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:974)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:555)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:443)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
看到这个异常一般大家都会以为是classpath没配置好或者缺少相应jar包。我也是这么做的,于是检查了下,但是该jar确实存在,classpath理论上没有问题。于是重新打包重新部署,几次折腾之后,异常出现了变化:
E SRVE0026E: [Servlet Error]-[Provider null could not be instantiated: java.lang.NullPointerException]: javax.xml.stream.FactoryConfigurationError: Provider null could not be instantiated: java.lang.NullPointerException
at javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:75)
at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:136)
at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:92)
at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:136)
at at org.codehaus.xfire.util.STAXUtils.<clinit>(STAXUtils.java:48).null(Unknown Source)
at org.codehaus.xfire.util.jdom.StaxBuilder.<init>(StaxBuilder.java:150)
at at org.codehaus.xfire.wsdl.AbstractWSDL.<clinit>(AbstractWSDL.java:43).null(Unknown Source)
at org.codehaus.xfire.xmlbeans.XmlBeansWSDLBuilderFactory.createWSDLBuilder(XmlBeansWSDLBuilderFactory.java:20)
at org.codehaus.xfire.wsdl11.builder.WSDLBuilderAdapter.write(WSDLBuilderAdapter.java:40)
at org.codehaus.xfire.DefaultXFire.generateWSDL(DefaultXFire.java:104)
at org.codehaus.xfire.transport.http.XFireServletController.generateWSDL(XFireServletController.java:380)
at org.codehaus.xfire.transport.http.XFireServletController.doService(XFireServletController.java:125)
at org.codehaus.xfire.transport.http.XFireServlet.doGet(XFireServlet.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:974)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:555)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
这次没辙了,Google了下,发现中文资料还真是稀少(用这种架构的不多,毕竟都是狂贵的东东),在一堆英文网页里挖掘发现还是有人碰到类似的问题,其中MS有个是IBM的人说把WAS里java/jre/lib里的两个properties文件:jaxp.properties和Xerces.properties里最下面被注释的属性去掉注释,给设置回来可以解决。看了下,是下面三行属性设置。
#javax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl
#javax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
#javax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
看这些类还真像回事,蛮以为去掉注释,哈雷路亚搞定了,不想,试了下还是不行。继续搜索着偶然发现了下面的一段话:
I've seen some posts which relate to this issue, so I've tried to add an '
xml.stream.properties' file with these settings:
javax.xml.stream.XMLInputFactory=com.ctc.wstx.stax.WstxInputFactory
javax.xml.stream.XMLOutputFactory=com.ctc.wstx.stax.WstxOutputFactory
javax.xml.stream.XMLEventFactory=com.ctc.wstx.stax.WstxEventFactory
into my web app lib directory, but I'm still getting the error.
想了想,把他的属性设置拷贝进那个IBM的人说的两个文件的,然后stop server,保存文件,重启server,再试了一次,OK搞定,yeah!
但是想不通的是,在RAD的开发环境里也是一样的设置,为什么那个没有问题。由于IBM的那套东西不能debug,折腾这个剩下的矛盾已没有意义。WAS6已经出来,希望在新的版本平台上没有这个问题:-)
最后
以上就是虚心裙子为你收集整理的XFire在Websphere Application Server5.1里运行的空指针异常的解决的全部内容,希望文章能够帮你解决XFire在Websphere Application Server5.1里运行的空指针异常的解决所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复