File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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. ;)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: groovy.lang.MissingPropertyException