cancel
Showing results for 
Search instead for 
Did you mean: 

Facebook Alfresco Document Library setup

jpotts
World-Class Innovator
World-Class Innovator
I've walked through the "hello world" Alfresco-Facebook integration example on http://wiki.alfresco.com/wiki/Facebook and it worked fine. Now I'm trying to set up the Alfresco Document library. I must be missing a step. Here's what I've done:

1. Installed the amp.
2. Created a new Facebook app key. Snagged the app ID, app key, and secret.
3. Set my callback URL to http://<my host name>/alfresco/facebook/alfrescodoclib/
4. Created a new file in Company Home/Data Dictionary/Web Scripts/com/facebook/_apps/ called app.<app key>.js with the app ID and secret for the key created in step 2.
5. Created a new space under Company Home called FB<app id>

When I go to apps.facebook.com/<my app name> I get the stack trace shown below.

What am I missing?

Jeff

Web Script Status 500 - Internal Error

Error:   Internal Error (500) - An error inside the HTTP server which prevented it from fulfilling the request.

Message:   Failed to execute script '/home/jpotts/alfresco/webapps/community-2.9/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/facebook/doclib/canvas.post.js': Failed to execute script '/home/jpotts/alfresco/webapps/community-2.9/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/facebook/doclib/canvas.post.js': Wrapped org.alfresco.web.scripts.facebook.FacebookError: Incorrect signature (AlfrescoScript#18)

Exception:   org.alfresco.web.scripts.facebook.FacebookError - Incorrect signature
   
   org.alfresco.web.scripts.facebook.FacebookModel.getAppFriends(FacebookModel.java:143)
   sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   java.lang.reflect.Method.invoke(Method.java:585)
   org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
   org.mozilla.javascript.JavaMembers.get(JavaMembers.java:117)
   org.mozilla.javascript.NativeJavaObject.get(NativeJavaObject.java:113)
   org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1544)
   org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1375)
   org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1364)
   org.mozilla.javascript.gen.c6._c0(AlfrescoScript:18)
   org.mozilla.javascript.gen.c6.call(AlfrescoScript)
   org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
   org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
   org.mozilla.javascript.gen.c6.call(AlfrescoScript)
   org.mozilla.javascript.gen.c6.exec(AlfrescoScript)
   org.mozilla.javascript.Context.evaluateString(Context.java:1196)
   org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:511)
   org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:111)
   org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:243)
   sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   java.lang.reflect.Method.invoke(Method.java:585)
   org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
   org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
   org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:241)
   org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
   $Proxy50.executeScript(Unknown Source)
   org.alfresco.web.scripts.ScriptProcessor.executeScript(ScriptProcessor.java:108)
   org.alfresco.web.scripts.AbstractWebScript.executeScript(AbstractWebScript.java:617)
   org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:124)
   org.alfresco.web.scripts.WebScriptRuntime.wrappedExecute(WebScriptRuntime.java:373)
   org.alfresco.web.scripts.WebScriptRuntime$1.execute(WebScriptRuntime.java:339)
   org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:236)
   org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:166)
   org.alfresco.web.scripts.WebScriptRuntime.transactionedExecute(WebScriptRuntime.java:350)
   org.alfresco.web.scripts.WebScriptRuntime.authenticatedExecute(WebScriptRuntime.java:293)
   org.alfresco.web.scripts.WebScriptRuntime.executeScript(WebScriptRuntime.java:152)
   org.alfresco.web.scripts.facebook.FacebookServlet.service(FacebookServlet.java:63)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
   org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
   org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   java.lang.Thread.run(Thread.java:595)
   
Exception:   org.mozilla.javascript.WrappedException - Wrapped org.alfresco.web.scripts.facebook.FacebookError: Incorrect signature (AlfrescoScript#18)
   
   org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1757)
   
Exception:   org.alfresco.error.AlfrescoRuntimeException - Wrapped org.alfresco.web.scripts.facebook.FacebookError: Incorrect signature (AlfrescoScript#18)
   
   org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:519)
   
Exception:   org.alfresco.service.cmr.repository.ScriptException - Failed to execute script '/home/jpotts/alfresco/webapps/community-2.9/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/facebook/doclib/canvas.post.js': Wrapped org.alfresco.web.scripts.facebook.FacebookError: Incorrect signature (AlfrescoScript#18)
   
   org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:115)
   
Exception:   org.alfresco.service.cmr.repository.ScriptException - Failed to execute script '/home/jpotts/alfresco/webapps/community-2.9/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/facebook/doclib/canvas.post.js': Failed to execute script '/home/jpotts/alfresco/webapps/community-2.9/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/facebook/doclib/canvas.post.js': Wrapped org.alfresco.web.scripts.facebook.FacebookError: Incorrect signature (AlfrescoScript#18)
   
   org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:247)
9 REPLIES 9

davidc
Star Contributor
Star Contributor
Hi Jeff,

Incorrect signature usually signifies an invalid secret key, although I'm sure you've got the correct one.

Can you switch on debug logging for org.alfresco.web.scripts - that'll provide logging for the Facebook integration too and might give a hint.

I notice you've mapped to /alfresco/facebook/alfrescodoclib/, but the canvas Url alfrescodoclib has already been taken by Alfresco.  I guess you've changed your canvas url. I think we've only tested when canvas and callback url match.  That might be an issue.

Dave

jpotts
World-Class Innovator
World-Class Innovator
David,

Let me clarify what I'm attempting to do.

You guys have already implemented the doc library web scripts. I want to try out the Facebook Alfresco Document Library. Because that Facebook app does not seem to be in the application directory (and, because I would want it to point to my Alfresco instance, not yours), I assumed I would need to set up my own Facebook app key which pointed to my Alfresco repo running your web scripts.

In order to get that to work it seems like I could use my own callback URL (points to my host and your web script: http://<my host>:8080/alfresco/facebook/alfrescodoclib/) and my own canvas URL (/jtpalfrescodoclib/).

There shouldn't be any relationship between the web script URL and the canvas URL.

The only thing that's different is the app key, app id, and secret, which I take care of by creating my own _apps/<app key>.js file.

Maybe I need to delete your old one. I'll try that. I'll also turn on debugging and let you know what I find.

If my approach seems flawed let me know.

Jeff

jpotts
World-Class Innovator
World-Class Innovator
You were right about the bad secret–I had mis-typed it in my _apps/<app id>.js file.

So now the app comes up but the "Create Document Library" button calls *your* canvas URL instead of mine. I thought maybe you had it hardcoded but the canvas.post.fbml.ftl has ${facebook.canvasURL}. It's almost as if that is returning alfrescodoclib instead of my canvas URL, jtpalfrescodoclib.

I'll turn on debug and see if that's the case.

Jeff

jpotts
World-Class Innovator
World-Class Innovator
I hooked up the debugger and confirmed that getCanvasURL() ultimately uses FacebookServletRequest.pathInfo which is derived by the web script URL. That means the framework assumes that the canvas URL always matches the callback URL (ie, the web script).

The conclusion I've reached is that no one will be able to run the Facebook AMP out-of-the-box without first updating all of the *.desc.xml files such that the URL element matches the following syntax:

/facebook/<Canvas Page URL>/<whatever>

If someone can validate that I can update the wiki with setup instructions for the Facebook AMP.

Jeff

davidc
Star Contributor
Star Contributor
There shouldn't be any relationship between the web script URL and the canvas URL.

Ideally, but I chose a URL convention where they are matched.

1) Provides a simple convention to follow when setting up a new Facebook app - the Facebook registration form is a stumbling block 🙂
2) Facebook Canvas URLs are globally unique and thus so will all Facebook webscript URLs
3) It's possible to map back to the public Facebook site URL from within a Facebook Webscript

The downside is that it's not possible to map a Facebook app implementation to multiple Facebook aps.  This is minor.  I consider the sample app as a basis for copy and paste.

Let me know if updating the *.desc.xml files work.  The WIKI page probably needs a section on this.

Also, let me know if you agree/disagree with the above design/constraints.

jpotts
World-Class Innovator
World-Class Innovator
I see what you were going for but it seems like there'd be value in being able to write web scripts that could be used by any facebook app out-of-the-box. Granted, changing the descriptor isn't a huge deal but it's still a change.

You are already storing the app ID and the secret in that app file. Why not store the canvas URL in there and then change the getCanvasURL() method to read it from that file? Those are values that have to change with each facebook app instance anyway.

Jeff

davidc
Star Contributor
Star Contributor
You are already storing the app ID and the secret in that app file. Why not store the canvas URL in there and then change the getCanvasURL() method to read it from that file?

Good idea - if it's provided it can override the current behaviour.  I'll see if I can add that.

Hi David,

I have tried to integrate alfresco with facebook but getting below error:

   org.mozilla.javascript.EcmaError - ReferenceError: "facebook" is not defined. (file:/data/Alfresco_components/alfresco-               4.0.2.9/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/facebook/doclib/canvas.post.js#3)

I think, implicit object 'facebook' is not initialized.

Can you provide me the solution for this or any configuration that I should look for?

g_rathod
Star Contributor
Star Contributor
Hi Jpotts,

I have downloaded  alfresco-fb-doclib.amp file and keep it inside amps/ folder.
I think this amp is currupted. It only creates one Foldername  FB5607893292 and that is over.
It will not create any webscripts inside our webscript folder.

I copied all webscript files from extracting it and put through CIFS.
Now I am able to get the first screen and it is not showing up any docs inside it even I uploaded files inside my Company Home/FB<key> folder.

And when I try to navigate through any link it will crashes or no page means its not getting URL on that way.
Can you elaborate exact steps to make this alfresco facebook doc lib application running perfectly ?

what changes should I have to made ?
Thanks in advance.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.