BeanUtils.populate IllegalArgumentException: array element type mismatch

type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: BeanUtils.populate
 org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
 org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816)
 org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
 org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
 org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
root cause
java.lang.IllegalArgumentException: array element type mismatch
 java.lang.reflect.Array.set(Native Method)
 org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java:464)
 org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:986)
 org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811)
 org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298)
 org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)
 org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816)
 org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
 org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
 org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:729)


Answer : reason is, in your form bean there is any variable is miss match to your html page.
For Example : If you have any text box for date in html or jsp page and java.lang.Date type variable in form bean, so change the java.lang.Date type variable to java.lang.String type variable in your form bean.
Explaination:- Through html or jsp page you can set the values in primitive data type and it wrapper class data type in form bean only .

Comments

Post a Comment

Recent Post

Recent Posts Widget

Popular posts from this blog

Capture image from webcam java code, examples

How to capture finger prints in java

Shallow Copy Deep Copy Java example