Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

No Bean Specified

 
raghuveer mandal
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am presently working on remediation from struts 1.0 to struts 1.2.8. Application is currenty working nicely on struts 1.0. I have deployed the application successfully in struts 1.2.8. I have one screen where i am using same action and action form to load and save the data. Loading the page is happening properly but when i click on save i am getting the following error.

java.lang.IllegalArgumentException: No bean specified
at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUtils.java:819)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:846)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:726)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)
at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:804)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
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:225)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:272)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:165)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3153)
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:1973)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1880)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1310)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)

If anybody has faced the same problem and able to solve the problem, Please help me out. Thanks in advance.
Raghuveer Mandal
 
Raghavendra nandavar
Ranch Hand
Posts: 231
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I faced the similer type of problem some time back, It occurs due
to a property or the datatype of the property mismatch, check the
form bean and its data type. I was trying to set an arrayList property (by mistake )to a textFeild, which gave such error.
 
Tauqueer Ali
Ranch Hand
Posts: 53
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raghavendra,
Can you show us some examples about how you resovled this issue. I'm facing exact same issue.


Raghuveer,
Were you able to resolve your issue. I'm migrating my struts app from 1.0 to 1.2.8 and am facing the exact issue that you mentioned. I doubt if we have to make any code changes since the app was working fine in 1.0. I believe it has something to do with some configuration settings. Some defualt value set in web.xml or struts-config.xml needs to be tweaked in or something. Please let me know if you have some ideas.


Thanks
Tauqueer
 
Y Miyamoto
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To my knowledge this error never occured in Struts 1.0.
In Struts 1.1 and higher this can occur when the data hasn't Explicitly been put into the Session.



In the simplest form, all your Action and Form Beans need to be modified to place and retrieve the data from the session. If the values being submitted by the form include nulls, then these need to be initialised in the Form.



Keep the retrieved value in the Session and retrieve it back into the Form Bean from the session from your reset() method in the Form.

MyFooBarActionForm

HttpSession session = aRequest.getSession(false);
session.setAttribute("fooTOsList", fooTOsLists);


MyFooBarActionForm

public void reset(ActionMapping aMapping, HttpServletRequest aRequest)
{
if(getFooTOs() == null || getFooBarTOs().size() == 0)
{
HttpSession vSession = aRequest.getSession();
if (vSession != null && vSession.getAttribute("fooTOsList") != null)
{
this.fooTOs = (Collection) vSession.getAttribute("fooTOsList");
}
}
}
 
Tauqueer Ali
Ranch Hand
Posts: 53
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Miyamoto,
All the beans have a scope='request' defined in my struts-config. When I changed the scope to session, the Bean not Found exception stopped occurring. This seems to have resolved our issue. However, my concern is that our form beans are very large objects and putting these in sessions may not be a very good idea. Our framework tries to avoid putting the objects in session by passing them as hidden variables and that's the reason why scope of all the beans is set to request. Now, replacing the request scope to session will go against the previously designed framework and there could be impact on performance.

Please let me know your veiws. Is this a norm or is it a problem specific to certain frameworks.

Thanks,
Tauqueer
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An alternative to putting ActionForms in session scope is "lazy initialization". This means rebuilding whatever structure of arrays and Lists in the bean that need to be there as they are called for.

Here is a link that explains how to do this.
 
Tauqueer Ali
Ranch Hand
Posts: 53
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a number of hidden form fields that on jsps. However, the action form attached to this jsp doens't have mapping properties for these form fields. It seems struts is trying to put these fields into action form but doens't find a place holder. Changing the action form to accomodate these hidden form fields doens't seem to be an option for us. Is there a way we can tell struts not to populate the action form with these form fileds which are defined as hidden form fields in jsps.
 
hild cozzy
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am having the same issue with my application. Just wanted to know if this could happen due to Java or tomcat version ?
I am having the same struts code running on tomcat 6 with JDK 1.5 while the branch running with Java 7 + tomcat 6 is throwing this exception.
Any help will be highly appreciated.

Thanks
 
karthick meyyappan
Ranch Hand
Posts: 43
MyEclipse IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Just a answer from myside. am not strongly saying this point. while using java7 most of the problem i faced while from the installation onwards to till the end.
just my hope.

dont awake the sleep threads., start up a new thread.
someone put some valid point, on this.

thanks.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic