New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.lang.NoClassDefFoundError when running mvn liquibase:update #66
Comments
Fixed in 1.0.2. |
Using 1.0.2 did not solve this problem for me.
Returned the same exception:
Adding the dependency on |
I've just tried it out locally, and I think the problem is slightly different (and a lot less severe) in 1.0.2:
At least for me locally Liquibase does start and creates the change log and lock tables, and then executes the master change log. [INFO] Scanning for projects... [INFO] [INFO] -------------< com.google.cloud:spanner-liquibase-sample >-------------- [INFO] Building Spanner Liquibase Sample 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- liquibase-maven-plugin:4.3.1:update (default-cli) @ spanner-liquibase-sample --- [INFO] ------------------------------------------------------------------------ [INFO] there are no resolved artifacts for the Maven project. [INFO] there are no resolved artifacts for the Maven project. [project, pluginDescriptor] [INFO] Parsing Liquibase Properties File [INFO] File: src/main/resources/liquibase.properties [INFO] ------------------------------------------------------------------------ [INFO] [INFO] [INFO] Liquibase Community 4.3.1 by Datical [INFO] #################################################### ## _ _ _ _ ## ## | | (_) (_) | ## ## | | _ __ _ _ _ _| |__ __ _ ___ ___ ## ## | | | |/ _` | | | | | '_ \ / _` / __|/ _ \ ## ## | |___| | (_| | |_| | | |_) | (_| \__ \ __/ ## ## \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___| ## ## | | ## ## |_| ## ## ## ## Get documentation at docs.liquibase.com ## ## Get certified courses at learn.liquibase.com ## ## Free schema change activity reports at ## ## https://hub.liquibase.com ## ## ## #################################################### Starting Liquibase at 11:28:22 (version 4.3.1 #26 built at 2021-02-12 17:41+0000) [INFO] Parsing Liquibase Properties File src/main/resources/liquibase.properties for changeLog parameters [INFO] Executing on Database: jdbc:cloudspanner://localhost:9010/projects/test-project/instances/test-instance/databases/test-db?usePlainText=true [INFO] Successfully acquired change log lock [INFO] Creating database history table with name: DATABASECHANGELOG [INFO] Reading from DATABASECHANGELOG [INFO] Successfully released change log lock [INFO] Successfully acquired change log lock Skipping auto-registration [WARNING] Skipping auto-registration [INFO] Table rollback_table created [INFO] ChangeSet db.changelog-master.yaml::rollback-test::liquibase-docs ran successfully in 12ms [INFO] Successfully released change log lock [INFO] ------------------------------------------------------------------------ [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.220 s [INFO] Finished at: 2021-03-11T11:28:24+01:00 [INFO] ------------------------------------------------------------------------ Exception in thread "SpannerPool shutdown hook" java.lang.NoClassDefFoundError: com/google/cloud/spanner/connection/SpannerPool$CheckAndCloseSpannersMode at com.google.cloud.spanner.connection.SpannerPool$CloseSpannerRunnable.run(SpannerPool.java:96) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.lang.ClassNotFoundException: com.google.cloud.spanner.connection.SpannerPool$CheckAndCloseSpannersMode at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239) ... 2 more Shutdown hooks are known to be best-effort. The shutdown hook of the JDBC driver tries to delete all Spanner sessions that have been opened during the lifetime of the JVM. Failing to do so will not cause any real harm, as the sessions will be garbage collected by the backend after 1 hour anyways, but common practice is to clean up as much as possible. I've created an issue for it in the Spanner client library. The most probable solution will be to just ignore any error in the shutdown hook and not reporting it, as the current situation only creates confusion, while there is nothing really actionable in this case. |
Adding the dependency should not be necessary in 1.0.2, as the JDBC driver is automatically included in the Liquibase plugin. The reason that adding version 1.20.0 of the JDBC driver was a workaround in version 1.0.1, was that the underlying problem was caused by the Spanner client library that was used by JDBC driver version 1.19.0. So the workaround was just an override of the version. |
The following error can occur when using version 1.0.1 of the Liquibase integration.
This is caused by a missing internal dependency in the JDBC driver. A workaround for this problem is to add the following dependency to your project:
The text was updated successfully, but these errors were encountered: