AnsweredAssumed Answered

ProviderNotFoundException when calling Java WebScript

Question asked by Aleksey Bykov on Mar 15, 2017
Latest reply on Mar 15, 2017 by Aleksey Bykov

I want to get all the properties of the type cm:person and display it in the table. For this I have Java WebScript.

 

But when I call it I get an exception:

 

net.sf.acegisecurity.providers.ProviderNotFoundException: 
No authentication provider for net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken

 

In the web script I marked where the exception is thrown:

 

public class AssignmentsRetriever extends DeclarativeWebScript {
    Logger logger = Logger.getLogger(AssignmentsRetriever.class);

    private WorkflowService workflowService;
    private PersonService personService;
    private NodeService nodeService;

    @Override
    protected Map<String, Object> executeImpl(WebScriptRequest req, Status status) {
        String taskId = req.getParameter("taskId");
       
        WorkflowTaskQuery tasksQuery = new WorkflowTaskQuery();
        WorkflowTask workflowTask = workflowService.getTaskById("activiti$"+taskId);
       
        tasksQuery.setProcessId(workflowTask.getPath().getInstance().getId());
          
        List<WorkflowTask> allWfTasks =
               workflowService.queryTasks(tasksQuery, true);
          NodeRef personNodeRef;
          Map<QName, Serializable> personProperties;
          Iterator iterator;
        for (WorkflowTask task : allWfTasks) {
             logger.debug("processId == " +
                    task.getPath().getInstance().getId());
             
             personNodeRef =
                    personService.getPerson("{http://www.alfresco.org/model/content/1.0}owner");
               
               // Here an exception is thrown
             logger.debug("cm:userName == " +
                    nodeService.getProperties(personNodeRef).get("cm:userName"));
             
               // Here an exception is thrown
             personProperties = nodeService.getProperties(personNodeRef);                         
            iterator = personProperties.entrySet().iterator();
            while (iterator.hasNext()) {
                Map.Entry pairs = (Map.Entry)iterator.next();
                logger.debug(pairs.getKey() + " = " + pairs.getValue());
            }
        }
       
        ...               

        return model;
    }
   
    public WorkflowService getWorkflowService() {
        return workflowService;
    }

    public void setWorkflowService(WorkflowService workflowService)
    {
        this.workflowService = workflowService;
    }
   
    public void setNodeService(NodeService nodeService) {
         this.nodeService = nodeService;
    }
   
    public NodeService getNodeService() {
         return nodeService;
    }
   
    public void setPersonService(PersonService personService) {
         this.personService = personService;
    }
   
    public PersonService getPersonService() {
         return personService;
    }
}

 

What could be the reason?

 

I would be very grateful for the information. Thanks to all.

Outcomes