[英]Null pointer exception while starting a process outside Alfresco Activiti
I am using Alfresco Activiti and want to initiate a task outside of it. 我正在使用Alfresco Activiti,并希望在其外部启动任务。 I have written a standalone java program to do this (ie my java program creates a task in alfresco activiti on execution).
我已经编写了一个独立的Java程序来执行此操作(即,我的Java程序在执行时会在露天活动中创建一个任务)。
TaskService taskService=processEngine.getTaskService();
Task task=taskService.createTaskQuery().taskAssignee("USER MAYA SHARMA").singleResult();
System.out.println(task.getName());
The program runs fine as long as my taskAssignee
is $INITIATOR, but when I change my taskAssignee
to a real user in alfresco activiti, it throws a null pointer exception. 只要我的
taskAssignee
是$ INITIATOR,该程序就可以正常运行,但是当我在露天活动taskAssignee
更改为真实用户时,它将引发空指针异常。
Exception in thread "main" java.lang.NullPointerException at TestingABC.main(TestingABC.java:34)
NullPointerException
occurs when you try to call a method on a null
Object. 当您尝试在
null
对象上调用方法时,会发生NullPointerException
。 For example: 例如:
String aNullString = null;
aNullString.indexOf("");
will give a NullPointerException
because aNullString
is null
, which does not have any methods. 将给出
NullPointerException
因为aNullString
为null
,它没有任何方法。
If your error is occurring on the first line you posted, then that means processEngine
is null
. 如果您的错误发生在您发布的第一行,则意味着
processEngine
为null
。
If the error is thrown on the second line, then either: 如果错误发生在第二行,则:
taskService
taskService.singleResult
is null
为
null
If the error is thrown on the third line, then task
is null
. 如果在第三行引发错误,则
task
为null
。
Please edit your post so that I know which line you posted is throwing the error so I can give a more detailed response.
请编辑您的帖子,以便我知道您发布的哪一行引发了错误,因此我可以给出更详细的答复。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.