Skip to content

Instantly share code, notes, and snippets.

@mfollett
mfollett / gist:1679035
Created January 25, 2012 21:54
grails database migration exception
2012-01-25 15:53:13,963 [Thread-12] ERROR context.GrailsContextLoader - Error executing bootstraps: liquibase.exception.ValidationFailedException: Validation Failed:
1 changes have validation errors
java.lang.ClassCastException: liquibase.statement.core.AddForeignKeyConstraintStatement cannot be cast to liquibase.statement.core.CreateTableStatement
org.codehaus.groovy.runtime.InvokerInvocationException: liquibase.exception.ValidationFailedException: Validation Failed:
1 changes have validation errors
java.lang.ClassCastException: liquibase.statement.core.AddForeignKeyConstraintStatement cannot be cast to liquibase.statement.core.CreateTableStatement
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:97)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
favoritePrime validator { BigInteger(it).isProbablePrime(99) ?: 'my.localized.not.prime.message' }
@mfollett
mfollett / Groovyist.groovy
Created January 24, 2012 07:38
groovyist example
class Groovyist {
String username
String password
String email
Long favoritePrime
static constraints = {
username blank: false, unique: true
password size: 5..15, blank: false
email email: true, blank: false
@mfollett
mfollett / gist:1643616
Created January 19, 2012 23:08
grails script exception
| Error Error loading plugin manager: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
at org.codehaus.groovy.grails.commons.ArtefactHandlerAdapter.newArtefactClass(ArtefactHandlerAdapter.java:113)
at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.addArtefact(DefaultGrailsApplication.java:894)
at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.addArtefact(DefaultGrailsApplication.java:615)
at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.configureLoadedClasses(DefaultGrailsApplication.java:326)
at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.initialise(DefaultGrailsApplication.java:825)
at org.codehaus.groovy.grails.commons.GrailsApplication$initialise.call(Unknown Source)
at _PluginDependencies_groovy$_run_closure5_closure23.
@mfollett
mfollett / auto-constructor.groovy
Created August 29, 2011 03:00
Constructor Automatically Generated by Groovy
class Foo {
Long l
Long ll
}
Foo f = new Foo(l:42)
println f.l
println f.ll
Foo ff = new Foo(l:48, ll: 22);
@mfollett
mfollett / B.groovy
Created August 1, 2011 21:09
B Class
package example.bug
class B {
static hasMany = [aItems:A]
static belongsTo = [A]
static mapping = {
table schema: 'bug_example'
aItems joinTable: [name: 'a_b', column: 'a_id']
version false
@mfollett
mfollett / a.groovy
Created August 1, 2011 21:09
A class
package example.bug
class A {
static hasMany = [bItems:B]
static mapping = {
table schema: 'bug_example'
bItems joinTable: [name: 'a_b', column: 'b_id']
version false
@mfollett
mfollett / bug_example.psql
Created August 1, 2011 21:08
Create the bug_example schema
create schema bug_example;
create table bug_example.a (
id bigint PRIMARY KEY not null,
detail varchar(255)
);
create table bug_example.b (
id bigint PRIMARY KEY not null,
detail varchar(255)
@mfollett
mfollett / run_app_out
Created August 1, 2011 21:05
output from bug_example failed run
mattbook:example-bug matt$ grails run-app -verbose
Base Directory: /Users/matt/Documents/Projects/example-bug
| Running Grails application
| Error 2011-08-01 15:52:50,418 [Thread-10] ERROR context.GrailsContextLoader - Error executing bootstraps: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing table: bug_example.a_b
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating
class ClumsyTail is Tail
{
method wag()
{
say "knocked over a vase.";
}
}
my $jewel = Dog.new( name => 'Jewel', tail => ClumsyTail.new() );
$jewel.wag();