• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception in thread "main" org.springframework.beans.factory.CannotLoadBeanClassException:

 
satheeshkumar vidadhala
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

Can anybody help me out from following issue.i have correctly configured bean.xml and bean class in xml.but i m getting classnotfound exception.. find below log

21 Aug, 2012 8:11:02 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [C:\Users\satheesh kumar\satheesh\softwares\workspace\Springs\src\com\tcs\spring\training\Bean.xml]
Exception in thread "main" org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.tcs.training.spring.DemoBean] for bean with name 'Demo' defined in file [C:\Users\satheesh kumar\satheesh\softwares\workspace\Springs\src\com\tcs\spring\training\Bean.xml]; nested exception is java.lang.ClassNotFoundException: com.tcs.training.spring.DemoBean
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1262)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:433)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at com.tcs.spring.training.DemoClient.main(DemoClient.java:24)
Caused by: java.lang.ClassNotFoundException: com.tcs.training.spring.DemoBean
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:258)
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:417)
at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1283)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1254)
... 6 more
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that the correct class with correct package? then is that class actually in your classpath?

Those to me would be the main reasons why that class is not found.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic