`
jsx112
  • 浏览: 314958 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

org.apache.axis2.databinding.utils.BeanUtil.getPullParser错误

 
阅读更多
在开发ssh+axis2的webservice应用中,报这个错误。让我纠结了几天,虽然最后终于搞定,但是却浪费了很多时间,因此在此记载下来,为自己勉励,也为后来者提供参考
java.lang.NullPointerException
	at org.apache.axis2.databinding.utils.BeanUtil.getPullParser(BeanUtil.java:279)
	at org.apache.axis2.rpc.receivers.RPCUtil.processResponse(RPCUtil.java:97)
	at org.apache.axis2.rpc.receivers.RPCUtil.processResponseAsDocLitWrapped(RPCUtil.java:437)
	at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:138)
	at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
	at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100)
	at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
	at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
	at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Thread.java:619)
2012-03-28 11:28:27,312 [http-8080-1] ERROR [org.apache.axis2.engine.AxisEngine] - 
org.apache.axis2.AxisFault
	at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
	at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:161)
	at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
	at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100)
	at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
	at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
	at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
	at org.apache.axis2.databinding.utils.BeanUtil.getPullParser(BeanUtil.java:279)
	at org.apache.axis2.rpc.receivers.RPCUtil.processResponse(RPCUtil.java:97)
	at org.apache.axis2.rpc.receivers.RPCUtil.processResponseAsDocLitWrapped(RPCUtil.java:437)
	at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:138)
	... 23 more

   由于要进行客户端和服务器端的数据交互,负责的hibernate的实体对象axis支持不是很好,因此在webservice传输中采用vo进行封装数据。为了完成文件的上传、解析以及把解析结果反馈给客户端,设计ImportResumeResultVo,其关键代码:

public class ImportResumeResultVo{
	private boolean flag =false;	
	private ImportResumeRecordVo[] resumeRecordVos;	private int count=0;					private int successNum;
	private int failNum;
	private int maxImportNum;
	private int currentImportNum;
	private int repeatCount;


               ... ...  // 此处省略了get和set方法

          //引发错误的方法
          public void setResult(ImportResumeRecordVo importresume){
		resumeRecordVos[count] =importresume;
		count++;
	}
}

   正是因为上面的一个set方法导致的错误,在javabean规范中,建议每一个类中的set方法对应的get方法存在。但是在axis的webservice的检测规则中,每一个类中的set方法对应的get方法必须存在,否则将会找不到对应方法。其检测的工具代码部分如下:

Method readMethod = propDesc.getReadMethod();
                    if (property.getGetter() !=null && property.getGetter().isPublic()){
                        readMethod.setAccessible(true);
                    }
                    Object value = readMethod.invoke(beanObject,
                            null);

 

   readMethod如果没有找到,便为null,需要做重新处理。

    

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics