ERROR 07 七月 2010 22:30:49 [org.apache.struts.util.RequestUtils] [createActionForm] - Error creating form bean of class com.baidu.manageSystem.machineRoom.controller.BeneficiaryForm 
java.lang.NullPointerException
at org.apache.struts.config.FormBeanConfig.createActionForm(FormBeanConfig.java:212)
at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:292)
at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:191)
at org.apache.struts.action.RequestProcessor.processActionForm(RequestProcessor.java:331)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:202)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.baidu.manageSystem.common.filter.EncodingFilter.doFilter(EncodingFilter.java:32)
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:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
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:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
2010-7-7 22:30:49 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet action threw exception
java.lang.IllegalArgumentException: No destination bean specified
at com.baidu.manageSystem.common.util.MyBeanUtils.convert(MyBeanUtils.java:150)
at com.baidu.manageSystem.common.util.MyBeanUtils.copyBean2Bean(MyBeanUtils.java:133)
at com.baidu.manageSystem.machineRoom.controller.BeneficiaryAction.ShowAll(BeneficiaryAction.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.baidu.manageSystem.common.filter.EncodingFilter.doFilter(EncodingFilter.java:32)
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:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
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:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
WARN  07 七月 2010 22:30:49 [org.apache.struts.action.RequestProcessor] [processException] - Unhandled Exception thrown: class java.lang.IllegalArgumentException
这 错误谁遇到过,说下经验

解决方案 »

  1.   

    //所有数据显示
    public ActionForward ShowAll(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response) throws Exception {
    BeneficiaryForm f = (BeneficiaryForm) form;
    Beneficiary room = new Beneficiary();
    MyBeanUtils.copyBean2Bean(f, room, true);
    List beneficiaryList =beneficiaryDao.queryAll();
    if(beneficiaryList!=null){
    request.setAttribute("beneficiaryList",beneficiaryList);
    }
    return indexPage_show(mapping, form, request, response);
    }
      

  2.   

    严重: Servlet.service() for servlet action threw exception
    java.lang.IllegalArgumentException: No destination bean specified
    没有指定目标BEAN。 报空指针的错
      

  3.   

    MyBeanUtils.copyBean2Bean(f, room, true);
    List beneficiaryList =beneficiaryDao.queryAll();
    估计在在两个方法里面,贴出来的代码好像没有出现NullPointerException的可能;
    NullPointerException出先在实例调用方法或属性时右实例为Null引起的.如user.login();中user为null的时候就会出现NullPointerException
      

  4.   

    把对应的Form和jsp代码贴出来大概就知道了
      

  5.   

    form/*
     * Generated by MyEclipse Struts
     * Template path: templates/java/JavaClass.vtl
     */
    package com.baidu.manageSystem.machineRoom.controller;import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionMapping;import com.baidu.manageSystem.common.base.BaseForm;/** 
     * MyEclipse Struts
     * Creation date: 06-04-2010
     * 
     * XDoclet definition:
     * @struts.form name="beneficiaryForm"
     */
    public class BeneficiaryForm extends BaseForm {
    /*
     * Generated fields
     */ /**
     * 
     */
    private static final long serialVersionUID = 1L; /** id property */
    private String id; /** name property */
    private String name; /*
     * Generated Methods
     */ /** 
     * Method validate
     * @param mapping
     * @param request
     * @return ActionErrors
     */
    public ActionErrors validate(ActionMapping mapping,
    HttpServletRequest request) {
    // TODO Auto-generated method stub
    return null;
    } /** 
     * Method reset
     * @param mapping
     * @param request
     */
    public void reset(ActionMapping mapping, HttpServletRequest request) {
    // TODO Auto-generated method stub
    } /** 
     * Returns the id.
     * @return String
     */
    public String getId() {
    return id;
    } /** 
     * Set the id.
     * @param id The id to set
     */
    public void setId(String id) {
    this.id = id;
    } /** 
     * Returns the name.
     * @return String
     */
    public String getName() {
    return name;
    } /** 
     * Set the name.
     * @param name The name to set
     */
    public void setName(String name) {
    this.name = name;
    }
    }jsp<%@page contentType="text/html;charset=GBK"%>
    <%@page import="java.util.*,com.baidu.manageSystem.machineRoom.dto.*"%><html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=GBK">
    <title>User management interface</title>
    <style type="text/css">
    <!--
    .style1 {
    font-weight: bold;
    }
    -->
    </style>
    </head>
    <script>
    document.getElementById("a").readOnly = false;
    document.getElementById("b").readOnly = false;
    document.getElementById("c").readOnly = false;
    document.getElementById("d").readOnly = false;
    document.getElementById("1").readOnly = false;
    document.getElementById("2").readOnly = false;
    document.getElementById("3").readOnly = false;
    document.getElementById("4").readOnly = false;
    /**
    *用第二个表单执行修改、删除、批量修改、批量删除)
    */
    function doSubmit(url){
    document.forms[0].action = url;
    document.forms[0].submit();
    }
    /**
    *按主键删除
    */
    function doDelete(id){
    if (countMultichoice() < 1){
    alert("请选择数据行");
    return;
    }
    var bool = window.confirm("确定删除吗?");
    if (bool){
    var url = '${pageContext.request.contextPath}/beneficiary.do?menu=deleteById&id='+id;
    doSubmit(url);
    }
    }

    /**
    *批量修改
    */
    function doUpdateBulk(){
    if (countMultichoice() < 1){
    alert("请选择数据行");
    return;
    }
    var bool = window.confirm("确定修改选中变量吗?");
    if (!bool){
    return;
    }
    var url = '${pageContext.request.contextPath}/beneficiary.do?menu=modifyBulkDo';
    document.forms[0].code.disabled = false; 
    document.forms[0].user.disabled = false;
    document.forms[0].enname.disabled = false;
    document.forms[0].chname.disabled = false; 
    document.forms[0].password.disabled = false;
    document.forms[0].sex.disabled = false;
    document.forms[0].tel.disabled = false; 
    document.forms[0].mobile.disabled = false;
    document.forms[0].email.disabled = false;
    document.forms[0].idnumber.disabled = false;
    document.forms[0].position.disabled = false; 
    document.forms[0].photo.disabled = false;
    document.forms[0].closed.disabled = false;

    document.forms[0].code.value = ''; 
    document.forms[0].user.value = ''; 
    document.forms[0].enname.value = '';
    document.forms[0].chname.value = ''; 
    document.forms[0].password.value = ''; 
    document.forms[0].sex.value = '';
    document.forms[0].tel.value = ''; 
    document.forms[0].mobile.value = ''; 
    document.forms[0].email.value = '';
    document.forms[0].idnumber.value = ''; 
    document.forms[0].position.value = ''; 
    document.forms[0].photo.value = '';
    document.forms[0].closed.value = ''; 

    doSubmit(url);
    }
    /**
    *全选
    */
    function selectAll(box, multichoiceName){
    var objs = document.getElementsByName(multichoiceName);
    for (var i=0; i<objs.length; i++){
    objs[i].checked = box.checked;
    }
    }
    /**
    *计算选中的复选框
    */
    function countMultichoice(){
    var sum = 0;
    var objs = document.getElementsByName('multichoice');
    for (var i=0; i<objs.length; i++){
    if (objs[i].checked){
    sum++;
    }
    }
    return sum;
    }
    </script> 
    <!--获取已有-->
    <% 
    List beneficiaryList = (List)request.getAttribute("beneficiaryList");int m = 0;
    %><body>
    <form name="form1" action="" method="post">
      <table width="844" border="1" height="400" cellpadding="0" cellspacing="0" bordercolor="#CCFFFF" frame=void>
        <tr>
          <td height="38" colspan="7"><div align="center"><span class="style1">消息提示:${msg}</span></div></td>
        </tr>
        <tr>
        <td width="42" height="24">choose</td>
        <td width="105" height="24">Id</td>
        <td width="105" height="24">Name</td>
        
        
       
      </tr>
      <%
      //循环输出用户基本信息
      for (int i = 0; beneficiaryList != null && i < beneficiaryList.size(); i++) {
       Beneficiary beneficiary = (Beneficiary)beneficiaryList.get(i);
       m++;
      %>
        <tr>
          <td height="24"><input id="a" type="checkbox" name="checkbox" value="<%=i%>" readOnly></td>
          <input id="b" type="hidden" name="Id<%=i%>" size="15" value="<%=beneficiary.getId()%>" readOnly>
      <td height="24"><input id="c" type="text" name="Id<%=i%>" size="15" value="<%=beneficiary.getId()%>" readOnly></td>
      <td height="24"><input id="d" type="text" name="name<%=i%>" size="15" value="<%=beneficiary.getName()%>" readOnly></td>
        </tr>
        <%
      }
      %>
      <!--始终保持一个空行以供输入-->
      <tr>
         <td height="24"><input id="1" type="checkbox" name="checkbox" value="<%=m%>" readOnly></td>
          <input id="2" type="hidden" name="Id<%=m%>" size="15" value="" readOnly>
      <td height="24"><input id="3" type="text" name="Id<%=m%>" size="15" value="" readOnly></td>
      <td height="24"><input id="4" type="text" name="name<%=m%>" size="15" value="" readOnly></td>
        </tr>
        <tr>
        
        </tr>
        <tr>
          <td colspan="7"><div align="center"></div>        <div align="center">
          
      <a href="/iqcerp/defaultroot/iqcerp/DateAdd/employeeAdd.jsp">
      <img src="file:///D|/My Documents/未命名站点 1/add.jpg">
     </a>
      <%
     
      Beneficiary beneficiary= (Beneficiary)beneficiaryList.get(0);
      String id=beneficiary.getId();
      System.out.println("////");
      System.out.println(id);
       %>
       
           <a href="javascript:doDelete('<%=id%>');"><img src="file:///D|/My Documents/未命名站点 1/refresh.jpg"></a>
       <a href="javascript:doSubmit('${pageContext.request.contextPath}/beneficiary.do?menu=modifyPage&id=<%=id%>')"><img src="file:///D|/My Documents/未命名站点 1/print.jpg"></a>

            </div></td>
        </tr>
      </table>
    </form></body>
    </html>
      

  6.   

    某日,一女遇劫匪,颤抖曰:"俺是搞.net的,刚毕业,工作都没找到,真的没有钱……"
    劫匪听后竟然痛哭流涕,"妹子,俺也是搞.net的,你拿好学生证,前面抢劫的还是搞.net的,你放心,我们绝不抢自己人!"
    之后,此女一路出示学生证,均平安无事,最后碰到一个瘦骨嶙峋的劫匪,硬不放她过去。一番纠缠后,劫匪有气无力的说"就随便打发点也好!我饿得~~快~~ 快~不行了~!"话音刚落,晕倒在地。女抱起劫匪嚎啕大哭"我们搞.net的咋就这么好命苦呀!""妹子,我~~``我是搞java的
      

  7.   

    beneficiaryList能取得到值不?
    还有你的bean在用的时候初始化了没有?
    另外,你设置断点,是很好找到问题的所在的,你要先定位问题在那句话上抛出了这个异常就好改多了。
      

  8.   

    把错误信息,复制后,到google上粘贴,然后查询
      

  9.   

    com.baidu.manageSystem.machineRoom.controller.BeneficiaryForm 这个类有没有
      

  10.   

    这个类的位置似乎是对的,不过这个代码看着好烦,既然是createform失败,那就看看form和他的父类哪里有问题。多用控制台输出,看在哪断的