Comments (4)
Hi Ebeid,
did you do some changes to your Spring applications configuration lately? Usually, when you use the spring boot starter library, it should replace the default JarLocationScanner with the SpringBootLocationScanner that knows how to handle the some specialties that are introduced by Spring. According to you log output, your application is still using the JarLocationScanner. To me it seems that the Spring auto configuration is not executed. Can you verify this?
Do you have this problem only when you start the standalone jar or also when you run the application inside your IDE.
Cheers
Patrick
from cassandra-migration.
Thanks for the quick pointer Patrick.
We fixed the error by explicitly using SpringBootLocationScanner in our implementation below:
@SpringBootApplication(scanBasePackages={"com.myservice"})
public class MyServiceApplication {
private static final Logger logger = LoggerFactory.getLogger(MyServiceApplication.class);
public static void main(String[] args) {
Builder b = Cluster.builder().addContactPoint(EnvironmentVariables.getCassandraHost());
b.withPort(Integer.parseInt(EnvironmentVariables.getCassandraPort()));
Cluster cluster = b.build();
Database database = new Database(cluster, EnvironmentVariables.getCassandraKeySpace());
MigrationTask migration = new MigrationTask(database, createMigrationRepository());
migration.migrate();
run(MyServiceApplication.class, args);
}
private static MigrationRepository createMigrationRepository(){
ScannerRegistry registry = new ScannerRegistry();
registry.register(ScannerRegistry.JAR_SCHEME, new SpringBootLocationScanner());
return new MigrationRepository("cassandra/migration", new IgnoreDuplicatesCollector(), registry);
}
}
While we fixed our problem we realized that CassandraMigrationAutoConfiguration was running a second time after our custom migration (depicted above) runs and Spring server starts.
To prevent this we fall back to using:
compile('org.cognitor.cassandra:cassandra-migration:2.1.2')
And including SpringBootLocationScanner source to our codebase and refer from there.
Thanks again!
from cassandra-migration.
Hi Ebeid,
normally you should be able to exclude the CassandraMigrationAutoConfiguration in your configuration code like this:
@EnableAutoConfiguration(exclude = CassandraMigrationAutoConfiguration.class)
This would allow you to use the SpringBootLocationScanner from the dependency without making a copy into your codebase which is in general not a good practice as you will be excluded from every update that will happen to it.
Does the Spring auto configuration not work for you? As far as I can tell you are not doing anything special except for the IgnoreDuplicatesCollector.
Cheers
Patrick
from cassandra-migration.
Hallo Patrick,
While using version 2.2.0 on windows, with both the Jars included, my Spring boot Maven application is working fine. But when is used it on Linux, i am facing the issue as mentioned by Ebeid.
I tried the solution mentioned by Ebeid with version 2.1.2 (Scanner locally and only one Jar included) and it's working on both Windows & Linux environments.
Regards,
Chandra
from cassandra-migration.
Related Issues (20)
- Upgrade to Cassandra driver 4 HOT 3
- Cassandra RetryPolicy can't be used HOT 8
- Support for Amazon Keyspaces (AWS MCS) HOT 2
- Default Migration Path is not Found HOT 3
- Failing tests on Windows HOT 1
- Spring boot 2.3.* support HOT 11
- configure timeout HOT 5
- 2.5.0_v4 not available from maven HOT 3
- How can i use this tool on a existing cassandra db? HOT 1
- Spring Actuator support HOT 1
- new release? HOT 2
- Caused by: java.nio.file.NoSuchFileException: cassandra/migration HOT 2
- MIT licensed Antlr4 parser HOT 4
- Does it work with spring boot 3 and java 17? HOT 5
- CassandraMigrationAutoConfiguration.MIGRATION_TASK_BEAN_NAME not published HOT 2
- Getting the following warning when migrating: "This is an anti-pattern that should be avoided in production" HOT 1
- CREATE TABLE IF NOT EXISTS not working HOT 2
- Synchronization with spring boot HOT 2
- dateOf() is removed from Cassandra 5.0 HOT 7
- Add migration listener
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cassandra-migration.