wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets 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. ;)
 
wood burning stoves
 
subject: groovy.lang.MissingPropertyException
 
Similar Threads
Example of using Groovy Closure for a different programming style
Executing Jython script from java and accessing resulting object
Fibonacci Algorithms and their different manifestations. Which is the best?
Critique Please
Caught: groovy.lang.MissingPropertyException while excuting my DSL