org.springframework.beans.factory.CannotLoadBeanClassException

tip

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.

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

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

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

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

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.

  • WebSphere MQ resource adapter on JBoss Fuse
    via Stack Overflow by Vladimir
    ,
  • Doesn't like my config files.
    via GitHub by whikloj
    ,
  • Launch Spoon. A long error dialogue will come up with this in it: "Cannot find class [org.pentaho.agilebi.pdi.visualizations.pdf.PDFVisualization] for bean with name 'visualizationBean' defined in file [/home/valour/Desktop/agilebi_11810/plugins/spoon/agile-bi/visualizations/pdf/plugin.xml]; nested exception is java.lang.ClassNotFoundException: org.pentaho.agilebi.pdi.visualizations.pdf.PDFVisualization" And the stack trace from the command line is: ERROR 18-01 11:39:42,933 - Spoon - Fatal error : org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.pentaho.agilebi.pdi.visualizations.pdf.PDFVisualization] for bean with name 'visualizationBean' defined in file [/home/valour/Desktop/agilebi_11810/plugins/spoon/agile-bi/visualizations/pdf/plugin.xml]; nested exception is java.lang.ClassNotFoundException: org.pentaho.agilebi.pdi.visualizations.pdf.PDFVisualization ERROR 18-01 11:39:42,934 - Spoon - org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.pentaho.agilebi.pdi.visualizations.pdf.PDFVisualization] for bean with name 'visualizationBean' defined in file [/home/valour/Desktop/agilebi_11810/plugins/spoon/agile-bi/visualizations/pdf/plugin.xml]; nested exception is java.lang.ClassNotFoundException: org.pentaho.agilebi.pdi.visualizations.pdf.PDFVisualization at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1141) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:524) at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1177) at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:758) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:422) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:140) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:84) at org.pentaho.agilebi.pdi.visualizations.VisualizationManager.loadVisualizationFile(VisualizationManager.java:96) at org.pentaho.agilebi.pdi.visualizations.VisualizationManager.loadVisualizations(VisualizationManager.java:70) at org.pentaho.agilebi.pdi.visualizations.VisualizationManager.<init>(VisualizationManager.java:54) at org.pentaho.agilebi.pdi.visualizations.VisualizationManager.getInstance(VisualizationManager.java:42) at org.pentaho.di.core.lifecycle.pdi.AgileBILifecycleListener.onStart(AgileBILifecycleListener.java:42) at org.pentaho.di.core.lifecycle.LifecycleSupport.onStart(LifecycleSupport.java:40) at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:446) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.pentaho.commons.launcher.Launcher.main(Launcher.java:110) Caused by: java.lang.ClassNotFoundException: org.pentaho.agilebi.pdi.visualizations.pdf.PDFVisualization at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at org.springframework.util.ClassUtils.forName(ClassUtils.java:211) at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:385) at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1138) ... 20 more
    via by Jem Matzan,
  • Bean Creation Exception with JBoss 5.1.2
    via Stack Overflow by ajit kumar
    ,
  • Classes not visible to OSGified Spring
    via Stack Overflow by baba
    ,
  • Spring data neo4j aspectJ setup error
    via Stack Overflow by maxsap
    ,
  • Spring framework execution error
    via Stack Overflow by Jahanzaib Suleman
    ,
    • org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [TestBean] for bean with name 'tb' defined in file [E:\Spring\SpringAnno1\.\src\DemoCfg.xml]; nested exception is java.lang.ClassNotFoundException: TestBean at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1173) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:479) at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:787) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:393) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:736) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:369) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:126) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:69) at com.db.anno.TestClient.main(TestClient.java:7) Caused by: java.lang.ClassNotFoundException: TestBean at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at org.springframework.util.ClassUtils.forName(ClassUtils.java:230) at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:381) at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1170) ... 8 more

    Users with the same issue

    marcbouvierdav
    26 times, last one,
    Andreas Häber
    25 times, last one,
    Unknown visitor1 times, last one,
    batwalrus76
    2 times, last one,
    Unknown visitor1 times, last one,
    2285 more bugmates