Closed hilbert-ralf closed 2 years ago
What I did to migrate my service to the new flapdoodle:
IMongodConfig -> MongodConfig IRuntimeConfig -> RuntimeConfig
new MongoConfigBuilder -> MongoConfig.builder()
new RuntimeConfigBuilder().defaultsWithLogger(Command.MongoD, logger.underlying).build() -> Defaults.runtimeConfigFor(Command.MongoD, logger.underlying).build()
I have exactly the same issue after updating from 2.2.0 to 3.0.0 in several project running Spring Boot 2.3.X. And I do not use IRuntimeConfig as well but still getting this message.
My stacktrace:
java.lang.IllegalArgumentException: Could not find class [de.flapdoodle.embed.process.config.IRuntimeConfig] at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:334) ~[spring-core-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.core.annotation.TypeMappedAnnotation.adapt(TypeMappedAnnotation.java:446) ~[spring-core-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.core.annotation.TypeMappedAnnotation.getValue(TypeMappedAnnotation.java:369) ~[spring-core-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.core.annotation.TypeMappedAnnotation.asMap(TypeMappedAnnotation.java:284) ~[spring-core-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.core.annotation.AbstractMergedAnnotation.asAnnotationAttributes(AbstractMergedAnnotation.java:193) ~[spring-core-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.core.type.AnnotatedTypeMetadata.getAnnotationAttributes(AnnotatedTypeMetadata.java:106) ~[spring-core-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.context.annotation.AnnotationConfigUtils.attributesFor(AnnotationConfigUtils.java:285) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.context.annotation.AnnotationBeanNameGenerator.determineBeanNameFromAnnotation(AnnotationBeanNameGenerator.java:102) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.context.annotation.AnnotationBeanNameGenerator.generateBeanName(AnnotationBeanNameGenerator.java:81) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.registerBeanDefinitionForImportedConfigurationClass(ConfigurationClassBeanDefinitionReader.java:160) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:141) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:120) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:331) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:236) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:280) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:96) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:707) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:533) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.5.RELEASE.jar:2.3.5.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot-2.3.5.RELEASE.jar:2.3.5.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) ~[spring-boot-2.3.5.RELEASE.jar:2.3.5.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405) ~[spring-boot-2.3.5.RELEASE.jar:2.3.5.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.3.5.RELEASE.jar:2.3.5.RELEASE] at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:120) ~[spring-boot-test-2.3.5.RELEASE.jar:2.3.5.RELEASE] at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) ~[spring-test-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) ~[spring-test-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:123) ~[spring-test-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118) ~[spring-test-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) ~[spring-test-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener.prepareTestInstance(SpringBootDependencyInjectionTestExecutionListener.java:43) ~[spring-boot-test-autoconfigure-2.3.5.RELEASE.jar:2.3.5.RELEASE] at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:244) ~[spring-test-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.spockframework.spring.SpringTestContextManager.prepareTestInstance(SpringTestContextManager.java:56) ~[spock-spring-1.3-groovy-2.5.jar:1.3] at org.spockframework.spring.SpringInterceptor.interceptInitializerMethod(SpringInterceptor.java:43) ~[spock-spring-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.extension.AbstractMethodInterceptor.intercept(AbstractMethodInterceptor.java:24) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:97) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:475) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.BaseSpecRunner.runInitializer(BaseSpecRunner.java:341) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.BaseSpecRunner.runInitializer(BaseSpecRunner.java:336) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.BaseSpecRunner.initializeAndRunIteration(BaseSpecRunner.java:274) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.BaseSpecRunner.runSimpleFeature(BaseSpecRunner.java:266) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.BaseSpecRunner.doRunFeature(BaseSpecRunner.java:260) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.BaseSpecRunner$5.invoke(BaseSpecRunner.java:243) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:484) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:467) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.BaseSpecRunner.runFeature(BaseSpecRunner.java:235) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.BaseSpecRunner.runFeatures(BaseSpecRunner.java:185) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.BaseSpecRunner.doRunSpec(BaseSpecRunner.java:95) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.BaseSpecRunner$1.invoke(BaseSpecRunner.java:81) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:484) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:467) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.BaseSpecRunner.runSpec(BaseSpecRunner.java:73) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.BaseSpecRunner.run(BaseSpecRunner.java:64) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.spockframework.runtime.Sputnik.run(Sputnik.java:63) ~[spock-core-1.3-groovy-2.5.jar:1.3] at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110) ~[na:na] at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58) ~[na:na] at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38) ~[na:na] at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62) ~[na:na] at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na] at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36) ~[na:na] at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) ~[na:na] at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33) ~[na:na] at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94) ~[na:na] at com.sun.proxy.$Proxy2.processTestClass(Unknown Source) ~[na:na] at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:119) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na] at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36) ~[na:na] at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) ~[na:na] at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182) ~[na:na] at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164) ~[na:na] at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414) ~[na:na] at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64) ~[na:na] at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na] at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56) ~[na:na] at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na] Caused by: java.lang.ClassNotFoundException: de.flapdoodle.embed.process.config.IRuntimeConfig at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) ~[na:na] at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[na:na] at java.base/java.lang.Class.forName0(Native Method) ~[na:na] at java.base/java.lang.Class.forName(Class.java:398) ~[na:na] at org.springframework.util.ClassUtils.forName(ClassUtils.java:284) ~[spring-core-5.2.10.RELEASE.jar:5.2.10.RELEASE] at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:324) ~[spring-core-5.2.10.RELEASE.jar:5.2.10.RELEASE] ... 82 common frames omitted
Hi, I had this same problem, and I notice that problem is in Spring Boot Auto Configuration problem solved by disable autocofig for embeddedMongo:
@SpringBootApplication(exclude = EmbeddedMongoAutoConfiguration.class)
and use your own configuration
Having same issue. Any solution for this error.
As @skarbu posted, the problem is spring boot which provides an auto configuration for embedded mongo based on version 2.2.0, guess we have to wait for spring boot project to update embedded mongo dependency and their auto configuration. Or do what @skarbu wrote and make your own configuration.
Hi there,
I take the liberty to comment to eventually avoid people wasting too much time.
After trying to exclude the auto configuration and implementing a custom class, my tests were still not running properly as there are other issues (like #326 and #327) and even after trying to fix that, if you are using @DataMongoTest
, it doesn't honor exclude
on a @SpringBootApplication
(which is expected) so it's certainly easier to stick with version 2.2.0 if you can. Hope it helps!
Same issue after migration to 3.0.0
Yes, this is good, but I think It's not solution but another work-around that's generate additional line of code. This should work on the same way like embedded h2, without breaking the pipeline in case of added only dependency.
//have this same issue in 3.0.0 and newest Spring Boot 2.4.3
This has been fixed with spring boot 2.5.0
- just use flapdoole 3.0.0 there and it should work out of the box. The main reason was, that the dependencies were mixed when one loaded fd 3.0.0 in the testImplementation while spring was considering 2.x
Spring Boot 3.0.0 will not longer run with fp 2.x in addition
Not only that, but Spring Boot 2.5.0 does not seem to support already flapdoodle 2.x. There is a dependency on import de.flapdoodle.embed.process.config.RuntimeConfig on autoconfigure's EmbeddedMongoAutoConfiguration. And this class was added on flapdoodle 3.
Is this still an issue? Does it work with the new release (3.2.0)?
I am using version 3.2.0 and getting the following error:
[error] Uncaught exception when running tests: java.lang.NoClassDefFoundError: de/flapdoodle/embed/process/config/IExecutableProcessConfig
[error] sbt.ForkMain$ForkError: java.lang.NoClassDefFoundError: de/flapdoodle/embed/process/config/IExecutableProcessConfig
[error] at java.base/java.lang.Class.forName0(Native Method)
[error] at java.base/java.lang.Class.forName(Class.java:416)
[error] at org.scalatest.tools.Framework$ScalaTestTask.loadSuiteClass(Framework.scala:404)
[error] at org.scalatest.tools.Framework$ScalaTestTask.suiteClass$lzycompute(Framework.scala:412)
[error] at org.scalatest.tools.Framework$ScalaTestTask.suiteClass(Framework.scala:412)
[error] at org.scalatest.tools.Framework$ScalaTestTask.accessible$lzycompute(Framework.scala:413)
SBT library dependency:
"de.flapdoodle.embed" % "de.flapdoodle.embed.mongo" % "3.2.0",
This has been fixed with spring boot
2.5.0
- just use flapdoole 3.0.0 there and it should work out of the box. The main reason was, that the dependencies were mixed when one loaded fd 3.0.0 in the testImplementation while spring was considering 2.xSpring Boot 3.0.0 will not longer run with fp 2.x in addition
This actually works. It looks like it boils down to backward incompatible versions...
@robert-blankenship there is an api change in 3.2.0 .. so you might have to change some code.
This has been fixed with spring boot
2.5.0
- just use flapdoole 3.0.0 there and it should work out of the box. The main reason was, that the dependencies were mixed when one loaded fd 3.0.0 in the testImplementation while spring was considering 2.xSpring Boot 3.0.0 will not longer run with fp 2.x in addition
Thanks, now 3.0.0 works but 3.1.3 - 3.2.2 fails with Failed to instantiate [de.flapdoodle.embed.process.config.RuntimeConfig]: Factory method 'embeddedMongoRuntimeConfig' threw exception; nested exception is java.lang.InstantiationError: de.flapdoodle.embed.process.config.io.ProcessOutput
Please advise
3.0.0 works great but 3.1.3 - 3.2.2 fails with:
Failed to instantiate [de.flapdoodle.embed.process.config.RuntimeConfig]: Factory method 'embeddedMongoRuntimeConfig' threw exception; nested exception is java.lang.InstantiationError: de.flapdoodle.embed.process.config.io.ProcessOutput
Has anyone solved the problem?
Same here
I did a new release where i backported some apis used by spring boot. Please try version 3.2.3.
Same problem with 3.2.3
Failed to instantiate [de.flapdoodle.embed.process.config.RuntimeConfig]: Factory method 'embeddedMongoRuntimeConfig' threw exception; nested exception is java.lang.InstantiationError: de.flapdoodle.embed.process.config.io.ProcessOutput
can you have a look at this issue? https://github.com/flapdoodle-oss/de.flapdoodle.embed.process/issues/128 which spring version do you use?
Not only that, but Spring Boot 2.5.0 does not seem to support already flapdoodle 2.x. There is a dependency on import de.flapdoodle.embed.process.config.RuntimeConfig on autoconfigure's EmbeddedMongoAutoConfiguration. And this class was added on flapdoodle 3.
There is nothing to do
@nightswimmings so your problem is solved now?
No, I mean there is nothing to do to fix it, since Boot 2.5.0+ imposes flapdoodle 3.x
@nightswimmings can i help you somehow? I am not sure what do you want to achieve .. (was sick, still a little, thats why this late answer)
I really appreciate your support, but don't worry, my scenario is more complex because there is a third party dependency that must use flapdoodle 2.x, so not a problem of your project, unless you want to consider to push spring to support older versions of Mongo embedded. As long as mongo embedded uses flapdoodle 3, there should not be any problem with spring.
@nightswimmings hmm.. i see. I try to think about a solution ..
@nightswimmings .. is this still an issue? If needed, then i can backport this https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo.spring/tree/spring-2.6.x--embed-mongo-4.x to spring 2.5 ..
reopen, if needed.
After upgrading to version 3.0.0
I'm facing breaking tests caused by an class which cannot be found:
Before i used version 2.2.0 and everything did run fine. I'm not using the missing class IRuntimeConfig directly. As version 3.0.0 is very new i assume it might be a early adoper problem. Any idea?