To determine if this is an issue with v4 vs v5, I switched to my project’s master branch, which is running in production and should match the database I pulled down. On startup, I see these messages re-occuring:
2018-08-27 12:12:59.173 INFO 15779 --- [ main] liquibase : Waiting for changelog lock....
2018-08-27 12:13:09.176 DEBUG 15779 --- [ main] liquibase : Executing QUERY database command: SELECT LOCKED FROM public.databasechangeloglock WHERE ID=1
So I deleted it:
health=# select * from databasechangeloglock;
id | locked | lockgranted | lockedby
----+--------+-------------------------+-------------------------------------------------------------------------------
(1 row)
health=# delete from databasechangeloglock;
DELETE 1
Which causes startup to fail (as soon as the sql executes):
2018-08-27 12:13:09.176 DEBUG 15779 --- [ main] liquibase : Executing QUERY database command: SELECT LOCKED FROM public.databasechangeloglock WHERE ID=1
2018-08-27 12:13:09.180 WARN 15779 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.RuntimeException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'securityConfiguration' defined in file [/Users/mraible/dev/21-points.v5/build/classes/java/main/org/jhipster/health/config/SecurityConfiguration.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userDetailsService' defined in file [/Users/mraible/dev/21-points.v5/build/classes/java/main/org/jhipster/health/security/DomainUserDetailsService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Cannot create inner bean '(inner bean)#6cd2cb2' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#6cd2cb2': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/jhipster/health/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.LockException: liquibase.exception.DatabaseException: Expected single row from liquibase.statement.core.SelectFromDatabaseChangeLogLockStatement@7323dce7 but got 0
I started it back up and now it works!
Because that worked, I checked out my "jhipster-v5.2.1” branch and tried again.
This time I got a validation exception, which is OK because I know how to fix it.
Caused by: liquibase.exception.ValidationFailedException: Validation Failed:
1 change sets check sum
config/liquibase/changelog/20170725033721_added_entity_Preferences.xml::20170725033721-1::jhipster was: 7:7f8bf324d16147bb5491793a9f9f5063 but is now: 7:ab5fbd1635aed85867914b4216bada20
I updated my database with the following and restarted.
update databasechangelog set md5sum=null;
Now I get the following error:
Caused by: org.postgresql.util.PSQLException: ERROR: constraint "fk_points_user_id" for relation "points" already exists
Adding some preConditions to some of my constraints changelog files fixed this:
One thing I noticed (with both v4 and v5) is that the client is re-built each time when using the -Pprod profile. Is that expected? It’s kinda annoying when you’re trying to test prod stuff.
Thanks,
Matt