custom precondition class not found exception

87 views
Skip to first unread message

Madruga

unread,
Jun 24, 2009, 6:29:27 PM6/24/09
to Autobase
My precondition is in src/groovy/liquibase/precondition/
MyCustomPrecondition.groovy

possible fix in file GroovyPrecondition, line 70: (working in my
development mode)

replace:
def custom = Class.forName(m.className).newInstance()
with:
def custom = ApplicationHolder.application.classLoader.loadClass
(m.className).newInstance()

don't forget to import ApplicationHolder

Robert, should I raise a JIRA or it's not needed?

Robert Fischer

unread,
Jun 24, 2009, 8:37:54 PM6/24/09
to grails-...@googlegroups.com
No need: I'll patch this, release it, and move forward.

~~ Robet.
--
~~ Robert Fischer, Smokejumper IT Consulting.
Enfranchised Mind Blog http://EnfranchisedMind.com/blog

Check out my book, "Grails Persistence with GORM and GSQL"!
http://www.smokejumperit.com/redirect.html

Madruga

unread,
Jun 24, 2009, 8:40:59 PM6/24/09
to Autobase
Now that my custom precondition is being executed, I'm getting errors
with it.

What I understood for custom precondition is that must implement the
CustomPrecondition interface, and if the precondition fails, then the
method throws an CustomPreconditionFailedException, the migration is
marked as failed, in my case, I have onFail: "MARK_RAN" so nothing
should be done, and migration goes on, please adviser if I'm missing
something, because this way I'm getting this:

liquibase.exception.MigrationFailedException: Migration failed for
change set app-autobase::UpdateJsecUserUniqueId::Gcmadruga:
Reason: liquibase.exception.CustomPreconditionFailedException:
Unique Constraint Key jsec_user_username_key does not exist, failed
:
Caused By: Unique Constraint Key jsec_user_username_key does
not exist, failed:
Caused By: null
at liquibase.ChangeSet.execute(ChangeSet.java:238)
at liquibase.parser.visitor.UpdateVisitor.visit
(UpdateVisitor.java:26)
at liquibase.parser.ChangeLogIterator.run
(ChangeLogIterator.java:41)
at liquibase.LiquibaseDsl.update(LiquibaseDsl.groovy:83)
at liquibase.LiquibaseDsl$update.call(Unknown Source)
at Autobase.migrate(Autobase.groovy:41)
at Autobase$migrate.call(Unknown Source)
at AutobaseGrailsPlugin$__clinit__closure9.doCall
(AutobaseGrailsPlugin.groovy:83)
at AutobaseGrailsPlugin.invokeMethod
(AutobaseGrailsPlugin.groovy)
at AutobaseGrailsPlugin$_closure2.doCall
(AutobaseGrailsPlugin.groovy:97)
at grails.web.container.EmbeddableServer$start.call(Unknown
Source)
at _GrailsRun_groovy$_run_closure5_closure11.doCall
(_GrailsRun_groovy:145)
at _GrailsRun_groovy$_run_closure5_closure11.doCall
(_GrailsRun_groovy)
at _GrailsSettings_groovy$_run_closure10.doCall
(_GrailsSettings_groovy:274)
at _GrailsSettings_groovy$_run_closure10.call
(_GrailsSettings_groovy)
at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:
137)
at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy)
at _GrailsRun_groovy.runInline(_GrailsRun_groovy:104)
at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:
58)
at RunApp$_run_closure1.doCall(RunApp.groovy:33)
at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:344)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown
Source)
at gant.Gant.dispatch(Gant.groovy:334)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.processTargets(Gant.groovy:495)
at gant.Gant.processTargets(Gant.groovy:480)
Caused by: liquibase.exception.CustomPreconditionFailedException:
Unique Constraint Key jsec_user_username_key does not exist, failed
at
liquibase.precondition.UniqueConstraintExistsPrecondition.check
(UniqueConstraintExistsPrecondition.groovy:24)
at liquibase.preconditions.CustomPrecondition$check.call
(Unknown Source)
at
liquibase.dsl.parser.groovy.GroovyCustomPreconditionWrapper.check
(GroovyCustomPreconditionWrapper.groovy:41)
at liquibase.preconditions.AndPrecondition.check
(AndPrecondition.java:21)
at liquibase.preconditions.Precondition$check$0.call(Unknown
Source)
at liquibase.preconditions.Precondition$check$0.call(Unknown
Source)
at liquibase.dsl.parser.groovy.GroovyPrecondition.check
(GroovyPrecondition.groovy:56)
at liquibase.preconditions.AndPrecondition.check
(AndPrecondition.java:21)
at liquibase.preconditions.Precondition$check$0.call(Unknown
Source)
at liquibase.preconditions.Precondition$check$0.call(Unknown
Source)
at liquibase.dsl.parser.groovy.GroovyPrecondition.check
(GroovyPrecondition.groovy:56)
at liquibase.ChangeSet.execute(ChangeSet.java:147)
... 31 more
Caused by: java.lang.Exception
... 43 more

Robert Fischer

unread,
Jun 25, 2009, 8:50:02 AM6/25/09
to grails-...@googlegroups.com
This is a Liquibase issue. There's been a bit of work in the CustomPrecondition space in the most
recent release -- when I push out the next Autobase, give it a shot and let me know if that works.

~~ Robert.

Gustavo Madruga

unread,
Jun 26, 2009, 3:03:09 PM6/26/09
to grails-...@googlegroups.com
Thanks for the info.

Any plans on releasing the new version soon?

I might take a shot at with latest dev version (but I think that neither git nor grails svn are up to date?!)

Madruga, Gustavo
CTO at Intellego

Robert Fischer

unread,
Jun 26, 2009, 3:27:50 PM6/26/09
to grails-...@googlegroups.com
I have to put in a lot of work for my billable client, the book, and GroovyMag right now. Tuesday
morning USA Eastern Time is the next time I've got for doing free work.

~~ Robert.

Gustavo Madruga wrote:
> Thanks for the info.
>
> Any plans on releasing the new version soon?
>
> I might take a shot at with latest dev version (but I think that neither
> git nor grails svn are up to date?!)
>
> Madruga, Gustavo
> CTO at Intellego
>
>
> On Thu, Jun 25, 2009 at 09:50, Robert Fischer
> <robert....@smokejumperit.com
Reply all
Reply to author
Forward
0 new messages