I have two changesets in a change log (delete a view if it exists and add a view if it doesn’t exist) that works with liquibase 4.31.1 and fails with liquibase 4.32.0.
Any ideas?
From the error messages it looks like the view isn’t found by and the of the next change test fails to detect that the view is still present…?
Platform is: debian bookworm 12.11, amd64, java 21.0.4, derby 10.14.2.0 (memory database used for unit tests) and liquibase 4.32.0
Changesets and liquibase log error messages follows.
Here are the changesets:
<changeSet author="sb" id="remove-measures_view-to-add-ratings">
<preConditions onFail="CONTINUE" >
<viewExists viewName="measures_view" />
</preConditions>
<dropView viewName="measures_view" />
</changeSet>
<changeSet author="sb" id="add-ratings-to-measures_view">
<preConditions onFail="CONTINUE" >
<not>
<viewExists viewName="measures_view" />
</not>
</preConditions>
<createView viewName="measures_view">select id,project_key,version,version_is_release,analysis_time,lines,bugs,new_bugs,vulnerabilities,new_vulnerabilities,code_smells,new_code_smells,coverage,new_coverage,complexity, (bugs + vulnerabilities + code_smells) as issues,sqale_rating,new_maintainability_rating,security_rating,new_security_rating,reliability_rating,new_reliability_rating from measures </createView>
</changeSet>
Here are the error log messages for those changesets in 4.32.0:
[ERROR] Sonar Collector servlet unable to create or update the database schema liquibase.exception.LiquibaseException: java.lang.NullPointerException: Cannot invoke "java.sql.Connection.getMetaData()" because "this.con" is null
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
[INFO] sonar-collector webhook called for project no.priv.bang.sonar.sonar-collector:parent from server http://localhost:9000
[ERROR] Sonar Collector caught exception java.net.ConnectException: Connection refused
May 27, 2025 11:02:14 PM liquibase.changelog
INFO: Creating database history table with name: APP.DATABASECHANGELOG
May 27, 2025 11:02:14 PM liquibase.changelog
INFO: Reading from APP.DATABASECHANGELOG
May 27, 2025 11:02:14 PM liquibase.snapshot
INFO: Creating snapshot
May 27, 2025 11:02:15 PM liquibase.lockservice
INFO: Successfully acquired change log lock
May 27, 2025 11:02:15 PM liquibase.command
INFO: Using deploymentId: 8379732046
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: Reading from APP.DATABASECHANGELOG
Running Changeset: db-changelog/db-changelog-1.0.0.xml::sonar-collector-measures-1.0.0::sb
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: Table measures created
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: ChangeSet db-changelog/db-changelog-1.0.0.xml::sonar-collector-measures-1.0.0::sb ran successfully in 21ms
Running Changeset: db-changelog/db-changelog-1.0.0.xml::measure-add-indexes-1.0.0::sb
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: Index idx_project_key created
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: Index idx_version_is_release created
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: ChangeSet db-changelog/db-changelog-1.0.0.xml::measure-add-indexes-1.0.0::sb ran successfully in 12ms
Running Changeset: db-changelog/db-changelog-1.0.0.xml::measures-add-complexity::sb
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: Columns complexity(BIGINT) added to measures
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: NOT NULL constraint has been added to measures.complexity
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: ChangeSet db-changelog/db-changelog-1.0.0.xml::measures-add-complexity::sb ran successfully in 26ms
Running Changeset: db-changelog/db-changelog-1.0.0.xml::create-measures_view::sb
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: View measures_view created
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: ChangeSet db-changelog/db-changelog-1.0.0.xml::create-measures_view::sb ran successfully in 20ms
Running Changeset: db-changelog/db-changelog-1.0.0.xml::measures-add-ratings::sb
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: Columns sqale_rating(VARCHAR(1)),new_maintainability_rating(VARCHAR(1)),security_rating(VARCHAR(1)),new_security_rating(VARCHAR(1)),reliability_rating(VARCHAR(1)),new_reliability_rating(VARCHAR(1)) added to measures
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: NOT NULL constraint has been added to measures.sqale_rating
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: NOT NULL constraint has been added to measures.new_maintainability_rating
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: NOT NULL constraint has been added to measures.security_rating
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: NOT NULL constraint has been added to measures.new_security_rating
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: NOT NULL constraint has been added to measures.reliability_rating
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: NOT NULL constraint has been added to measures.new_reliability_rating
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: ChangeSet db-changelog/db-changelog-1.0.0.xml::measures-add-ratings::sb ran successfully in 110ms
Running Changeset: db-changelog/db-changelog-1.0.0.xml::remove-measures_view-to-add-ratings::sb
May 27, 2025 11:02:15 PM liquibase.snapshot
INFO: Creating snapshot
May 27, 2025 11:02:15 PM liquibase.changelog
INFO: Continuing past: db-changelog/db-changelog-1.0.0.xml::remove-measures_view-to-add-ratings::sb despite precondition failure due to onFail='CONTINUE':
db-changelog/db-changelog-1.0.0.xml : View APP.measures_view does not exist
Running Changeset: db-changelog/db-changelog-1.0.0.xml::add-ratings-to-measures_view::sb
May 27, 2025 11:02:15 PM liquibase.snapshot
INFO: Creating snapshot
May 27, 2025 11:02:15 PM liquibase.changelog
SEVERE: ChangeSet db-changelog/db-changelog-1.0.0.xml::add-ratings-to-measures_view::sb encountered an exception.
liquibase.exception.DatabaseException: Table/View 'MEASURES_VIEW' already exists in Schema 'APP'. [Failed SQL: (20000) CREATE VIEW APP.measures_view AS select id,project_key,version,version_is_release,analysis_time,lines,bugs,new_bugs,vulnerabilities,new_vulnerabilities,code_smells,new_code_smells,coverage,new_coverage,complexity, (bugs + vulnerabilities + code_smells) as issues,sqale_rating,new_maintainability_rating,security_rating,new_security_rating,reliability_rating,new_reliability_rating from measures]
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:519)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:85)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:187)
at liquibase.executor.AbstractExecutor.execute(AbstractExecutor.java:148)
at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1198)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:793)
at liquibase.changelog.visitor.UpdateVisitor.executeAcceptedChange(UpdateVisitor.java:127)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:71)
at liquibase.changelog.ChangeLogIterator.lambda$run$0(ChangeLogIterator.java:133)
at liquibase.Scope.lambda$child$0(Scope.java:216)
at liquibase.Scope.child(Scope.java:225)
at liquibase.Scope.child(Scope.java:215)
at liquibase.Scope.child(Scope.java:194)
at liquibase.changelog.ChangeLogIterator.lambda$run$1(ChangeLogIterator.java:122)
at liquibase.Scope.lambda$child$0(Scope.java:216)
at liquibase.Scope.child(Scope.java:225)
at liquibase.Scope.child(Scope.java:215)
at liquibase.Scope.child(Scope.java:194)
at liquibase.Scope.child(Scope.java:282)
at liquibase.Scope.child(Scope.java:286)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:91)
at liquibase.command.core.AbstractUpdateCommandStep.lambda$run$0(AbstractUpdateCommandStep.java:114)
at liquibase.Scope.lambda$child$0(Scope.java:216)
at liquibase.Scope.child(Scope.java:225)
at liquibase.Scope.child(Scope.java:215)
at liquibase.Scope.child(Scope.java:194)
at liquibase.command.core.AbstractUpdateCommandStep.run(AbstractUpdateCommandStep.java:112)
at liquibase.command.core.UpdateCommandStep.run(UpdateCommandStep.java:100)
at liquibase.command.CommandScope.lambda$execute$6(CommandScope.java:263)
at liquibase.Scope.child(Scope.java:225)
at liquibase.Scope.child(Scope.java:201)
at liquibase.command.CommandScope.execute(CommandScope.java:251)
at no.priv.bang.karaf.liquibase.runner.LiquibaseClassPathChangeLogRunner.lambda$applyLiquibaseChangelist$0(LiquibaseClassPathChangeLogRunner.java:56)
at liquibase.Scope.child(Scope.java:225)
at liquibase.Scope.child(Scope.java:201)
at no.priv.bang.karaf.liquibase.runner.LiquibaseClassPathChangeLogRunner.applyLiquibaseChangelist(LiquibaseClassPathChangeLogRunner.java:53)
at no.priv.bang.sonar.collector.webhook.SonarCollectorServlet.createSchemaWithLiquibase(SonarCollectorServlet.java:92)
at no.priv.bang.sonar.collector.webhook.SonarCollectorServlet.activate(SonarCollectorServlet.java:86)
at no.priv.bang.sonar.collector.webhook.SonarCollectorServletTest.testReceiveSonarWebhookCall(SonarCollectorServletTest.java:111)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:775)
at org.junit.platform.commons.support.ReflectionSupport.invokeMethod(ReflectionSupport.java:479)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:161)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:152)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:91)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:112)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:94)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:93)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:87)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:216)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:212)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:137)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:69)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:156)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:146)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:144)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:143)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:100)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:160)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:146)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:144)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:143)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:100)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:160)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:146)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:144)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:143)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:100)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:201)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:170)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:94)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:59)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:142)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:58)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:103)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:94)
at org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:52)
at org.junit.platform.launcher.core.InterceptingLauncher.lambda$execute$2(InterceptingLauncher.java:47)
at org.junit.platform.launcher.core.ClasspathAlignmentCheckingLauncherInterceptor.intercept(ClasspathAlignmentCheckingLauncherInterceptor.java:25)
at org.junit.platform.launcher.core.InterceptingLauncher.execute(InterceptingLauncher.java:46)
at org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:52)
at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:70)
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.run(JUnit5TestReference.java:100)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:530)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:758)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:453)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:211)
Caused by: java.sql.SQLException: Table/View 'MEASURES_VIEW' already exists in Schema 'APP'.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:511)
... 113 more
Caused by: ERROR X0Y32: Table/View 'MEASURES_VIEW' already exists in Schema 'APP'.
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.duplicateDescriptorException(Unknown Source)
at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addDescriptor(Unknown Source)
at org.apache.derby.impl.sql.execute.CreateViewConstantAction.executeConstantAction(Unknown Source)
at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
... 117 more
UPDATE SUMMARY
Run: 5
Previously run: 0
Filtered out: 1
-------------------------------
Total change sets: 7
FILTERED CHANGE SETS SUMMARY
Preconditions: 1
May 27, 2025 11:02:15 PM liquibase.util
INFO: UPDATE SUMMARY
May 27, 2025 11:02:15 PM liquibase.util
INFO: Run: 5
May 27, 2025 11:02:15 PM liquibase.util
INFO: Previously run: 0
May 27, 2025 11:02:15 PM liquibase.util
INFO: Filtered out: 1
May 27, 2025 11:02:15 PM liquibase.util
INFO: -------------------------------
May 27, 2025 11:02:15 PM liquibase.util
INFO: Total change sets: 7
May 27, 2025 11:02:15 PM liquibase.util
INFO: FILTERED CHANGE SETS SUMMARY
May 27, 2025 11:02:15 PM liquibase.util
INFO: Preconditions: 1
May 27, 2025 11:02:15 PM liquibase.util
INFO: Update summary generated
May 27, 2025 11:02:15 PM liquibase.command
INFO: Update command encountered an exception.
May 27, 2025 11:02:15 PM liquibase.lockservice
INFO: Successfully released change log lock
May 27, 2025 11:02:15 PM liquibase.command
INFO: Logging exception.
ERROR: Exception Details
ERROR: Exception Primary Class: StandardException
ERROR: Exception Primary Reason: Table/View 'MEASURES_VIEW' already exists in Schema 'APP'.
ERROR: Exception Primary Source: Apache Derby 10.14.2.0 - (1828579)
May 27, 2025 11:02:15 PM liquibase.command
INFO: Command execution complete