上课未找到例外弹簧

时间:2014-05-03 21:17:58

标签: java spring

我试图编译并运行我的应用程序代码但是我得到一个类未找到异常我将打印堆栈跟踪我希望有人可以帮助我。

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

1 个答案:

答案 0 :(得分:0)

从您的例外中可以清楚地看出,您的类路径中没有所有弹簧罐。

如果您使用maven,请在pom.xml中添加所有依赖项。

否则从spring source下载jar并将它们添加到项目类路径中。

添加并运行后,它将正常运行。

我没有看到任何与aplication相关的错误。它唯一的罐子问题。

缺少罐子或版本不匹配。检查一下。