aspose file tools
The moose likes Groovy and the fly likes groovy.lang.MissingPropertyException Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Other Languages » Groovy
Reply 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
Sheriff

Joined: Jul 11, 2001
Posts: 15021

Please see your private messages for an important administrative matter.


My Blog | DZone Articles
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
Sheriff

Joined: Jul 11, 2001
Posts: 15021

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. ;)
 
 
subject: groovy.lang.MissingPropertyException
 
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com