What are the possible causes for throwing a "No bean specified Error" in Struts 1.1?

What would be some of the possible causes for throwing this error running Struts 1.1 in a web app? The stacktrace from my IDE console window is shown below:

java.lang.IllegalArgumentException: No bean specified at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUtils.java:837) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:934) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:223) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3245) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2003) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1909) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1359) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209) at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)

-------------Problems Reply------------

This is most likely thrown by the org.apache.commons.beanutils.PropertyUtils class trying to access properties from a bean which is null. Your ActionForm might be that bean.

Do you have an ActionForm defined for your Action? Check your struts-config.xml file and see if the name attribute of the <action> tag references a <form-bean>.

You are not providing enough information here, so I can only guess. You should post the stacktrace too.

EDIT: There is one other thing you could check for. From the stacktrace it seems your Action form is OK (I don't think you would have gotten so deep in the call if the form was null) but it might be something on the form.

Are you using nested properties or setting something on a bean on the form, a case like :

public class MyAction extends ActionForm {
private SomeBean innerBean;
...
public SomeBean getInnerBean() {
return this.innerBean;
}
}

If in your JSP you specified form.innerBean.someProperty when you submit a value for this, Struts will try to do something like a form.getInnerBean().setSomeProperty(...). If the part form.getInnerBean() is null, Struts will complain before you get NullPointerException.

A solution for this kind of things is to change:

public class MyAction extends ActionForm {
private SomeBean innerBean;
...
}

to

public class MyAction extends ActionForm {
private SomeBean innerBean = new SomeBean();
...
}

Might this be the cause?

Category:java Views:0 Time:2010-05-05
Tags: java struts

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.102 (s). 11 q(s)