0
votes

Any suggestions how to resolve this Spring MVC error?

Error configuring application listener of classError configuring application listener of class org.springframework.web.context.ContextLoaderListener java.lang.NoClassDefFoundError: org/springframework/core/env/EnvironmentCapable at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) at java.lang.ClassLoader.defineClass(ClassLoader.java:615) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2733)

//[redacted trace]

Caused by: java.lang.ClassNotFoundException: org.springframework.core.env.EnvironmentCapable at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)

2
have you downloaded and added the org.springframework.core jar to the application's classpath?smoggers
Yes, I did. Actually, it worked yesterday, but when I run today, it throws all errorPeter
ok let me ask you this, are all your org.springframework..... jars the same version number as this can cause compatibility issues? so as well as org.springframework.core you should also have org.springframework.context amongst other jars for a spring-based projectsmoggers
I had a similar issue, I deleted the build folder in intellij project and re run the project, problem solved.gabbler

2 Answers

1
votes

Put the spring core framework (usually downloadable and has jar files) in your libs folder

0
votes

you have add into context loader classpath into web.xml.

for example

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>WordOfTheDay</display-name>
  <welcome-file-list>
    <welcome-file>home.do</welcome-file>
  </welcome-file-list>
  <servlet>
    <servlet-name>spring</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>spring</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>
  <listener>
    <listener-class>
                  org.springframework.web.context.ContextLoaderListener
    </listener-class>
  </listener>
  <listener>