Coder Social home page Coder Social logo

Comments (7)

alexciornii avatar alexciornii commented on May 22, 2024

@nicholassmith Please share more of the stack trace. Also try to use 3.2.2.BETA version of mongock-spring.

from mongock.

dieppa avatar dieppa commented on May 22, 2024

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.

nicholassmith avatar nicholassmith commented on May 22, 2024

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.

dieppa avatar dieppa commented on May 22, 2024

Hi @nicholassmith , we'll be looking at this evening. I will come back to you.

Cheers

from mongock.

nicholassmith avatar nicholassmith commented on May 22, 2024

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.

dieppa avatar dieppa commented on May 22, 2024

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.

dieppa avatar dieppa commented on May 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.