简体   繁体   中英

class not found exception spring

i tried to compile and run my application code but i get a class not found exception i will print the stack trace i hope there is someone can help me .

236 [main] INFO    org.springframework.context.support.ClassPathXmlApplicationContext   - Refreshing    org.springframework.context.support.ClassPathXmlApplicationContext@37eaab:     startup date    [Sat May 03 21:15:12 CEST 2014]; root of context hierarchy
 472 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - L     oading        XML bean definitions from URL           [file:/C:/Users/housseminfo/workspace/ERP_PCD/target/classes/META-      INF/applicationContext.xml]
1017 [main] INFO org.springframework.context.annotation.ClassPathBeanDefinitionScanner       - JSR-330 'javax.inject.Named' annotation found and supported for component scanning
1242 [main] INFO          org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor - JSR-330        'javax.inject.Inject' annotation found and supported for autowiring
1272 [main] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory -        Destroying singletons in     org.springframework.beans.factory.support.DefaultListableBeanFactory@59727ed4: defining     beans       [datasource,persistenceUnitManager,entityManagerFactory,entityManager,transactionManager,o        g.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annot ation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.Tr ansactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,op manager,metier,org.springframework.context.annotation.internalConfigurationAnnotationProces sor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springf ramework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context .annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.intern alPersistenceAnnotationProcessor,org.springframework.context.annotation.ConfigurationClassP ostProcessor.importAwareProcessor]; root of factory hierarchy
 Exception in thread "main" org.springframework.beans.factory.BeanCreationException:    Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator':    Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError:     org/springframework/core/io/support/SpringFactoriesLoader
at       org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(A    bstractAutowireCapableBeanFactory.java:532)
at     org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(Abs    tractAutowireCapableBeanFactory.java:461)
at        org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFacto    ry.java:295) at     org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(Default   SingletonBeanRegistry.java:223) at     org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292 at       org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.j    ava:198)
at        org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(A    bstractApplicationContext.java:741) at       org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationC    ontext.java:464)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>    (ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>       (ClassPathXmlApplicationContext.java:83)
at com.ensi.dao.Maintest.main(Maintest.java:13)
Caused by: java.lang.NoClassDefFoundError:         org/springframework/core/io/support/SpringFactoriesLoader
at org.springframework.beans.CachedIntrospectionResults.<clinit>       (CachedIntrospectionResults.java:65)
at         org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.jav    a:321)
at       org.springframework.beans.BeanWrapperImpl.getPropertyDescriptors(BeanWrapperImpl.java:328)
at      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.filterProperty    DescriptorsForDependencyCheck(AbstractAutowireCapableBeanFactory.java:1279)
at       org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.filterProperty    at     org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(A    bstractAutowireCapableBeanFactory.java:1117)
at            org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(A     bstractAutowireCapableBeanFactory.java:522)
.. 10 more
 Caused by: java.lang.ClassNotFoundException:          org.springframework.core.io.support.SpringFactoriesLoader
at java.net.URLClassLoader$1.run(Unknown Source)
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)
... 17 more

Hi its very clear from your exception that , you dont have all spring jars in your classpath.

if you are using maven add all dependencies in pom.xml.

otherwise download the jars from spring source and add them into project classpath.

once you add and run , it will work properly.

i don't see any aplication related errors over there. its only jar problem.

either missing jars or version mismatch. check it properly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM