Camunda服务任务错误:表达式中使用的未知属性
我创建了一个简单的工作流程,在其中使用服务任务在另一个过程中调用事件子过程,并使用Java代码来执行此操作。我使用实现类型“委托表达式”(见下文)
在运行服务任务时,我会收到以下错误。
提交任务表格时发生了错误: 无法提交任务表54897AF5-DC6B-11EC-85F0-E02BE903A6C0:表达式中使用的未知属性:#{castivalProcess}。原因:无法解析标识符“取消程序”
这是我的Java代码:
package org.example;
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.camunda.bpm.engine.runtime.MessageCorrelationResult;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
@Component("cancelProcess")
public class CancelProcess implements JavaDelegate {
public void execute(DelegateExecution execution) {
// correlate the message
RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService();
MessageCorrelationResult result = runtimeService.createMessageCorrelation("CANCEL_PROCESS")
.processInstanceBusinessKey("Order-Process-123")
.setVariable("employeeName", execution.getVariable("employeeName"))
.correlateWithResult();
}
}
请告知。我在这里犯了什么错误。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正确使用了实现类型委托表达式和在表达式内部的弹簧bean的名称。如果无法解决组件的名称,则可能是未检测到组件。日志是否显示声明是找到声明的?
Spring的组件扫描仅自动拾取组件,这些组件在您的应用程序中的软件包下方的软件包中声明。
参阅Eg https://wwwwww.baeldung.com/spring-component-scanning
请 将主应用程序类放置在组件类上方的root软件包中。
You correctly used the implementation type delegate expression and inside the expression the name of the spring bean. If the name of the component cannot be resolved then it could be that the component has not been detected. Does the log show that the declaration is found?
Spring's component scan only automatically picks up on components which are declared in a package below the package your Application resides in.
See e.g. https://www.baeldung.com/spring-component-scanning
Try placing your main application class in a root package above the component classes.