Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

groovy.lang.MissingPropertyException

 
Frank Lampert
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please see your private messages for an important administrative matter.
 
Frank Lampert
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, I got it....variables were defined within the else brackets that caused the trouble.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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. ;)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic