tags:

views:

30

answers:

1

When I login in facebook using code as shown in Facesbook API Example in a servlet then get the following exception:

javax.servlet.ServletException: Servlet execution threw an exception

root cause

java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    com.google.code.facebookapi.FacebookXmlRestClientBase.<clinit>(FacebookXmlRestClientBase.java:26)
    FaceBookCrawl.FacebookUserFilter.doFilter(FacebookUserFilter.java:85)
    FaceBookCrawl.FacebookUserFilter.doPost(FacebookUserFilter.java:161)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

How can I solve this?

A: 
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

This means that the particular class is missing in the runtime classpath.

To fix this, you just need to put the particular class (or actually, the JAR file with the particular class) in the runtime classpath. As the package name already hints, you can download the JAR file at http://commons.apache.org/logging. Put the JAR file in webapp's /WEB-INF/lib folder, it's part of the webapp's runtime classpath.

BalusC