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

SQLPlusDefineSqlStatement should not depend on SLF4J #2368

Closed
Me1gireesh opened this issue Apr 26, 2019 · 4 comments
Closed

SQLPlusDefineSqlStatement should not depend on SLF4J #2368

Me1gireesh opened this issue Apr 26, 2019 · 4 comments

Comments

@Me1gireesh
Copy link

Which version and edition of Flyway are you using?
If this is not the latest version, can you reproduce the issue with the latest one as well?

(Many bugs are fixed in newer releases and upgrading will often resolve the issue)

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)
Which database are you using (type & version)?
Which operating system are you using?
What did you do?

(Please include the content causing the issue, any relevant configuration settings, the SQL statement that failed (if relevant) and the command you ran.)

What did you expect to see?
What did you see instead?
@Me1gireesh
Copy link
Author

I am seeing the below exceptions while adding a callback script on the file path.

Flyway Enterprise Edition (trial) 5.2.4 by Boxfuse licensed to Dell until 2019-04-04
ERROR: Your 30 day limited Flyway trial license has expired and is no longer valid. You must upgrade to a full Flyway Enterprise Edition license immediately to keep on using this software.
Database: jdbc:oracle:thin:@my database URL (Oracle 12.1)
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.flywaydb.core.internal.database.oracle.pro.SQLPlusDefineSqlStatement.(SQLPlusDefineSqlStatement.java:34)
at org.flywaydb.core.internal.database.oracle.OracleSqlStatementBuilder.getSqlStatement(OracleSqlStatementBuilder.java:191)
at org.flywaydb.core.internal.sqlscript.SqlScript.addStatement(SqlScript.java:152)
at org.flywaydb.core.internal.sqlscript.SqlScript.extractStatements(SqlScript.java:138)
at org.flywaydb.core.internal.sqlscript.SqlScript.(SqlScript.java:86)
at org.flywaydb.core.internal.callback.SqlScriptCallbackFactory.(SqlScriptCallbackFactory.java:87)
at org.flywaydb.core.Flyway.prepareCallbacks(Flyway.java:1808)
at org.flywaydb.core.Flyway.execute(Flyway.java:1705)
at org.flywaydb.core.Flyway.repair(Flyway.java:1566)
at org.flywaydb.commandline.Main.executeOperation(Main.java:174)
at org.flywaydb.commandline.Main.main(Main.java:108)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 11 more
Flyway Enterprise Edition (trial) 5.2.4 by Boxfuse licensed to Dell until 2019-04-04
ERROR: Your 30 day limited Flyway trial license has expired and is no longer valid. You must upgrade to a full Flyway Enterprise Edition license immediately to keep on using this software.
Database: jdbc:oracle:thin:@my datbase URL (Oracle 12.1)
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.flywaydb.core.internal.database.oracle.pro.SQLPlusDefineSqlStatement.(SQLPlusDefineSqlStatement.java:34)
at org.flywaydb.core.internal.database.oracle.OracleSqlStatementBuilder.getSqlStatement(OracleSqlStatementBuilder.java:191)
at org.flywaydb.core.internal.sqlscript.SqlScript.addStatement(SqlScript.java:152)
at org.flywaydb.core.internal.sqlscript.SqlScript.extractStatements(SqlScript.java:138)
at org.flywaydb.core.internal.sqlscript.SqlScript.(SqlScript.java:86)
at org.flywaydb.core.internal.callback.SqlScriptCallbackFactory.(SqlScriptCallbackFactory.java:87)
at org.flywaydb.core.Flyway.prepareCallbacks(Flyway.java:1808)
at org.flywaydb.core.Flyway.execute(Flyway.java:1705)
at org.flywaydb.core.Flyway.migrate(Flyway.java:1356)
at org.flywaydb.commandline.Main.executeOperation(Main.java:161)
at org.flywaydb.commandline.Main.main(Main.java:108)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 11 more
Flyway Enterprise Edition (trial) 5.2.4 by Boxfuse licensed to Dell until 2019-04-04
ERROR: Your 30 day limited Flyway trial license has expired and is no longer valid. You must upgrade to a full Flyway Enterprise Edition license immediately to keep on using this software.
Database: jdbc:oracle:thin:@Mydatabase url (Oracle 12.1)
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.flywaydb.core.internal.database.oracle.pro.SQLPlusDefineSqlStatement.(SQLPlusDefineSqlStatement.java:34)
at org.flywaydb.core.internal.database.oracle.OracleSqlStatementBuilder.getSqlStatement(OracleSqlStatementBuilder.java:191)
at org.flywaydb.core.internal.sqlscript.SqlScript.addStatement(SqlScript.java:152)
at org.flywaydb.core.internal.sqlscript.SqlScript.extractStatements(SqlScript.java:138)
at org.flywaydb.core.internal.sqlscript.SqlScript.(SqlScript.java:86)
at org.flywaydb.core.internal.callback.SqlScriptCallbackFactory.(SqlScriptCallbackFactory.java:87)
at org.flywaydb.core.Flyway.prepareCallbacks(Flyway.java:1808)
at org.flywaydb.core.Flyway.execute(Flyway.java:1705)
at org.flywaydb.core.Flyway.info(Flyway.java:1521)
at org.flywaydb.commandline.Main.executeOperation(Main.java:167)
at org.flywaydb.commandline.Main.main(Main.java:108)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 11 more

@axelfontaine
Copy link
Contributor

Thanks for reporting. Arrgh! It appears a SLF4J dependency inadvertently sneaked into the SQLPlusDefineSqlStatement class. Fixed.

@axelfontaine axelfontaine changed the title Error while having callbackscripts in the filepath SQLPlusDefineSqlStatement should not depend on SLF4J Apr 26, 2019
@axelfontaine axelfontaine added this to the Flyway 6.0.0 milestone Apr 26, 2019
axelfontaine pushed a commit to flyway/flywaydb.org that referenced this issue Apr 26, 2019
@axelfontaine
Copy link
Contributor

Possible workarounds:

  • Do not use DEFINE statement (may not be possible)
  • Add SLF4J to the jars directory of your Flyway installation (probably the best choice)

@Me1gireesh
Copy link
Author

I added the jar slf4j-api-1.7.26.jar, which in turn needed another dependency slf4j-simple-1.7.2.jar.
Now the callbacks are working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants