1) Download the newest (facebook4gwt-1.0.4.jar) from:
2) In Terminal change directory to your download location
3) Install the jar in your local Maven2 REPO:
mvn install:install-file -DgroupId=com.reveregroup.gwt -DartifactId=facebook4gwt -Dversion=1.0.4 -Dpackaging=jar -Dfile=facebook4gwt-1.0.4.jar
4) Verify that the jar is installed correctly:
uki@Uki:~/.m2/repository/com/reveregroup/gwt/facebook4gwt/1.0.4 $ ls
facebook4gwt-1.0.4.jar
5) Update your pom.xml (Maven2) with the dependency:
<dependency>
<groupId>com.reveregroup.gwt</groupId>
<artifactId>facebook4gwt</artifactId>
<version>1.0.4</version>
</dependency>
<target name="copy_maven_jars_filtered_resources">
<echo>Maven Executable: ${MAVEN_EXEC}</echo>
<!-- resources:resources filters the files in the resources directory and copies them to target/classes -->
<!-- dependency:copy-dependencies copies the dependencies to the target/dependency folder -->
<exec taskname="mvn war" dir="${basedir}"
executable="${MAVEN_EXEC}">
<arg line="clean resources:resources dependency:copy-dependencies -Dtarget=${TARGET}" />
</exec>
<delete dir="${GOOGLE_WAR}\\WEB-INF\\lib" />
<!-- copy the maven depenecies to the war/WEB-INF/lib folder -->
<copy todir="${GOOGLE_WAR}\\WEB-INF\\lib">
<fileset dir="${MAVEN_TARGET}\\dependency" />
</copy>
<!-- copy the filtered resources to the src folder -->
<copy todir="${GOOGLE_SRC}">
<fileset dir="${MAVEN_TARGET}\\classes" />
</copy>
</target>
7) Use the facebook4gwt API and send us the feedback
Hi,
ReplyDeleteI'm using this library to integrate facebook in my application. I run into problems when I try to authenticate a user on the server side. In the code, I call Facebook.init(FB_API_KEY); and use the sample code here to get things started and I get an error Caused by: java.lang.NoClassDefFoundError: com/reveregroup/gwt/facebook4gwt/Facebook.
I do have the jar file in the classpath and I know it works because If I implement the user logging in and out on the client, in the onModuleLoad() method it works fine.
Is there an issue with running facebook4gwt on the server side or something I may have missed?
Thanks.
@Manners, there is not really an issue with servier side per se, but since the library uses native javascript, it can only work on the GWT client side, assuming you are trying to deploy to app engine. So yes, it should only work from an onModuleLoad() entry point. There are other libraries designed for server side deployment, but you will still need to use something like Facebook Connect from the client to establish a session. I am working on an integrated library for this purpose. I could use help if anyone is interested. http://code.google.com/p/facebook-gwt/
ReplyDelete