0

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.

Akash Mishra
  • 682
  • 1
  • 5
  • 13
  • glassfish may have its own commons-logging library (probably newer one) in its classpath ( lib folder) . what version commons-logging are you using? – kuhajeyan Nov 23 '16 at 06:39
  • yeah i realised that while starting the glassfish server. Initially I had placed commons-logging 1.2, but it seems glassfish refers to commons-logging 1.0.4. For once, I removed all references assuming it would refer to the jar placed in glassfish library. It din't work then too, then i placed 1.0.4 version as well. Still no success. – Akash Mishra Nov 23 '16 at 07:17

0 Answers0