org.springframework.beans.factory.BeanCreationException

tip

You might've forgot to add a dependency or it's written wrong. Also, you might be using incompatible versions of Java and Hibernate. More on this here: https://goo.gl/SjSlRA

tip

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.

tip

Check if you didn't forget to instantiate your topic in the kafka broker.

tip

NoClassDefFoundError means java has failed to find a class you're trying to instantiate, look if you've added the class you're trying to instantiate to the dependencies.

tip

This error means there's a class missing in your classpath during runtime. You need to create a jar with all your dependencies and have it in your classpath. Check Maven Assembly Plugin and how to add your dependencies to a jar: https://goo.gl/U2zr8k

tip

jsp-api and servlet-api jars must NOT be deployed by your web app. They should be marked as provided but not deployed by your app.

tip

You need to add httpcore to your dependencies. Try adding version 4.3 or further.

tip

The server rejects all jars that already belong to the server runtime (such as tomcat-**.jar, servlet**.jar). Consider substituting the CORS filter you're using for this one: https://goo.gl/ctQ7Fs

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

  • I'm using the embedded LDAP server for development and testing. It blows up with Caused by: java.lang.ClassNotFoundException: org.apache.directory.shared.ldap.name.LdapDN Stack trace below. A search reveals that this class is in these jars: http://www.jarfinder.com/index.php/java/info/org.apache.directory.shared.ldap.name.LdapDN.2 which all date from earlier versions of shared-ldap, latest there is 0.9.13. There is a 0.9.19 with the current (1.5.7) ApacheDS distro but it doesn't have the exception class for name not found. Using shared-all.0.9.18 gets you to the exception for missing name class. I looked at an earlier version of ApacheDS, which included Spring 2.0 jars, didn't pursue it. Everything needed to reproduce this is in the little attachment, source, xml, and list of jars. This is a Java console app. Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.apacheDirectoryServerContainer': Resolution of declared constructors on bean Class [org.springframework.security.ldap.server.ApacheDSContainer] from ClassLoader [sun.misc.Launcher$AppClassLoader@a90653] failed; nested exception is java.lang.NoClassDefFoundError: org/apache/directory/shared/ldap/name/LdapDN at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:160) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93) at com.kve.requisitions.main.Main.main(Main.java:19) Caused by: java.lang.NoClassDefFoundError: org/apache/directory/shared/ldap/name/LdapDN at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2402) at java.lang.Class.getDeclaredConstructors(Class.java:1851) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:157) ... 14 more Caused by: java.lang.ClassNotFoundException: org.apache.directory.shared.ldap.name.LdapDN at java.net.URLClassLoader$1.run(URLClassLoader.java:299) at java.net.URLClassLoader$1.run(URLClassLoader.java:288) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:287) at java.lang.ClassLoader.loadClass(ClassLoader.java:399) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:325) at java.lang.ClassLoader.loadClass(ClassLoader.java:332) ... 18 more
    via by Harry Clark,
  • I'm using the embedded LDAP server for development and testing. It blows up with Caused by: java.lang.ClassNotFoundException: org.apache.directory.shared.ldap.name.LdapDN Stack trace below. A search reveals that this class is in these jars: http://www.jarfinder.com/index.php/java/info/org.apache.directory.shared.ldap.name.LdapDN.2 which all date from earlier versions of shared-ldap, latest there is 0.9.13. There is a 0.9.19 with the current (1.5.7) ApacheDS distro but it doesn't have the exception class for name not found. Using shared-all.0.9.18 gets you to the exception for missing name class. I looked at an earlier version of ApacheDS, which included Spring 2.0 jars, didn't pursue it. Everything needed to reproduce this is in the little attachment, source, xml, and list of jars. This is a Java console app. Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.apacheDirectoryServerContainer': Resolution of declared constructors on bean Class [org.springframework.security.ldap.server.ApacheDSContainer] from ClassLoader [sun.misc.Launcher$AppClassLoader@a90653] failed; nested exception is java.lang.NoClassDefFoundError: org/apache/directory/shared/ldap/name/LdapDN at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:160) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93) at com.kve.requisitions.main.Main.main(Main.java:19) Caused by: java.lang.NoClassDefFoundError: org/apache/directory/shared/ldap/name/LdapDN at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2402) at java.lang.Class.getDeclaredConstructors(Class.java:1851) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:157) ... 14 more Caused by: java.lang.ClassNotFoundException: org.apache.directory.shared.ldap.name.LdapDN at java.net.URLClassLoader$1.run(URLClassLoader.java:299) at java.net.URLClassLoader$1.run(URLClassLoader.java:288) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:287) at java.lang.ClassLoader.loadClass(ClassLoader.java:399) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:325) at java.lang.ClassLoader.loadClass(ClassLoader.java:332) ... 18 more
    via by Harry Clark,
  • 1.0.0RC1 failed to get _meta
    via GitHub by peakji
    ,
  • Cant connect to mongodb
    via GitHub by Crossener
    ,
  • Error creating index on elastic search
    via Stack Overflow by Boti
    ,
    • org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.apacheDirectoryServerContainer': Resolution of declared constructors on bean Class [org.springframework.security.ldap.server.ApacheDSContainer] from ClassLoader [sun.misc.Launcher$AppClassLoader@a90653] failed; nested exception is java.lang.NoClassDefFoundError: org/apache/directory/shared/ldap
    • ame/LdapDN at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:160) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93) at com.kve.requisitions.main.Main.main(Main.java:19) Caused by: java.lang.NoClassDefFoundError: org/apache/directory/shared/ldap
    • ame/LdapDN at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2402) at java.lang.Class.getDeclaredConstructors(Class.java:1851) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:157) ... 14 more Caused by: java.lang.ClassNotFoundException: org.apache.directory.shared.ldap.name.LdapDN at java.net.URLClassLoader$1.run(URLClassLoader.java:299) at java.net.URLClassLoader$1.run(URLClassLoader.java:288) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:287) at java.lang.ClassLoader.loadClass(ClassLoader.java:399) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:325) at java.lang.ClassLoader.loadClass(ClassLoader.java:332) ... 18 more

    Users with the same issue

    treefolk
    6 times, last one,
    andyglick
    18 times, last one,
    Nikolay Rybak
    1 times, last one,
    Hronom
    6 times, last one,
    Unknown visitor1 times, last one,
    1195 more bugmates