我想获取类型cm:person
的所有属性并将其显示在表中。为此,我使用了Java WebScript。
但是当我调用它时,我得到一个异常:
.sf.acegisecurity.providers.ProviderNotFoundException:没有net.sf.acegisecurity.providers的身份验证提供程序。UsernamePasswordAuthenticationToken
在web脚本中,我标记了抛出异常的位置:
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;
}
}
会是什么原因呢?
奇怪的是,我将logger.debug(...)
替换为System.out.println(...)
,现在我可以在日志中看到以下内容:
alfrescotomcat-stdout.2017-03-15.log:
...
null
{http://www.alfresco.org/model/content/1.0}email =
{http://www.alfresco.org/model/content/1.0}homeFolder = workspace://SpacesStore/ac210417-f260-4b24-85ec-7fea912383a4
{http://www.alfresco.org/model/system/1.0}node-uuid = da262d43-d317-463f-b950-c7da54d88e31
{http://www.alfresco.org/model/content/1.0}name = da262d43-d317-463f-b950-c7da54d88e31
{http://www.alfresco.org/model/system/1.0}store-identifier = SpacesStore
{http://www.alfresco.org/model/content/1.0}userName = {http://www.alfresco.org/model/content/1.0}owner
{http://www.alfresco.org/model/content/1.0}homeFolderProvider = userHomesHomeFolderProvider
{http://www.alfresco.org/model/content/1.0}owner = {http://www.alfresco.org/model/content/1.0}owner
{http://www.alfresco.org/model/system/1.0}cascadeCRC = 3614281327
{http://www.alfresco.org/model/content/1.0}sizeQuota = -1
{http://www.alfresco.org/model/system/1.0}cascadeTx = 295
{http://www.alfresco.org/model/content/1.0}lastName =
{http://www.alfresco.org/model/content/1.0}organizationId =
{http://www.alfresco.org/model/content/1.0}sizeCurrent = 0
{http://www.alfresco.org/model/system/1.0}store-protocol = workspace
{http://www.alfresco.org/model/system/1.0}node-dbid = 1145
{http://www.alfresco.org/model/system/1.0}locale =
{http://www.alfresco.org/model/content/1.0}firstName = {http://www.alfresco.org/model/content/1.0}owner
null
{http://www.alfresco.org/model/content/1.0}email =
{http://www.alfresco.org/model/content/1.0}homeFolder = workspace://SpacesStore/ac210417-f260-4b24-85ec-7fea912383a4
{http://www.alfresco.org/model/system/1.0}node-uuid = da262d43-d317-463f-b950-c7da54d88e31
{http://www.alfresco.org/model/content/1.0}name = da262d43-d317-463f-b950-c7da54d88e31
{http://www.alfresco.org/model/system/1.0}store-identifier = SpacesStore
{http://www.alfresco.org/model/content/1.0}userName = {http://www.alfresco.org/model/content/1.0}owner
{http://www.alfresco.org/model/content/1.0}homeFolderProvider = userHomesHomeFolderProvider
{http://www.alfresco.org/model/content/1.0}owner = {http://www.alfresco.org/model/content/1.0}owner
{http://www.alfresco.org/model/system/1.0}cascadeCRC = 3614281327
{http://www.alfresco.org/model/content/1.0}sizeQuota = -1
{http://www.alfresco.org/model/system/1.0}cascadeTx = 295
{http://www.alfresco.org/model/content/1.0}lastName =
{http://www.alfresco.org/model/content/1.0}organizationId =
{http://www.alfresco.org/model/content/1.0}sizeCurrent = 0
{http://www.alfresco.org/model/system/1.0}store-protocol = workspace
{http://www.alfresco.org/model/system/1.0}node-dbid = 1145
{http://www.alfresco.org/model/system/1.0}locale =
{http://www.alfresco.org/model/content/1.0}firstName = {http://www.alfresco.org/model/content/1.0}owner
...
1条答案
按热度按时间xtupzzrd1#
今天,我在调试Visual Studio代码时遇到了类似的问题,问题变成了调试器本身。
看起来,如果在调用nodeService(我猜是其他经过身份验证的服务)的行中设置断点并跳过它,问题就出现了。
这可能与Alfresco可能在线程级别存储authenticatino信息的事实有关,我猜调试器的仪器可能正在另一个线程或类似的东西中运行该步骤。
幸运的是,似乎只是“跑”过线,而不是踩在那里解决了这个问题。