Spring class not found when it exists
I am getting an exception that "org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" does not exist in my WebContent \ WEB-INF \ spring-dispatcher-servlet.xml file. I have added spring-webmvc 4.1.2 dependency and I have this class exists in my maven dependencies, so it doesn't see these classes from my maven dependencies?
<bean id="HandlerMapping" class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" />
If you are using eclipse try to clean the project and then clean the Tomcat directory. Also make sure maven dependencies are present in WEB-INF / lib, if not, this is configurable from project properties> Build Deployment
You probably have multiple versions spring-webmvc
in your classpath as dependencies of another direct dependency. Call mvn dependency:tree -Dverbose -Dincludes=spring-webmvc
to see how many versions of the library you have and exclude older versions.
Or if you are using Intellij, enable the maven plugin, generate a diagram, search with Ctrl-F for spring-webmvc
and you have an earlier dependency, right click on it and select exclude
. Eclipse likely has similar functionality as well.