Comments (7)
@nicholassmith Please share more of the stack trace. Also try to use 3.2.2.BETA version of mongock-spring.
from mongock.
Thanks @nicholassmith.
At first I can see one important thing, you are mixing standalone mongock with springMongock,. You're probably using Springboot, so I suggest this:
new SpringBootMongockBuilder(mongoClient, "yourDbName", "com.package.to.be.scanned.for.changesets") .setApplicationContext(springContext) .setLockQuickConfig() .build();
SpringContext is optional, but very helpful if you require any other dependency than MongoTempalte/MongoDatabase in your changeSet.
The lock is also optional, but highly recommended as without this, the lock behaviour is the legacy one, and is very poor, if anything happens, doesn't unlock for 24hours, but doesn't throw any exception if lock cannot be acquired.
Also, if you use the last versión, 3.2.2.BETA, as @alexciornii suggest, you can initialise SpringBootMongockBuilder with MongoTemplate, having something like this:
new SpringBootMongockBuilder(mongotemplate,"com.package.to.be.scanned.for.changesets") .setApplicationContext(springContext) .setLockQuickConfig() .build();
Please have a try with that, and let us know ;)
from mongock.
Thanks for the replies! @alexciornii here's further stack trace:
Caused by: java.lang.IllegalArgumentException: null
at org.objectweb.asm.ClassVisitor.<init>(Unknown Source)
at net.sf.cglib.core.DebuggingClassWriter.<init>(DebuggingClassWriter.java:49)
at net.sf.cglib.core.DefaultGeneratorStrategy.getClassVisitor(DefaultGeneratorStrategy.java:30)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:24)
at net.sf.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:329)
at net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93)
at net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:91)
at net.sf.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at net.sf.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61)
at net.sf.cglib.core.internal.LoadingCache.get(LoadingCache.java:34)
at net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:116)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:291)
at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:221)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:174)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:153)
at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:73)
... 12 common frames omitted
I can't use 3.2.2.BETA
however as it pulls in the latest version of some Spring dependencies which breaks a lot of our response layer code, even with them excluded as dependencies:
compile ('com.github.cloudyrock.mongock:mongock-core:3.2.1.BETA') {
exclude group: 'org.springframework'
}
compile ("com.github.cloudyrock.mongock:mongock-spring:3.2.1.BETA") {
exclude group: 'org.springframework'
}
from mongock.
Hi @nicholassmith , we'll be looking at this evening. I will come back to you.
Cheers
from mongock.
Got further, the exclude has to be very specific org.springframework.data
in my case, however I get snagged on A component required a bean of type 'com.mongodb.DB' that could not be found.
instead. I suspect that because we're trying to use a much older version of Spring Boot there's some requirement mismatches.
from mongock.
Sorry @nicholassmith , I wasn't able to have a look yesterday. I will try today, but I cannot commit as we got something urgent. I will keep you posted.
However, it seems, as you say, you are using an older version.
On the bright side, we are refactoring the entire framework in such a way we are going to provide much better support for old versions of frameworks(spring, etc), driver and MongoDB(3.X, 4.X), etc.) But this hasn't been released yet and I don't this will be ready until next month. So, we'll try to fix your current issue and then, my suggestion is to move to the new refactored version(keeping the versions of Spring, etc you are using)
As said, I will keep you posted
from mongock.
Hello @nicholassmith , I don't know if you have worked it around or not. But Just for you to know that com.mongodb.DB is not supported in the new 3.X version( I just realised it now, after reading your message again). You should use MongoDatabase.
Let me know how it goes
from mongock.
Related Issues (20)
- Mongock build AOT fail in Spring Boot 3.0.1 HOT 15
- missing io.mongock.runner.core.builder.RunnerBuilder bean when running migration through CLI HOT 4
- Security: OWASP CVE-2021-4277 (5.3) HOT 5
- Can not use Mongock with replacement for BSON type DATE_TIME HOT 3
- Documentation Issue: ChangeSet Javadoc HOT 1
- System migrations don't respect transaction settings HOT 3
- Releases at Github HOT 1
- Spring Boot 3 Support for mongodb-reactive-driver HOT 4
- Migrations are not applied to DB. Also there is no logs related to mongock while running application HOT 1
- retryable writes error for mongock-examples/mongodb/standalone-reactive/ example HOT 1
- ClassCastException after upgrading from Mongock 4.1.14 to 5.2.4 HOT 6
- Clarify ordering mechanism in docs HOT 5
- upgrade guava to 32.0.0-jre to fix CVE-2020-8908 and CVE-2023-2976 HOT 2
- Support for Elasticsearch with an Elasticsearch driver HOT 1
- Change Unit is not working with spring boots's annotation @CompoundIndex on entity class HOT 5
- default-migration-author not applied in spring context HOT 2
- business related questions HOT 6
- Injecting beans by name HOT 4
- Unable to specify/override ReadConcern for transactional ChangeUnits HOT 1
- Mongock migration for MongoDB on CosmosDB fails HOT 2
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 mongock.