简体   繁体   中英

NoClassDefFoundError and ClassNotFoundException

I am using Eclipse and I have configured all the jars required for Spring Framework, it don't show any compilation error. But, when I run my main function(Test Class) it populates me this error. Am I missing something here? Please help me, could not find the actual solution to solve this problem.

 Feb 27, 2017 1:15:20 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
    INFO: Loading XML bean definitions from class path resource [applicationContext.xml]
    Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/expression/PropertyAccessor
        at org.springframework.context.support.AbstractApplicationContext.prepareBeanFactory(AbstractApplicationContext.java:481)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:398)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
        at com.javatpoint.Test.main(Test.java:14)
    Caused by: java.lang.ClassNotFoundException: org.springframework.expression.PropertyAccessor
        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)
        ... 5 more

Some dependencies are not required at compile time but just at runtime.

The missing class is contained in the spring-expression jar. You can download it and add it to Eclipse too.

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