• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts: No getter method for property... (but not the usual suspects)

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
recently upgraded a webapp from struts 1.1b2 to 1.2.4, code that previously worked:

now chokes:

spent quite a lot of time looking at the interfaces, consulting struts doc, scratching head, etc. googled the issue and found lots of cases where the property was incorrectly specified, breaking the introspection, or the get and set dealt w/ diff types. but that's not the case here.

tried several things, trying to get head around the problem. this variation works fine, but does not explain why bean:write cannot find the appropriate getter:

added other attrs to the tag based on struts doc. still, the error persists:

this worked. the toString of the activity was called, but still the tru answer was not revealed:



here is the interface and impl for reference (javadoc, etc removed):


found a bean dump util on struts wiki. used it in jsp, hoping to get insight:

the util uses java.beans.Introspector.getBeanInfo(). it resulted in this output (and then followed by the same "No getter..." exception when it hit the bean:write):

doing this did not shed new light on the issue. according to the Java bean inspection classes, everything looks fine. further, the code did work previously. any help is greatly appreciated!

[ October 27, 2004: Message edited by: Erick Reid ]

[ October 27, 2004: Message edited by: Erick Reid ]

[ October 27, 2004: Message edited by: Erick Reid ]

[ October 27, 2004: Message edited by: Erick Reid ]

[ October 27, 2004: Message edited by: Erick Reid ]
[ October 27, 2004: Message edited by: Erick Reid ]
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you not have getID() method.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
good eye! actually, i do have a getID() method. it is on the class which Activity extends. the bean dump util saw it too, but i had omitted it from the output snippet in the original posting.

but accessing the ID is not the problem. the issue ("No getter for property name on bean activity") arrises only with <bean:write name="activity" property="name"/>. this code however: <%= activity.getName() %>, works just fine.

am certain that using <bean:write name="activity" property="ID"/> would exhibit the same problem as the use of bean:write to access the name attribute. in fact, i tried <bean:write name="activity" property="description"/> and met with "No getter for property description on bean activity"

am feeling that it is a scope issue for the bean:write tag. the jsp page-scope bean "activity" (set by the iterate tag) is not accessible to bean:write. cannot discern how to prove that hunch or how to resolve the issue w/in the time allowed.

have decided to explore spring for the ui of this app for a number of reasons, but am still keen to understanding why this struts issue came into being when the only things that changed were our going from struts 1.1b2 to 1.2.4 and from jdk1.4.x to 1.5. that is a key consideration: this code worked fine w/ older struts and older jdk.

thoughts?
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm pretty sure it's not a scope issue. If it were, the message would say that the bean activity was not found.

This seems to me a problem in reflection. WHERE, I am not sure.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
good point. after all, <%= activity.getName() %> works, so "activity" is available. <bean:write name="activity"> also works. it calls the toString on the bean just like the doc says it would. but put property="name" back in the bean:write, and the "No getter..." error returns.

i've continued messing with this off an on. the bean dump util says the class (activity.getClass()) is indeed JDBCActivity (which extends Activity and has a getName() method). tried to doctor up the generated code in tomcat hoping to get some insight. still stumped by this.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic