Tutorial :Java exception problem



Question:

I got this exception in time of running a web application in java. What does this mean?

exception.name = javax.servlet.ServletException: BeanUtils.populate  


Solution:1

I guess you are using something which utilizes Jakarta BeanUtils (like Struts) and some method is throwing an exception.

Following may be reasons for same :

  1. The action attribute of an tag must match exactly the path attribute of the action definition in the struts-config.xml file. This is how Struts associates the ActionForm bean with the action.
  2. This error usually occurs when you have specified a form name that does not exist in your tag. For example, you specifiec and 'myForm' is not the name of a form associated with myAction in the struts-config file
  3. You get this message when Struts is unable to map the data in the HTML form to the properties in your ActionForm bean. Make sure each of the properties on your bean is either a String or a boolean. Do you have any properties of type java.util.Date or other objects? That might cause this error. Also check to see that you have public getters and setter for each of your properties.

Check:

http://www.coderanch.com/t/53114/Struts/ServletException-BeanUtils-populate

http://forums.sun.com/thread.jspa?threadID=632599

http://javaexceptions1.blogspot.com/2009/08/javaxservletservletexception.html


Solution:2

A short call to google's famous www-indexer (with:"ServletException: BeanUtils.populate") provided this result:

ServletException BeanUtils populate

The answer to that question over there at coderanch could help to solve your problem


Solution:3

Since this is a Struts related exception (and seeing that we don't know the cause of the exception), here are some possible reasons why you're getting the exception.

  • No Bean Specified. This means that there is no ActionForm defined in your Action.
  • Your bean properties you're copying from doesn't match the bean properties you're matching to.

Unless we know the cause of the exception, you'll just have to debug your code and see what is the fault.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »