Search code examples
authenticationalfrescogoogle-docsalfresco-webscripts

how to Integrate google docs with alfresco community 4.0?


I found some configuration for enable google docs

These properties I have added in alfresco-global.properties

googledocs.googleeditable.enabled = true 
googledocs.username =*******@gmail.com
googledocs.password =*************

and in share-config I have added the code and added aspect <aspect name="gd:googleEditable"/>

<!-- Google Docs™ integration -->

<google-docs>

    <enabled>true</enabled>

    <creatable-types>

    <creatable type="doc">application/msword</creatable>

   <creatable type="xls">application/vnd.ms-excel</creatable>

   <creatable type="ppt">application/vnd.ms-powerpoint</creatable>

   </creatable-types>

</google-docs>

I am able to see CheckOut in google docs but it is not working enter image description here

But while clicking on this I am getting errors

2017-04-28 13:20:27,867  DEBUG [repo.googledocs.GoogleDocsServiceImpl] [http-8086-7] Creating folder SpacesStore
 2017-04-28 13:20:28,104  DEBUG [repo.googledocs.GoogleDocsServiceImpl] [http-8086-7] Setting user credentials for GDoc service. (serviceName=writely, userName=**************@gmail.com, password=***************)
 2017-04-28 13:20:28,891  ERROR [extensions.webscripts.AbstractRuntime] [http-8086-7] Exception from executeScript - redirecting to status template error: 03280002 JavaException: org.alfresco.repo.googledocs.GoogleDocsServiceInitException: 03280008 Unable to connect to Google Docs.  Please check the Google Docs authentication configuration.
 org.springframework.extensions.webscripts.WebScriptException: 03280002 JavaException: org.alfresco.repo.googledocs.GoogleDocsServiceInitException: 03280008 Unable to connect to Google Docs.  Please check the Google Docs authentication configuration.
    at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:956)
    at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:171)
    at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:400)
    at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)
    at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:462)
    at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:500)
    at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:316)
    at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:372)
    at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
    at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
    at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
    at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
    at java.lang.Thread.run(Thread.java:662)
Caused by: org.alfresco.repo.googledocs.GoogleDocsServiceInitException: 03280008 Unable to connect to Google Docs.  Please check the Google Docs authentication configuration.
    at org.alfresco.repo.googledocs.GoogleDocsServiceImpl.getMediaService(GoogleDocsServiceImpl.java:223)
    at org.alfresco.repo.googledocs.GoogleDocsServiceImpl.getDocumentService(GoogleDocsServiceImpl.java:177)
    at org.alfresco.repo.googledocs.GoogleDocsServiceImpl.createGoogleFolder(GoogleDocsServiceImpl.java:1039)
    at org.alfresco.repo.googledocs.GoogleDocsServiceImpl.getParentFolder(GoogleDocsServiceImpl.java:620)
    at org.alfresco.repo.googledocs.GoogleDocsServiceImpl.getParentFolder(GoogleDocsServiceImpl.java:605)
    at org.alfresco.repo.googledocs.GoogleDocsServiceImpl.getParentFolder(GoogleDocsServiceImpl.java:605)
    at org.alfresco.repo.googledocs.GoogleDocsServiceImpl.getParentFolder(GoogleDocsServiceImpl.java:605)
    at org.alfresco.repo.googledocs.GoogleDocsServiceImpl.getParentFolder(GoogleDocsServiceImpl.java:605)
    at org.alfresco.repo.googledocs.GoogleDocsServiceImpl.createGoogleDoc(GoogleDocsServiceImpl.java:438)
    at org.alfresco.repo.googledocs.GoogleEditableAspect.onCheckOut(GoogleEditableAspect.java:175)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.alfresco.repo.policy.JavaBehaviour$JavaMethodInvocationHandler.invoke(JavaBehaviour.java:173)
    at $Proxy103.onCheckOut(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.alfresco.repo.policy.TransactionInvocationHandlerFactory$TransactionHandler.invoke(TransactionInvocationHandlerFactory.java:128)
    at $Proxy103.onCheckOut(Unknown Source)
    at org.alfresco.repo.coci.CheckOutCheckInServiceImpl.invokeOnCheckOut(CheckOutCheckInServiceImpl.java:263)
    at org.alfresco.repo.coci.CheckOutCheckInServiceImpl.doCheckout(CheckOutCheckInServiceImpl.java:473)
    at org.alfresco.repo.coci.CheckOutCheckInServiceImpl.checkout(CheckOutCheckInServiceImpl.java:380)
    at org.alfresco.repo.coci.CheckOutCheckInServiceImpl.checkout(CheckOutCheckInServiceImpl.java:355)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:147)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy51.checkout(Unknown Source)
    at org.alfresco.repo.jscript.ScriptNode.checkout(ScriptNode.java:2283)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
    at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
    at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:119)
    at org.mozilla.javascript.gen.c12._c18(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkout.post.json.js:914)
    at org.mozilla.javascript.gen.c12.call(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkout.post.json.js)
    at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
    at org.mozilla.javascript.gen.c12._c12(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkout.post.json.js:618)
    at org.mozilla.javascript.gen.c12.call(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkout.post.json.js)
    at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108)
    at org.mozilla.javascript.gen.c12._c0(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkout.post.json.js:951)
    at org.mozilla.javascript.gen.c12.call(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkout.post.json.js)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
    at org.mozilla.javascript.gen.c12.call(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkout.post.json.js)
    at org.mozilla.javascript.gen.c12.exec(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkout.post.json.js)
    at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:483)
    at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:191)
    at org.alfresco.repo.processor.ScriptServiceImpl.execute(ScriptServiceImpl.java:212)
    at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:174)
    at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:102)
    at org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:1193)
    at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:86)
    ... 25 more
Caused by: com.google.gdata.util.AuthenticationException: Error authenticating (check service name)
    at com.google.gdata.client.GoogleAuthTokenFactory.getAuthException(GoogleAuthTokenFactory.java:628)
    at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:500)
    at com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(GoogleAuthTokenFactory.java:346)
    at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:362)
    at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:317)
    at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:301)
    at org.alfresco.repo.googledocs.GoogleDocsServiceImpl.getMediaService(GoogleDocsServiceImpl.java:218)
    ... 94 more

How to solve this??

OR is there any other way to integrate Google Docs With Alfresco Community 4.0 ??


Solution

  • According to the error you have:

    Caused by: com.google.gdata.util.AuthenticationException: Error authenticating (check service name)
    

    It seems that your configuration uses an old google connection library (https://github.com/google/gdata-java-client/issues/451).

    setUserCredentials() uses ClientLogin, which has been deprecated since April 2012 and recently disabled. You will need to use OAuth instead.
    

    You'll have to modify the codebase and to use the new Authentification method

    Good luck