This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Groovy and the fly likes groovy.lang.MissingPropertyException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "groovy.lang.MissingPropertyException" Watch "groovy.lang.MissingPropertyException" New topic
Author

groovy.lang.MissingPropertyException

Frank Lampert
Greenhorn

Joined: Aug 12, 2009
Posts: 2
Hi,

I have a problem calculating the fibonacci numbers in an iterative way by defining the following method in a fibonacci.groovy file:



I am using the Java scripting api to invoke that groovy method and every time I do so I get the error:

org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingPropertyException: No such property: prev2 for class: Script1


I mean, something is wrong with the variable pref_2, but I cannot figure out what it is?

Does anybody know how to handle this?

Thanks for answers in advance!
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Please see your private messages for an important administrative matter.


GenRocket - Experts at Building Test Data
Frank Lampert
Greenhorn

Joined: Aug 12, 2009
Posts: 2
ok, I got it....variables were defined within the else brackets that caused the trouble.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Frank Lampert wrote:ok, I got it....variables were defined within the else brackets that caused the trouble.


Frank, thanks for sharing your solution. You'd be surprised how many people don't and it is very helpful when you do. Also, thanks for fixing your name. I much prefer calling you Frank than jkljkljlkjkljlk. ;)
 
Don't get me started about those stupid light bulbs.
 
subject: groovy.lang.MissingPropertyException