While practicing spring, there was an error running the program: Java.lang.NoClassDefFoundError
java.lang.noclassdeffounderror:org/apache/commons/logging/logfactory at Org.springframework.context.support.AbstractApplicationContext.<init> (abstractapplicationcontext.java:161) at Org.springframework.context.support.AbstractApplicationContext.<init> (abstractapplicationcontext.java:225) at Org.springframework.context.support.AbstractRefreshableApplicationContext.<init> (abstractrefreshableapplicationcontext.java:88) at Org.springframework.context.support.AbstractRefreshableConfigApplicationContext.<init> (abstractrefreshableconfigapplicationcontext.java:58) at Org.springframework.context.support.AbstractXmlApplicationContext.<init> (abstractxmlapplicationcontext.java:61) at Org.springframework.context.support.ClassPathXmlApplicationContext.<init> (classpathxmlapplicationcontext.java:136) at Org.springframework.context.support.ClassPathXmlApplicationContext.<init> (classpathxmlapplicationcontext.java:83) at Com.spring.bao1.TestBeanPostProcessor.testBeanPostProcessor (Testbeanpostprocessor.java:11) at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at Sun.reflect.NativeMethodAccessorImpl.invoke (Nativemethodaccessorimpl.java:62) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (Delegatingmethodaccessorimpl.java:43) at Java.lang.reflect.Method.invoke (Method.java:498) at org.junit.runners.model.frameworkmethod$1.runReflectiveCall (frameworkmethod.java:50) at Org.junit.internal.runners.model.ReflectiveCallable.run (Reflectivecallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively (Frameworkmethod.java:47) at Org.junit.internal.runners.statements.InvokeMethod.evaluate (Invokemethod.java:17) at Org.junit.runners.ParentRunner.runLeaf (Parentrunner.java:325) at Org.junit.runners.BlockJUnit4ClassRunner.runChild (Blockjunit4classrunner.java:78) at Org.junit.runners.BlockJUnit4ClassRunner.runChild (Blockjunit4classrunner.java:57) at org.junit.runners.parentrunner$3.run (parentrunner.java:290) at org.junit.runners.parentrunner$1.schedule (parentrunner.java:71) at Org.junit.runners.ParentRunner.runChildren (Parentrunner.java:288) at org.junit.runners.parentrunner.access$(parentrunner.java:58) at org.junit.runners.parentrunner$2.evaluate (parentrunner.java:268) at Org.junit.runners.ParentRunner.run (Parentrunner.java:363) at Org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (Junit4testreference.java:86) at Org.eclipse.jdt.internal.junit.runner.TestExecution.run (Testexecution.java:38) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (Remotetestrunner.java:55X) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (Remotetestrunner.java:678) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (Remotetestrunner.java:382) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (Remotetestrunner.java:192) caused by:java.lang.ClassNotFoundException:org.apache.commons.logging.LogFactory at Java.net.URLClassLoader.findClass (URLClassLoader.java:381) at Java.lang.ClassLoader.loadClass (Classloader.java:424) at Sun.misc.launcher$appclassloader.loadclass (Launcher.java:331) at Java.lang.ClassLoader.loadClass (Classloader.java:357) ... More
The reason for this error is that a jar package is missing: Commons-logging.jar, this jar is one of Spring's essential packages, so it will get an error if it lacks it.
Error: Java.lang.NoClassDefFoundError