I am running a basic Spring MVC RESTful application with Glassfish 4. The servlet mapping from org.springframework.web.servlet.DispatcherServlet
to the RestController is correct.
Everything else is in place as well. Strangely everytime I run the app on Glassfish server, it runs into the error : ClassNotFoundException: org.apache.commons.logging.LogFactory
Even when the apache-commons jar has been placed in the classpath.
From the stacktrace, I found out that LogFactory
class is being referred from within DispatcherServlet. I even extracted the spring-webmvc jar and added commons-logging.jar in its classpath. But to no good.
I have tried all solutions available across various blogs/websites to replace commons-logging with a different logging framework. None of it worked until, I switched my runtime environment to point to a Tomcat 8 server. In the first attempt, It all came into place. I could see successfully run the RESTful app.
Any pointers/insights to this behaviour would be appreciated.