我在 Springboot 应用程序中遇到了 Flyway 和 Oracle(Oracle Databse 版本 19.21)的问题。
版本:
flyway-core: 10.11.0
flyway-database-oracle: 10.11.0
spring-boot: 3.2.4
ojdbc11: 23.3.0.23.09
当我运行应用程序时,我得到以下信息:
无法实例化 [org.flywaydb.core.Flyway]:工厂方法“flyway”抛出异常并显示消息:不支持的数据库:Oracle 19.0
完整的堆栈跟踪:
{"level":"ERROR","message":"Application run failed","timestamp":"2024-04-22T07:16:15.197+0200",
"logger":"o.s.boot.SpringApplication","context":"abc.service","throwable_class":"BeanCreationException","throwable_root_cause_class":
"FlywayException","stack_hash":"345a5cc5","stack_trace":"o.f.c.a.FlywayException: Unsupported Database: Oracle 19.0\n\tat
o.f.c.i.d.DatabaseTypeRegister.getDatabaseTypeForConnection(DatabaseTypeRegister.java:105)\n\tat
o.f.c.a.c.ClassicConfiguration.setDataSource(ClassicConfiguration.java:1095)\n\tat o.f.c.a.c.FluentConfiguration.dataSource(FluentConfiguration.java:624)\n\tat
o.s.b.a.f.FlywayAutoConfiguration$FlywayConfiguration.configureDataSource(FlywayAutoConfiguration.java:185)\n\tat
o.s.b.a.f.FlywayAutoConfiguration$FlywayConfiguration.flyway(FlywayAutoConfiguration.java:172)\n\tat
j.i.r.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java)\n\tat
j.i.r.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)\n\tat
j.i.r.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat
j.l.reflect.Method.invoke(Method.java:568)\n\tat
o.s.b.f.s.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:140)\n\t... 29 common frames omitted\nWrapped by:
o.s.b.BeanInstantiationException: Failed to instantiate [org.flywaydb.core.Flyway]: Factory method 'flyway'
threw exception with message: Unsupported Database: Oracle 19.0\n\tat
o.s.b.f.s.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:177)\n\tat
o.s.b.f.s.ConstructorResolver.instantiate(ConstructorResolver.java:644)\n\t... 28 common frames omitted\nWrapped by: o.s.b.f.BeanCreationException:
Error creating bean with name 'flyway' defined in class path resource
[org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]:
Failed to instantiate [org.flywaydb.core.Flyway]: Factory method 'flyway' threw exception with message:
Unsupported Database: Oracle 19.0\n\tat o.s.b.f.s.ConstructorResolve r.instantiate(ConstructorResolver.java:648)\n\tat
o.s.b.f.s.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636)\n\tat
o.s.b.f.s.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1335)\n\tat
o.s.b.f.s.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBe...\n"}
提前致谢!
看起来像是你的 spring-boot 版本和 Flyway 版本之间的兼容性问题。