For this error, there can is different solutions. I have noted down the ones that had worked for me.
solution 1. This is all happened in deployment and debugging environment. In deployment environment, just make sure your server classpath have included the Spring Jar library (e.g Spring-4.0.4.jar) .
In debugging environment, the steps could vary from the different IDE, but the solution is same. In Eclipse, developers usually would create a tomcat, Jboss...whatever application Server for debugging, just make sure the C Orrect Spring jars is included.
- Double Click on your debugging server
- Click on the ' Open launch configuration ' to access the server environment
- Click on the Classpath tab
- Include the spring jar file here, it may also required common log jar due to Spring dependency.
- Done, run your application again.
.
Solution 2. If you is using Maven as a build tool and downloading dependencies using it, there can be some jar conflict. Because TOMCAT Servers normally provide some jars such as Servlet-api and Jpa-api. So if you again included them using Maven; There'll is problems in identifying them.
Solution 3. If you are using the Eclipse as your IDE and using Maven as your build tool and Tomcat as your server; Remember Tomcat server won't look on the jars which is just inside the folders. For that there ' s a small trick,
- Right click on your project and select Properties
- From the displayed window, select Deployment Assembly
- Select Add
- ADD Maven Dependencies
- Click Apply and click OK
Hope One of these solutions would help you to solve your problem. Happy Coding and make sure which is using Java.
Original address: https://stackoverflow.com/questions/15989325/ java-lang-noclassdeffounderror-org-springframework-context-applicationcontext/22746332#22746332
Eclipse running project in Tomcat environment Noclassdeffounderror/classnotfoundexception solution