org.springframework.beans.factory.BeanCreationException

Error creating bean with name 'fileRegistrar' defined in org.springframework.cloud.stream.config.codec.kryo.KryoCodecAutoConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.integration.codec.kryo.KryoRegistrar]: Factory method 'fileRegistrar' threw exception; nested exception is java.lang.NoClassDefFoundError: org/objenesis/strategy/InstantiatorStrategy

Samebug tips9

A few things cause this exception: 1) Check if you have all jars and if they're in the correct path when running. 2) Your classpath might be broken, you can define it in the command line with "java -cp yourClassPath" or at your IDE if you're using one.


rafaelrafael

If you're using Hibernate, this indicates you're missing FasterXML Classmate dependency, which you can add to your dependencies. To add it, the groupId is com.fasterxml and artifactId is Classmate.


rafaelrafael

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.

Solutions on the web17798

  • via GitHub by alexkolson
    ,
  • via Unknown by Unknown author,
  • via Unknown by Unknown author,
  • Stack trace

    • org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileRegistrar' defined in org.springframework.cloud.stream.config.codec.kryo.KryoCodecAutoConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.integration.codec.kryo.KryoRegistrar]: Factory method 'fileRegistrar' threw exception; nested exception is java.lang.NoClassDefFoundError: org/objenesis/strategy/InstantiatorStrategy at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)[spring-beans-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)[spring-beans-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)[spring-beans-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)[spring-beans-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)[spring-beans-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)[spring-beans-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)[spring-beans-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)[spring-beans-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)[spring-beans-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:775)[spring-beans-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)[spring-context-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)[spring-context-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)[spring-boot-1.4.0.RC1.jar!/:1.4.0.RC1] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369)[spring-boot-1.4.0.RC1.jar!/:1.4.0.RC1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)[spring-boot-1.4.0.RC1.jar!/:1.4.0.RC1] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134)[spring-boot-1.4.0.RC1.jar!/:1.4.0.RC1] at org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinder(DefaultBinderFactory.java:156)[spring-cloud-stream-1.0.0.RELEASE.jar!/:1.0.0.RELEASE] at org.springframework.cloud.stream.binding.ChannelBindingService.getBinderForChannel(ChannelBindingService.java:142)[spring-cloud-stream-1.0.0.RELEASE.jar!/:1.0.0.RELEASE] at org.springframework.cloud.stream.binding.ChannelBindingService.bindProducer(ChannelBindingService.java:104)[spring-cloud-stream-1.0.0.RELEASE.jar!/:1.0.0.RELEASE] at org.springframework.cloud.stream.binding.BindableProxyFactory.bindOutputs(BindableProxyFactory.java:205)[spring-cloud-stream-1.0.0.RELEASE.jar!/:1.0.0.RELEASE] at org.springframework.cloud.stream.binding.OutputBindingLifecycle.start(OutputBindingLifecycle.java:57)[spring-cloud-stream-1.0.0.RELEASE.jar!/:1.0.0.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:173)[spring-context-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:51)[spring-context-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:346)[spring-context-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:149)[spring-context-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:112)[spring-context-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:874)[spring-context-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144)[spring-boot-1.4.0.RC1.jar!/:1.4.0.RC1] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544)[spring-context-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)[spring-boot-1.4.0.RC1.jar!/:1.4.0.RC1] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)[spring-boot-1.4.0.RC1.jar!/:1.4.0.RC1] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369)[spring-boot-1.4.0.RC1.jar!/:1.4.0.RC1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)[spring-boot-1.4.0.RC1.jar!/:1.4.0.RC1] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134)[spring-boot-1.4.0.RC1.jar!/:1.4.0.RC1] at org.apereo.cas.mgmt.web.CasManagementWebApplication.main_aroundBody0(CasManagementWebApplication.java:58)[cas-management-webapp-support-5.0.0.M3.jar!/:5.0.0.M3] at org.apereo.cas.mgmt.web.CasManagementWebApplication$AjcClosure1.run(CasManagementWebApplication.java:1)[cas-management-webapp-support-5.0.0.M3.jar!/:5.0.0.M3] at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)[aspectjrt-1.8.9.jar!/:?] at org.apereo.inspektr.aspect.TraceLogAspect.traceMethod(TraceLogAspect.java:74)[inspektr-aspects-1.5.GA.jar!/:1.5.GA] at org.apereo.cas.mgmt.web.CasManagementWebApplication.main(CasManagementWebApplication.java:57)[cas-management-webapp-support-5.0.0.M3.jar!/:5.0.0.M3] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[?:1.8.0_05] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[?:1.8.0_05] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[?:1.8.0_05] at java.lang.reflect.Method.invoke(Method.java:483)[?:1.8.0_05] at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)[cas-management.war:5.0.0.M3] at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)[cas-management.war:5.0.0.M3] at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)[cas-management.war:5.0.0.M3] at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:59)[cas-management.war:5.0.0.M3] Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.integration.codec.kryo.KryoRegistrar]: Factory method 'fileRegistrar' threw exception; nested exception is java.lang.NoClassDefFoundError: org/objenesis/strategy/InstantiatorStrategy at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)[spring-beans-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)[spring-beans-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] ... 46 more Caused by: java.lang.NoClassDefFoundError: org/objenesis/strategy/InstantiatorStrategy at org.springframework.integration.codec.kryo.AbstractKryoRegistrar.<clinit>(AbstractKryoRegistrar.java:35)[spring-integration-core-4.3.0.RELEASE.jar!/:4.3.0.RELEASE] at org.springframework.cloud.stream.config.codec.kryo.KryoCodecAutoConfiguration.fileRegistrar(KryoCodecAutoConfiguration.java:61)[spring-cloud-stream-codec-1.0.0.RELEASE.jar!/:1.0.0.RELEASE] at org.springframework.cloud.stream.config.codec.kryo.KryoCodecAutoConfiguration$$EnhancerBySpringCGLIB$$f1c41e78.CGLIB$fileRegistrar$0(<generated>)[spring-cloud-stream-codec-1.0.0.RELEASE.jar!/:1.0.0.RELEASE] at org.springframework.cloud.stream.config.codec.kryo.KryoCodecAutoConfiguration$$EnhancerBySpringCGLIB$$f1c41e78$$FastClassBySpringCGLIB$$7753b721.invoke(<generated>)[spring-cloud-stream-codec-1.0.0.RELEASE.jar!/:1.0.0.RELEASE] at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)[spring-core-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)[spring-context-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] at org.springframework.cloud.stream.config.codec.kryo.KryoCodecAutoConfiguration$$EnhancerBySpringCGLIB$$f1c41e78.fileRegistrar(<generated>)[spring-cloud-stream-codec-1.0.0.RELEASE.jar!/:1.0.0.RELEASE] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[?:1.8.0_05] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[?:1.8.0_05] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[?:1.8.0_05] at java.lang.reflect.Method.invoke(Method.java:483)[?:1.8.0_05] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)[spring-beans-4.3.1.RELEASE.jar!/:4.3.1.RELEASE] ... 47 more Caused by: java.lang.ClassNotFoundException: org.objenesis.strategy.InstantiatorStrategy at java.net.URLClassLoader$1.run(URLClassLoader.java:372)[?:1.8.0_05] at java.net.URLClassLoader$1.run(URLClassLoader.java:361)[?:1.8.0_05] at java.security.AccessController.doPrivileged(Native Method)[?:1.8.0_05] at java.net.URLClassLoader.findClass(URLClassLoader.java:360)[?:1.8.0_05] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)[?:1.8.0_05] at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:89)[cas-management.war:5.0.0.M3] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[?:1.8.0_05] ... 59 more

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    Unknown visitor
    Unknown visitorOnce,
    Unknown visitor
    Unknown visitorOnce,
    Unknown visitor
    Unknown visitorOnce,
    Unknown visitor
    Unknown visitorOnce,
    Unknown visitor
    Unknown visitorOnce,
    2363 more bugmates