Codigami / face4j

face4j is a java library for facebook's new graph API

Home Page:http://face4j.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

java.lang.NoClassDefFoundError: com/face4j/facebook/Client

lajthabalazs opened this issue · comments

First time using face4j, not a big J2EE expert either, so it might be some simple misstake.

I downloaded the libraries, addded both dependencies and the 1.7.1 jars to the Google Appengine project.

Servlet's code is:

package hu.edudroid.facebook_sample.server;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.face4j.facebook.Client;
import com.face4j.facebook.enums.Display;
import com.face4j.facebook.enums.HttpClientType;
import com.face4j.facebook.enums.Permission;
import com.face4j.facebook.factory.FacebookFactory;

public class FacebookServlet extends HttpServlet {

private static final String APP_SECRET = "xxxxxx";
private static final String APP_ID = "xxxxxxxx";
private static final String REDIRECT_URL = "xxxxxxxxxxx";

private static final long serialVersionUID = -5750323052726353067L;

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    Client client = new Client(APP_ID, APP_SECRET);
    FacebookFactory facebookFactory = new FacebookFactory(client, HttpClientType.URL_FETCH_SERVICE);
    String redirectURL = facebookFactory.getRedirectURL(REDIRECT_URL, Display.POPUP, Permission.EMAIL, Permission.OFFLINE_ACCESS);
    System.out.println("Redirecting " + redirectURL);
    PrintWriter out = resp.getWriter();
    out.write(redirectURL);
    out.flush();
}

}

How could I make this work?

Never mind, my bad. It was not enough to add libraries to the project, but I had to copy it to WEB-INF/lib

Yup! Good to know its working fine for you.

On 22 April 2013 20:00, lajthabalazs notifications@github.com wrote:

Never mind, my bad. It was not enough to add libraries to the project, but
I had to copy it to WEB-INF/lib


Reply to this email directly or view it on GitHubhttps://github.com//issues/24#issuecomment-16791021
.

-Nischal
Founder, JustUnfollow
twitter: NischalShetty http://twitter.com/nischalshetty
facebook: Nischal http://facebook.com/nischal

http://www.justunfollow.com
JustUnfollow http://www.justunfollow.com - Twitter follower management
made easy

Hi!

Thanks for the support. I have another problem: I'm progressing with the Facebook login, and have a problem with threads on appengine.

I got the following error. It seams that threads are not supported in appengine https://developers.google.com/appengine/docs/java/runtime#The_Sandbox. What is the workaround?

java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup) at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:289) at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkAccess(DevAppServerFactory.java:314) at java.lang.ThreadGroup.checkAccess(Unknown Source) at java.lang.Thread.init(Unknown Source) at java.lang.Thread.(Unknown Source) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$ReferenceQueueThread.(MultiThreadedHttpConnectionManager.java:1080) at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.storeReferenceToConnection(MultiThreadedHttpConnectionManager.java:173) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.access$900(MultiThreadedHttpConnectionManager.java:65) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$ConnectionPool.createConnection(MultiThreadedHttpConnectionManager.java:771) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.doGetConnection(MultiThreadedHttpConnectionManager.java:476) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.getConnectionWithTimeout(MultiThreadedHttpConnectionManager.java:416) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:153) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323) at
com.face4j.facebook.http.APICaller.getData(APICaller.java:139) at com.face4j.facebook.factory.FacebookFactory.getOAuthAccessToken(FacebookFactory.java:122)


From: Nischal Shetty notifications@github.com
To: nischal/face4j face4j@noreply.github.com
Cc: lajthabalazs lajthabalazs@yahoo.com
Sent: Monday, April 22, 2013 5:25 PM
Subject: Re: [face4j] java.lang.NoClassDefFoundError: com/face4j/facebook/Client (#24)

Yup! Good to know its working fine for you.

On 22 April 2013 20:00, lajthabalazs notifications@github.com wrote:

Never mind, my bad. It was not enough to add libraries to the project, but
I had to copy it to WEB-INF/lib


Reply to this email directly or view it on GitHubhttps://github.com//issues/24#issuecomment-16791021
.

-Nischal
Founder, JustUnfollow
twitter: NischalShetty http://twitter.com/nischalshetty
facebook: Nischal http://facebook.com/nischal

http://www.justunfollow.com
JustUnfollow http://www.justunfollow.com - Twitter follower management
made easy

Reply to this email directly or view it on GitHub.

That error should not have happened. Please send me the code so that I can
look into it.

On 23 April 2013 18:28, lajthabalazs notifications@github.com wrote:

Hi!

Thanks for the support. I have another problem: I'm progressing with the
Facebook login, and have a problem with threads on appengine.

I got the following error. It seams that threads are not supported in
appengine
https://developers.google.com/appengine/docs/java/runtime#The_Sandbox.
What is the workaround?

java.security.AccessControlException: access denied
(java.lang.RuntimePermission modifyThreadGroup) at
java.security.AccessControlContext.checkPermission(Unknown Source) at
java.security.AccessController.checkPermission(Unknown Source) at
java.lang.SecurityManager.checkPermission(Unknown Source) at
com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:289)
at
com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkAccess(DevAppServerFactory.java:314)
at java.lang.ThreadGroup.checkAccess(Unknown Source) at
java.lang.Thread.init(Unknown Source) at java.lang.Thread.(Unknown
Source) at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$ReferenceQueueThread.(MultiThreadedHttpConnectionManager.java:1080)
at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.storeReferenceToConnection(MultiThreadedHttpConnectionManager.java:173)
at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.access$900(MultiThreadedHttpConnectionManager.java:65)
at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$ConnectionPool.createConnection(MultiThreadedHttpConnectionManager.java:771)
at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.doGetConnection(MultiThreadedHttpConnectionManager.java:476)
at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.getConnectionWithTimeout(MultiThreadedHttpConnectionManager.java:416)
at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:153)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
at
com.face4j.facebook.http.APICaller.getData(APICaller.java:139) at
com.face4j.facebook.factory.FacebookFactory.getOAuthAccessToken(FacebookFactory.java:122)


From: Nischal Shetty notifications@github.com
To: nischal/face4j face4j@noreply.github.com
Cc: lajthabalazs lajthabalazs@yahoo.com
Sent: Monday, April 22, 2013 5:25 PM
Subject: Re: [face4j] java.lang.NoClassDefFoundError:
com/face4j/facebook/Client (#24)

Yup! Good to know its working fine for you.

On 22 April 2013 20:00, lajthabalazs notifications@github.com wrote:

Never mind, my bad. It was not enough to add libraries to the project,
but
I had to copy it to WEB-INF/lib


Reply to this email directly or view it on GitHub<
https://github.com/nischal/face4j/issues/24#issuecomment-16791021>
.

-Nischal
Founder, JustUnfollow
twitter: NischalShetty http://twitter.com/nischalshetty
facebook: Nischal http://facebook.com/nischal

http://www.justunfollow.com
JustUnfollow http://www.justunfollow.com - Twitter follower management
made easy

Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com//issues/24#issuecomment-16856193
.

-Nischal
Founder, JustUnfollow
twitter: NischalShetty http://twitter.com/nischalshetty
facebook: Nischal http://facebook.com/nischal

http://www.justunfollow.com
JustUnfollow http://www.justunfollow.com - Twitter follower management
made easy

Hi!

Sorry again, my mistake, I should sleep more. It was the error you pointed out in the tutorial, I used the wrong http client. Sorry for bothering you again. Now everything works fine, great library, thanks.

BR// Balázs


From: Nischal Shetty notifications@github.com
To: nischal/face4j face4j@noreply.github.com
Cc: lajthabalazs lajthabalazs@yahoo.com
Sent: Tuesday, April 23, 2013 4:55 PM
Subject: Re: [face4j] java.lang.NoClassDefFoundError: com/face4j/facebook/Client (#24)

That error should not have happened. Please send me the code so that I can
look into it.

On 23 April 2013 18:28, lajthabalazs notifications@github.com wrote:

Hi!

Thanks for the support. I have another problem: I'm progressing with the
Facebook login, and have a problem with threads on appengine.

I got the following error. It seams that threads are not supported in
appengine
https://developers.google.com/appengine/docs/java/runtime#The_Sandbox.
What is the workaround?

java.security.AccessControlException: access denied
(java.lang.RuntimePermission modifyThreadGroup) at
java.security.AccessControlContext.checkPermission(Unknown Source) at
java.security.AccessController.checkPermission(Unknown Source) at
java.lang.SecurityManager.checkPermission(Unknown Source) at
com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:289)
at
com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkAccess(DevAppServerFactory.java:314)
at java.lang.ThreadGroup.checkAccess(Unknown Source) at
java.lang.Thread.init(Unknown Source) at java.lang.Thread.(Unknown
Source) at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$ReferenceQueueThread.(MultiThreadedHttpConnectionManager.java:1080)
at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.storeReferenceToConnection(MultiThreadedHttpConnectionManager.java:173)
at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.access$900(MultiThreadedHttpConnectionManager.java:65)
at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$ConnectionPool.createConnection(MultiThreadedHttpConnectionManager.java:771)
at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.doGetConnection(MultiThreadedHttpConnectionManager.java:476)
at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.getConnectionWithTimeout(MultiThreadedHttpConnectionManager.java:416)
at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:153)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
at
com.face4j.facebook.http.APICaller.getData(APICaller.java:139) at
com.face4j.facebook.factory.FacebookFactory.getOAuthAccessToken(FacebookFactory.java:122)


From: Nischal Shetty notifications@github.com
To: nischal/face4j face4j@noreply.github.com
Cc: lajthabalazs lajthabalazs@yahoo.com
Sent: Monday, April 22, 2013 5:25 PM
Subject: Re: [face4j] java.lang.NoClassDefFoundError:
com/face4j/facebook/Client (#24)

Yup! Good to know its working fine for you.

On 22 April 2013 20:00, lajthabalazs notifications@github.com wrote:

Never mind, my bad. It was not enough to add libraries to the project,
but
I had to copy it to WEB-INF/lib


Reply to this email directly or view it on GitHub<
https://github.com/nischal/face4j/issues/24#issuecomment-16791021>
.

-Nischal
Founder, JustUnfollow
twitter: NischalShetty http://twitter.com/nischalshetty
facebook: Nischal http://facebook.com/nischal

http://www.justunfollow.com
JustUnfollow http://www.justunfollow.com - Twitter follower management
made easy

Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com//issues/24#issuecomment-16856193
.

-Nischal
Founder, JustUnfollow
twitter: NischalShetty http://twitter.com/nischalshetty
facebook: Nischal http://facebook.com/nischal

http://www.justunfollow.com
JustUnfollow http://www.justunfollow.com - Twitter follower management
made easy

Reply to this email directly or view it on GitHub.

cool :-)

-Nischal
http://justunfollow.com
Sent from my Galaxy S3
On Apr 23, 2013 9:12 PM, "lajthabalazs" notifications@github.com wrote:

Hi!

Sorry again, my mistake, I should sleep more. It was the error you pointed
out in the tutorial, I used the wrong http client. Sorry for bothering you
again. Now everything works fine, great library, thanks.

BR// Balázs


From: Nischal Shetty notifications@github.com
To: nischal/face4j face4j@noreply.github.com
Cc: lajthabalazs lajthabalazs@yahoo.com
Sent: Tuesday, April 23, 2013 4:55 PM
Subject: Re: [face4j] java.lang.NoClassDefFoundError:
com/face4j/facebook/Client (#24)

That error should not have happened. Please send me the code so that I can
look into it.

On 23 April 2013 18:28, lajthabalazs notifications@github.com wrote:

Hi!

Thanks for the support. I have another problem: I'm progressing with the
Facebook login, and have a problem with threads on appengine.

I got the following error. It seams that threads are not supported in
appengine
https://developers.google.com/appengine/docs/java/runtime#The_Sandbox.
What is the workaround?

java.security.AccessControlException: access denied
(java.lang.RuntimePermission modifyThreadGroup) at
java.security.AccessControlContext.checkPermission(Unknown Source) at
java.security.AccessController.checkPermission(Unknown Source) at
java.lang.SecurityManager.checkPermission(Unknown Source) at

com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:289)

at

com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkAccess(DevAppServerFactory.java:314)

at java.lang.ThreadGroup.checkAccess(Unknown Source) at
java.lang.Thread.init(Unknown Source) at java.lang.Thread.(Unknown
Source) at

org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$ReferenceQueueThread.(MultiThreadedHttpConnectionManager.java:1080)

at

org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.storeReferenceToConnection(MultiThreadedHttpConnectionManager.java:173)

at

org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.access$900(MultiThreadedHttpConnectionManager.java:65)

at

org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$ConnectionPool.createConnection(MultiThreadedHttpConnectionManager.java:771)

at

org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.doGetConnection(MultiThreadedHttpConnectionManager.java:476)

at

org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.getConnectionWithTimeout(MultiThreadedHttpConnectionManager.java:416)

at

org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:153)

at

org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at

org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
at
com.face4j.facebook.http.APICaller.getData(APICaller.java:139) at

com.face4j.facebook.factory.FacebookFactory.getOAuthAccessToken(FacebookFactory.java:122)


From: Nischal Shetty notifications@github.com
To: nischal/face4j face4j@noreply.github.com
Cc: lajthabalazs lajthabalazs@yahoo.com
Sent: Monday, April 22, 2013 5:25 PM
Subject: Re: [face4j] java.lang.NoClassDefFoundError:
com/face4j/facebook/Client (#24)

Yup! Good to know its working fine for you.

On 22 April 2013 20:00, lajthabalazs notifications@github.com wrote:

Never mind, my bad. It was not enough to add libraries to the project,
but
I had to copy it to WEB-INF/lib


Reply to this email directly or view it on GitHub<
https://github.com/nischal/face4j/issues/24#issuecomment-16791021>
.

-Nischal
Founder, JustUnfollow
twitter: NischalShetty http://twitter.com/nischalshetty
facebook: Nischal http://facebook.com/nischal

http://www.justunfollow.com
JustUnfollow http://www.justunfollow.com - Twitter follower
management
made easy

Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub<
https://github.com/nischal/face4j/issues/24#issuecomment-16856193>
.

-Nischal
Founder, JustUnfollow
twitter: NischalShetty http://twitter.com/nischalshetty
facebook: Nischal http://facebook.com/nischal

http://www.justunfollow.com
JustUnfollow http://www.justunfollow.com - Twitter follower management
made easy

Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com//issues/24#issuecomment-16866449
.