Skip to content
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

DerbyDatabase.getDefaultDriver() returns liquibase.repackaged.org.apache.derby.jdbc.EmbeddedDriver #2391

Closed
alexlitovsky opened this issue Jan 20, 2022 · 1 comment · Fixed by #2429

Comments

@alexlitovsky
Copy link

Environment

openjdk version "11.0.13" 2021-10-19 LTS
OpenJDK Runtime Environment Zulu11.52+13-CA (build 11.0.13+8-LTS)
OpenJDK 64-Bit Server VM Zulu11.52+13-CA (build 11.0.13+8-LTS, mixed mode)

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)

Liquibase Version: 4.6.x

Liquibase Integration & Version: maven

Liquibase Extension(s) & Version:

Database Vendor & Version: Derby 10.14.2.0

Operating System Type & Version: MacOS Monterey

Description

DerbyDatabase.close() is throwing a java.lang.ClassNotFoundException: liquibase.repackaged.org.apache.derby.jdbc.EmbeddedDriver.
This is because DerbyDatabase.getDefaultDriver() returns the liquibase.repackaged... driver class name rather than the actual one.
It seems that the source code and the binary do not correspond to each other for 4.6.x.

Steps To Reproduce

  1. git clone https://bitbucket.org/alexlitovsky1/liquibase-derby-bug.git
  2. mvn clean test

Actual Behavior

Test fails: expected: <org.apache.derby.jdbc.EmbeddedDriver> but was: <liquibase.repackaged.org.apache.derby.jdbc.EmbeddedDriver>

Expected/Desired Behavior

The test should pass.

@kataggart kataggart added this to To Do in Conditioning++ via automation Jan 21, 2022
@nvoxland nvoxland moved this from To Do to Code Review in Conditioning++ Jan 27, 2022
@suryaaki2 suryaaki2 moved this from Code Review to Ready for Handoff (In JIRA) in Conditioning++ Feb 2, 2022
@XDelphiGrl XDelphiGrl self-assigned this Feb 7, 2022
@XDelphiGrl
Copy link
Contributor

The getDefaultDriver for Derby no longer fails with an error due to a mismatch in expected class name.


Test Notes

  • If you run mvn clean test and get an error that --release is an invalid flag, check your $JAVA_HOME variable; you need a Java version newer than Java 8 to use the example build.
  • To run the tests using the fix branch, follow the instructions in Liquibase SDK Maven Plugin to get the artifact associated with the PR 2429. Remember to set the branch name in your .m2 settings.xml to dont-shade-all-apache.

** Error Seen Before Fix**

[INFO] Running com.alexlitovsky.bug.liquibase.derby.DerbyDatabaseTest
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.176 s <<< FAILURE! - in com.alexlitovsky.bug.liquibase.derby.DerbyDatabaseTest
[ERROR] testGetDefaultDriver  Time elapsed: 0.172 s  <<< FAILURE!
org.opentest4j.AssertionFailedError: expected: <org.apache.derby.jdbc.EmbeddedDriver> but was: <liquibase.repackaged.org.apache.derby.jdbc.EmbeddedDriver>
        at com.alexlitovsky.bug.liquibase.derby.DerbyDatabaseTest.testGetDefaultDriver(DerbyDatabaseTest.java:16)

[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR]   DerbyDatabaseTest.testGetDefaultDriver:16 expected: <org.apache.derby.jdbc.EmbeddedDriver> but was: <liquibase.repackaged.org.apache.derby.jdbc.EmbeddedDriver>

No Error Seen After Fix

[INFO] -------------------------------------------------------
[INFO] Running com.alexlitovsky.bug.liquibase.derby.DerbyDatabaseTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.168 s - in com.alexlitovsky.bug.liquibase.derby.DerbyDatabaseTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

Test Environment
Liquibase Maven Plugin from Build https://github.com/liquibase/liquibase/actions/runs/1773361660
GitHub Repo https://bitbucket.org/alexlitovsky1/liquibase-derby-bug/src/master/
Java 14

Conditioning++ automation moved this from Ready for Handoff (In JIRA) to Done Feb 7, 2022
@nvoxland nvoxland added this to the v4.8.0 milestone Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

4 participants