GrailsInAction / graina2

Source code for the 2nd edition of Grails in Action
90 stars 92 forks source link

Error after creating domain class:-Javassist Enhancement failed: qotd.Quote #51

Closed niccs closed 10 years ago

niccs commented 10 years ago

I am new to Grails. Just followed graina2 step by step....

After creating domain class Quote.groovy and running:--

import qotd.* def quote = Quote.findByAuthor("Chuck Norris Facts") println quote.content

In Groovy Console, I get error as_- No property found for name [author] for class [class qotd.Quote]

cmd window shows:-- Javassist Enhancement failed: qotd.Quote groovy.lang.MissingPropertyException: No such property: hasProperty for class: groovy.lang.MetaClassImpl at grails.ui.console.GrailsSwingConsole.runInstance(GrailsSwingConsole.g roovy:61)

I am not sure, Am I missing something?

niccs commented 10 years ago

I restarted the application and it worked fine.

pledbrook commented 10 years ago

Did you start the console with grails -reloading console? Also, which version of Grails is this?

The automatic reloading doesn't work terribly well with domain classes, so I tend not to rely on it.

niccs commented 10 years ago

Thanks Peter for responding. I am following the book to learn Grails from scratch. I simply started the console with grails console, but on re-starting application, it went fine. Its for Grails 2.3 version.

One more issue which I faced in this context was:-- As mentioned in the book, if I use H2DB filebased version URL as given in book, on starting grails console, I always get following exception:-- Exception in thread "main" org.h2.jdbc.JdbcSQLException: Database may be already in use: "Locked by another process". Possible solutions: close all other connection(s); use the server mode [90020-161]

Is there something, I need to do? Restarting application is not helping.