cancel
Showing results for 
Search instead for 
Did you mean: 

Getting AuthenticationService in ActionHandler

dynamolalit
Champ on-the-rise
Champ on-the-rise
Hi,

I am using Alfresco 3.2r with Tomcat 6.I have written a workflow in which i am tyring to move a document from one space to another using ActionHandler.I am calling my ActionHandler from WF as

<node name="approved">        
         <event type="node-leave">
         <script>
               <variable name="wfFlag" access="write"/>
               <expression>
                  wfFlag = "Approved";
               </expression>
            </script>               
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
         <runas>admin</runas>
            <script>
               logger.log("!!In Approval Workflow….!!!!@!@@@@");
               executionContext.setVariable("wfFlag", wfFlag);
               logger.log("wfFlag in WF "+wfFlag);
            </script>
         </action> 
         <action class="com.xxxx.alfresco.km.bpm.KMReviewProcessAction" name="test1234"/>               
           </event>
        <transition name="" to="end" />
    </node>

Now i am able to get KMReviewProcessAction instance but when i am trying to get AuthenticationServiceImpl as

package com.xxxx.alfresco.km.bpm;

import java.util.List;

import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.security.authentication.AuthenticationServiceImpl;
import org.alfresco.repo.workflow.WorkflowServiceImpl;
import org.alfresco.repo.workflow.jbpm.JBPMSpringActionHandler;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.cmr.security.AuthorityService;
import org.alfresco.service.cmr.workflow.WorkflowService;
import org.apache.log4j.Logger;
import org.jbpm.context.exe.ContextInstance;
import org.jbpm.graph.exe.ExecutionContext;
import org.springframework.beans.factory.BeanFactory;

public class KMReviewProcessAction extends JBPMSpringActionHandler {

   private static final long serialVersionUID = 1L;
   private static Logger logger = Logger
         .getLogger(KMReviewProcessAction.class);
   private static NodeService nodeservice = null;
   private static AuthorityService authorityService = null;
   private static SearchService searchService = null;
   private ServiceRegistry services;
   private ContentService contentService;
   private WorkflowService workflowService;
   private AVMService avmServ;
   private AuthenticationService authenticationService;
   WorkflowServiceImpl wserv = new WorkflowServiceImpl();
   private AuthenticationServiceImpl authenticationServiceImpl;
   // SearchServiceImpl searchServiceImpl = null;
   
   
   @Override
   protected void initialiseHandler(BeanFactory factory) {
      System.out.println("Inside initialiseHandler of KMReviewProcessAction!!!!");
      services = (ServiceRegistry) factory
            .getBean(ServiceRegistry.SERVICE_REGISTRY);
      contentService = (ContentService) factory.getBean("contentService");
      workflowService = services.getWorkflowService();
      avmServ = services.getAVMService();
      authenticationServiceImpl = (AuthenticationServiceImpl) services.getAuthenticationService();
      System.out.println("authenticationService "+authenticationService);
      nodeservice = services.getNodeService();
      searchService = services.getSearchService();
   }

   @Override
   public void execute(ExecutionContext context) throws Exception {
      logger.debug("Inside execute of KMReviewProcessAction logger@@@");
      System.out.println("Inside execute of KMReviewProcessActionsyso");
      // authserv.authenticate("admin", "admin".toCharArray());
      ContextInstance contextInstance = context.getContextInstance();
      String wfFlag = (String) contextInstance.getVariable("wfFlag");
      logger.debug("wfFlag in  KMReviewProcessAction logger @!@!" + wfFlag);
      System.out.println("wfFlag in  KMReviewProcessAction syso" + wfFlag);
      if (wfFlag.equalsIgnoreCase("Approved")) {
         // to do for approval!!
         String password = "km@jindal!";
         authenticationServiceImpl.authenticate("jindaladmin", password.toCharArray());      
         StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE,
               "SpacesStore");
         System.out.println("searchService  " + searchService);
         ResultSet rs = searchService.query(storeRef,
               SearchService.LANGUAGE_XPATH, "/app:company_home");
         NodeRef companyHomeNodeRef = null;
         try {
            if (rs.length() == 0) {
               throw new AlfrescoRuntimeException(
                     "Didn't find Company Home");
            }
            companyHomeNodeRef = rs.getNodeRef(0);
         } catch (Exception e) {
            logger.error("Error while getting company home "
                  + e.getMessage());
         }
         List<ChildAssociationRef> children = nodeservice
               .getChildAssocs(companyHomeNodeRef);
         for (ChildAssociationRef childAssoc : children) {
            NodeRef childNodeRef = childAssoc.getChildRef();
         System.out.println("childNodeRef inside  execute  " + " " + childNodeRef.getId()
                  + childNodeRef.getStoreRef());

         }
      }
   }
}

I am gettinig this error

nside initialiseHandler of KMReviewProcessAction!!!!
17:00:55,140 User:shishir ERROR [ui.common.Utils] A system error happened during the operation: org.alfresco.service.Ser
viceRegistry.getAuthenticationService()Lorg/alfresco/service/cmr/security/AuthenticationService;
java.lang.NoSuchMethodError: org.alfresco.service.ServiceRegistry.getAuthenticationService()Lorg/alfresco/service/cmr/se
curity/AuthenticationService;
   at com.xxxx.alfresco.km.bpm.KMReviewProcessAction.initialiseHandler(KMReviewProcessAction.java:52)
   at org.alfresco.repo.workflow.jbpm.JBPMSpringActionHandler.<init>(JBPMSpringActionHandler.java:53)
   at com.xxxx.alfresco.km.bpm.KMReviewProcessAction.<init>(KMReviewProcessAction.java:26)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
   at java.lang.Class.newInstance0(Class.java:355)
   at java.lang.Class.newInstance(Class.java:308)
   at org.jbpm.instantiation.FieldInstantiator.newInstance(FieldInstantiator.java:107)
   at org.jbpm.instantiation.FieldInstantiator.instantiate(FieldInstantiator.java:52)
   at org.jbpm.instantiation.Delegation.instantiate(Delegation.java:168)
   at org.jbpm.instantiation.Delegation.getInstance(Delegation.java:126)
   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.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)

Line no 52 is

authenticationServiceImpl = (AuthenticationServiceImpl) services.getAuthenticationService();

I checked with org.alfresco.service.ServiceRegistry class, i can see this


static final QName AUTHENTICATION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AuthenticationService");

/**
     * @return the authentication service (or null, if one is not provided)
     */
    @NotAuditable
    AuthenticationService getAuthenticationService();

Seriously i am struggling with getting authenticationServiceImpl object as in 3.2 , i am not able to do so?

This way i am not able to search also. :x

Sometime back also i was stuck in same then i had to change approach. :arrow: .

Any idea or workaround?
3 REPLIES 3

hsohaib
Champ on-the-rise
Champ on-the-rise
I don't get why you're trying to get the implementation class, or why using the authenticationService when the code is being executed inside alfresco, better use the AuthenticationUtil.runAs() , this way you won't need to include the password in your class, and avoid the whole problem with getting AuthenticationServiceImpl.


public void execute(ExecutionContext context) throws Exception {


AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>() {

            public Object doWork() throws Exception {

logger.debug("Inside execute of KMReviewProcessAction logger@@@");
      System.out.println("Inside execute of KMReviewProcessActionsyso");
      // authserv.authenticate("admin", "admin".toCharArray());
      ContextInstance contextInstance = context.getContextInstance();
      String wfFlag = (String) contextInstance.getVariable("wfFlag");
      logger.debug("wfFlag in  KMReviewProcessAction logger @!@!" + wfFlag);
      System.out.println("wfFlag in  KMReviewProcessAction syso" + wfFlag);
      if (wfFlag.equalsIgnoreCase("Approved")) {
         // to do for approval!!
         String password = "km@jindal!";
         authenticationServiceImpl.authenticate("jindaladmin", password.toCharArray());     
         StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE,
               "SpacesStore");
         System.out.println("searchService  " + searchService);
         ResultSet rs = searchService.query(storeRef,
               SearchService.LANGUAGE_XPATH, "/app:company_home");
         NodeRef companyHomeNodeRef = null;
         try {
            if (rs.length() == 0) {
               throw new AlfrescoRuntimeException(
                     "Didn't find Company Home");
            }
            companyHomeNodeRef = rs.getNodeRef(0);
         } catch (Exception e) {
            logger.error("Error while getting company home "
                  + e.getMessage());
         }
         List<ChildAssociationRef> children = nodeservice
               .getChildAssocs(companyHomeNodeRef);
         for (ChildAssociationRef childAssoc : children) {
            NodeRef childNodeRef = childAssoc.getChildRef();
         System.out.println("childNodeRef inside  execute  " + " " + childNodeRef.getId()
                  + childNodeRef.getStoreRef());

         }
      }

},    AuthenticationUtil.getSystemUserName()     };
}



if the problem with authenticationService was the only thing preventing your code from working it should be solved now.
Hope it helps.

PS: if you check the runtime class of AuthenticationService returned by serviceRegistry isn't neccessarily AuthenticationServiceImpl, but a proxy class returned by static method of "java.lang.reflect.Proxy", thats why you should always stick to using the interface and not the the implementation.

dynamolalit
Champ on-the-rise
Champ on-the-rise
Hi Sohaib,

Thanks for your reply.

I tried the approach you suggested.Still my problem persists.Here is my code:

public void execute(ExecutionContext context) throws Exception {
      System.out.println("Inside execute of KMReviewProcessAction");
      final ContextInstance contextInstance = context.getContextInstance();
      String systemUserName = AuthenticationUtil.getSystemUserName();
      System.out.println("systemUserName "+systemUserName);
      AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>() {
      String wfFlag = (String) contextInstance.getVariable("wfFlag");   
      List<ChildAssociationRef> children = null;
         public Object doWork() throws Exception {
            System.out.println("wfFlag in  KMReviewProcessAction "+ wfFlag);            
            // authserv.authenticate("admin", "admin".toCharArray());            
            //logger.debug("wfFlag in  KMReviewProcessAction logger @!@!"+ wfFlag);            
            if (wfFlag.equalsIgnoreCase("Approved")) {
               // to do for approval!!
               String password = "km@jindal!";
               //authenticationServiceImpl.authenticate("jindaladmin",   password.toCharArray());
               StoreRef storeRef = new StoreRef(
                     StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
               System.out.println("searchService here !! " + searchService);
               ResultSet rs = searchService.query(storeRef,SearchService.LANGUAGE_XPATH, "/app:company_home");
               NodeRef companyHomeNodeRef = null;
               try {
                  if (rs.length() == 0) {
                     throw new AlfrescoRuntimeException(
                           "Didn't find Company Home");
                  }
                  companyHomeNodeRef = rs.getNodeRef(0);
               } catch (Exception e) {
                  logger.error("Error while getting company home "
                        + e.getMessage());
               }
               children = nodeservice
                     .getChildAssocs(companyHomeNodeRef);
               for (ChildAssociationRef childAssoc : children) {
                  NodeRef childNodeRef = childAssoc.getChildRef();
                  System.out.println("childNodeRef inside  execute  "
                        + " " + childNodeRef.getId()
                        + childNodeRef.getStoreRef());

               }
            }
            return children;
         }
      }, systemUserName);
   }

I am getting this error


11:10:33,710 User:shishir DEBUG [repo.jscript.ScriptLogger] !!In Approval Workflow….!!!!@!@@@@
11:10:33,710 User:shishir DEBUG [repo.jscript.ScriptLogger] wfFlag in WF Approved
11:10:33,710 User:shishir DEBUG [repo.jscript.RhinoScriptProcessor] Time to execute script: 2.762642ms
Inside initialiseHandler of KMReviewProcessAction!!!!
Inside execute of KMReviewProcessAction
systemUserName System
wfFlag in  KMReviewProcessAction Approved
searchService here !! org.alfresco.repo.search.SearcherComponent@17a346e
11:10:33,773 User:shishir ERROR [ui.common.Utils] A system error happened during the operation: 03140002 Failed to signa
l transition 'approve' from workflow task 'jbpm$569'
org.alfresco.service.cmr.workflow.WorkflowException: 03140002 Failed to signal transition 'approve' from workflow task '
jbpm$569'
   at org.alfresco.repo.workflow.jbpm.JBPMEngine.endTask(JBPMEngine.java:1727)
   at org.alfresco.repo.workflow.WorkflowServiceImpl.endTask(WorkflowServiceImpl.java:627)
   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:304)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.jav
a:40)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInt
erceptor.java:49)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.alfresco.repo.audit.AuditMethodInterceptor.proceedWithAudit(AuditMethodInterceptor.java:238)
   at org.alfresco.repo.audit.AuditMethodInterceptor.proceed(AuditMethodInterceptor.java:205)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:153)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy48.endTask(Unknown Source)
   at org.alfresco.web.bean.workflow.ManageTaskDialog.transition(ManageTaskDialog.java:449)
   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.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
   at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:61)
   at javax.faces.component.UICommand.broadcast(UICommand.java:109)
   at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
   at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
   at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
   at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
   at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
   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.AuthenticationFilter.doFilter(AuthenticationFilter.java:110)
   at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:12
2)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy210.doFilter(Unknown Source)
   at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:74)
   at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:12
2)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy210.doFilter(Unknown Source)
   at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)
   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.core.StandardHostValve.invoke(StandardHostValve.java:128)
   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:286)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
   at java.lang.Thread.run(Thread.java:619)
Caused by: org.jbpm.graph.def.DelegationException: No authentication provider for net.sf.acegisecurity.providers.Usernam
ePasswordAuthenticationToken
   at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:388)
   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.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
   at org.jbpm.graph.def.ProcessDefinition$$EnhancerByCGLIB$$fd1f860.raiseException(<generated>)
   at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:379)
   at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:301)
   at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:241)
   at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:213)
   at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:196)
   at org.jbpm.graph.def.Node.leave(Node.java:466)
   at org.jbpm.graph.def.Node.leave(Node.java:438)
   at org.jbpm.graph.def.Node.execute(Node.java:429)
   at org.jbpm.graph.def.Node.enter(Node.java:390)
   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.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
   at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$ad194bf0.enter(<generated>)
   at org.jbpm.graph.def.Transition.take(Transition.java:167)
   at org.jbpm.graph.def.Node.leave(Node.java:479)
   at org.jbpm.graph.node.TaskNode.leave(TaskNode.java:213)
   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.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
   at org.jbpm.graph.node.TaskNode$$EnhancerByCGLIB$$e75f423a.leave(<generated>)
   at org.jbpm.graph.exe.Token.signal(Token.java:223)
   at org.jbpm.graph.exe.Token.signal(Token.java:188)
   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.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
   at org.jbpm.graph.exe.Token$$EnhancerByCGLIB$$59a7f284.signal(<generated>)
   at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:495)
   at org.alfresco.repo.workflow.jbpm.WorkflowTaskInstance.end(WorkflowTaskInstance.java:141)
   at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:436)
   at org.alfresco.repo.workflow.jbpm.JBPMEngine$26.doInJbpm(JBPMEngine.java:1712)
   at org.springmodules.workflow.jbpm31.JbpmTemplate$1.doInHibernate(JbpmTemplate.java:87)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:338)
   at org.springmodules.workflow.jbpm31.JbpmTemplate.execute(JbpmTemplate.java:80)
   at org.alfresco.repo.workflow.jbpm.JBPMEngine.endTask(JBPMEngine.java:1680)
   … 68 more
Caused by: net.sf.acegisecurity.providers.ProviderNotFoundException: No authentication provider for net.sf.acegisecurity
.providers.UsernamePasswordAuthenticationToken
   at net.sf.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:169)
   at net.sf.acegisecurity.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:49)
   at net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:372)
   at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:77
)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInt
erceptor.java:49)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.alfresco.repo.audit.AuditMethodInterceptor.proceed(AuditMethodInterceptor.java:199)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:153)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy27.query(Unknown Source)
   at com.jindal.alfresco.km.bpm.KMReviewProcessAction$1.doWork(KMReviewProcessAction.java:108)
   at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:514)
   at com.jindal.alfresco.km.bpm.KMReviewProcessAction.execute(KMReviewProcessAction.java:94)
   at org.jbpm.graph.def.Action.execute(Action.java:129)
   at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:284)
   … 107 more

Its saying error is @ line no 108 as

at com.jindal.alfresco.km.bpm.KMReviewProcessAction$1.doWork(KMReviewProcessAction.java:108)

Which is

ResultSet rs = searchService.query(storeRef,SearchService.LANGUAGE_XPATH, "/app:company_home");

Means still its not able to get SearchService??

:?:

dynamolalit
Champ on-the-rise
Champ on-the-rise
Hi,

What i got from my RnD is that Alfresco 3.2 will not allow you to get services directly the way i am trying.

As another approach , if you want to get a service say searchservice, you have to get it thru managed bean whose entry should be in faces-config-beans.xml with particular service as

<managed-property>
         <property-name>searchService</property-name>
         <value>#{SearchService}</value>
      </managed-property>

Now you can get it in your code.May be if you want to get services in Workflow ActionHandler, you may need to make it a managed bean. :roll:

May be I am not right fully. :idea:

Any ideas or comments?