File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes IndexOutOfBounds in BeanUtils.Populate() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "IndexOutOfBounds in BeanUtils.Populate()" Watch "IndexOutOfBounds in BeanUtils.Populate()" New topic
Author

IndexOutOfBounds in BeanUtils.Populate()

Amit Gupta
Greenhorn

Joined: Feb 27, 2006
Posts: 1
We are having a jsp page in which we are having struts <Logic:iterate tag for dispaying table
Inside that logic iterate each row is having check box
Now when session times out and user submit jsp page by selecting one or more than one check box index out of bounds exception is comming in BeanUtils.Populate()


HTTP Status 500 -

--------------------------------------------------------------------------------

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:805)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)


root cause

java.lang.ArrayIndexOutOfBoundsException
java.lang.reflect.Array.get(Native Method)
org.apache.commons.beanutils.PropertyUtilsBean.getIndexedProperty(PropertyUtilsBean.java:437)
org.apache.commons.beanutils.PropertyUtilsBean.getIndexedProperty(PropertyUtilsBean.java:340)
org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:684)
org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:715)
org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:884)
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:805)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.9
[ February 27, 2006: Message edited by: Bear Bibeault ]

Amit Gupta
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61101
    
  66

Since the problem seems to involve Struts tags, moved to that forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
My guess is this...since I see by the dump that you are using indexed properties: When your page displayed your form had a populated array or List...I am guessing that you are storing your forms as session scope...when the session expires the form with the populated List goes away as well...when you submit the form Struts creates a new instance of your form, but the List is now null (or empty)...the exception is then thrown when Struts tries to access indexes that no longer exist.

You could try some code like this:


- Brent
 
 
subject: IndexOutOfBounds in BeanUtils.Populate()