在Web上迁移的flyway上找不到位置 [英] Location not found on flyway migrate on websphere
问题描述
我正在尝试在Websphere服务器上设置flyway迁移.
I'm trying to setup flyway-migration on Websphere server.
我的项目包含以下模块:
My project consists of the modules:
--projectwar.war
--projectsql.jar
--java
--MyFlywayUtil.class
-- resources
-- myscripts
--projectmodel.jar
--java
--MyRiskDataSourceConfig.class
MyRiskDataSourceConfig包含飞行路线迁移声明:
MyRiskDataSourceConfig contains flyway migration declaration:
@Bean(initMethod = "migrate")
public Flyway flyway(@Qualifier("myDataSource") DataSource dataSource) {
Flyway flyway = new Flyway();
flyway.setBaselineOnMigrate(true);
flyway.setClassLoader(MyFlywayUtil.class.getClassLoader());
flyway.setLocations("classpath:"+"myscripts");
flyway.setDataSource(dataSource);
return flyway;
}
在Tomcat下使用bootRun命令执行时,迁移可以正常工作并找到位置.
When executed under Tomcat using bootRun comand, migration works fine and location is found.
但是在Websphere之下,我收到以下消息:
However under Websphere I receive the following:
com.ibm.ws.classloader.CompoundClassLoader@bb6f8b91[app]
Local ClassPath
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/cell01/project.ear/project.war/WEB-INF/classes
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/cell01/project.ear/project.war/WEB-INF/lib/projectmodel.jar
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/cell01/project.ear/project.war/WEB-INF/lib/projectsql.jar
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/cell01/project.ear/project.war
Parent com.ibm.ws.classloader.ProtectionClassLoader@c26663d6 Delegation Mode PARENT_FIRST)
On WebSphere an empty file named flyway.location must be present on the classpath location for WebSphere to find it!
o.f.c.i.u.s.classpath.ClassPathScanner Unable to resolve location classpath myscripts
我已经尝试了有无flyway.setClassLoader();
I've tried configuration with and without flyway.setClassLoader();
任何帮助将不胜感激.
推荐答案
您还向包含迁移的文件夹中添加了一个名为 flyway.location
的(空)文件.我的案例解决了这个问题.
Did you also add an (empty) file with the name flyway.location
to the folder(s) containing your migrations, in my cases this fixed the problem.
Because of the way the IBM class-loader works this file has to be added as a workaround, see also the source
当然还有警告:
在WebSphere上,必须在类路径位置上存在一个名为flyway.location的空文件,WebSphere才能找到它!
On WebSphere an empty file named flyway.location must be present on the classpath location for WebSphere to find it!
这篇关于在Web上迁移的flyway上找不到位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!