grails prepare-test fail

ChrisC's Avatar


04 Aug, 2018 10:11 PM

Hi all,

I'm having trouble building from the src. Environment is as follows:

Java: jdk1.8.0_181
Grails: 2.4.3
Windows 10
PostgreSQL 10

I'm getting an error on the grails prepare-test step:

| Environment set to development.....
Loading configuration files from classpath
Loading database version 4.1
jdbc:postgresql://localhost:5432/jbilling_test jbilling/[no password] (schema: public) (driver org.postgresql.Driver)
dropping all objects in jbilling_test
| Error Error executing script PrepareTest: : liquibase.exception.DatabaseException: liquibase.exception.LockException: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: Error getting jdbc:postgresql://localhost:5432/jbilling_test view with liquibase.statement.core.GetViewDefinitionStatement@807bfd3 (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)

I won't even mention how much time it took me to get this far, I'd only embarrass myself! Please help, any and all suggestions are welcome.

  1. 1 Posted by vikas bodani on 06 Aug, 2018 08:25 AM

    vikas bodani's Avatar

    Liquibase is unable to drop the db, most likely, because, you are still
    logged-in into the database during that time. So if you log out and run, it
    should work for you.

    *Vikas Bodani*

  2. 2 Posted by ChrisC on 07 Aug, 2018 04:30 PM

    ChrisC's Avatar

    Thanks for the response, Vikas, it's really appreciated.

    I've tried hunting down where I might be logged in postgres or jbilling-test, but haven't been able to diagnose where. When I access postgres admin (pgAdmin), it has that "red x" covering localhost, which contains the jbilling-test database, so I'm not locking it up as a resource. I exit the postgres admin tool prior to running grails prepare-test.

    I'm clueless as to where (or even how) I'm logged in. Any suggestions?

  3. 3 Posted by ChrisC on 12 Aug, 2018 06:10 PM

    ChrisC's Avatar

    Solved: Don't use Postgres 10.4. For some reason, at least in my environment, there appears to be some degree of incompatibility. Go back to Postgres 9.6.9, and save yourself hours of frustration!

    Thanks anyway, Vikas.

  4. 4 Posted by Long on 05 Apr, 2019 06:21 PM

    Long's Avatar

    Dear all, please take a look at this link, it comes with lots of solutions

    One notice is instead of downgrading Postgresql which is usually not recommended, consider to upgrade postgresql jdbc driver from 9.3-1102-jdbc41 to 9.4-1202-jdbc41.


  5. 5 Posted by vikas bodani on 05 Apr, 2019 11:38 PM

    vikas bodani's Avatar

    Correct. And the right place to do that is BuildConfig.groovy, which
    includes the dependency for the driver:

    runtime 'org.postgresql:postgresql:9.4.1212'

    *Vikas Bodani*

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Already uploaded files

  • pretest.txt 9.07 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac