[Solved] Error creating bean with name ‘org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0‘:

Error:
Error creating bean with name’org.springframework.web.servlet.handler.SimpleUrlHandlerMapping0’: Instantiation of bean failed;


Error Message:

05-Sep-2021 16:44:18.866 Message [http-apr-8080-exec-8] 
org.springframework.web.servlet.FrameworkServlet.initServletBean Initializing Servlet 'springmvc'

05-Sep-2021 16:44:18.974 Warning [http-apr-8080-exec-8] org.springframework.context.support.AbstractApplicationContext.refresh Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.core.log.LogDelegateFactory.getHiddenLog(Ljava/lang/String;)Lorg/apache/commons/logging/Log;

Cause analysis:

bean instantiation failed


Solution:

There are three ways:

1. Comment out the following comments.

2.Servlet API dependency is missing. Add the following dependencies

 <dependency>
      <groupId>tomcat</groupId>
      <artifactId>servlet-api</artifactId>
      <version>5.5.23</version>
    </dependency>

3.the web project created has the wrong prototype selected


Read More: