我正在使用 AEM 6.1
和 Maven
作为构建管理器 . 我已使用Adobe提供的未经模糊处理的 UberJar
更新了.m2本地文件夹 . 我收到以下错误:
错误[JobHandler:/ etc / workflow / instances / server0 / 2016-07-15 / model_157685507700064:/ content / myApp / testing / wf_test01] com.adobe.granite.workflow.core.job.JobHandler未找到流程实现:com .myApp.workflow.ActivatemyAppPageProcess com.adobe.granite.workflow.WorkflowException:找不到流程实现:com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:197)中的com.myApp.workflow.ActivatemyAppPageProcess )在com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:232)at org.apache.sling.event.impl.jobs.JobConsumerManager $ JobConsumerWrapper.process(JobConsumerManager.java:512)at at org.apache.sling.event.impl.jobs.queues.JobRunner.run(JobRunner.java:205)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)at java.util.concurrent.ThreadPoolExecutor $ java.lang.Thread.run上的Worker.run(ThreadPoolExecutor.java:617)(Thread.java:745)
UberJar
似乎没有 com.adobe.granite.workflow.core.job
包 . 有什么方法可以解决这个问题吗?
流程步骤 ActivatemyAppPageProcess
的 .execute
方法:
public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap args) throws WorkflowException {
Session participantSession = null;
Session replicationSession = null;
// ResourceResolver resourceResolver = null;
try {
log.info("Inside ActivatemyAppPageProcess ");
Session session = workflowSession.getSession();
if (replicateAsParticipant(args)) {
String approverId = resolveParticipantId(workItem, workflowSession);
if (approverId != null) {
participantSession = getParticipantSession(approverId, workflowSession);
}
}
if (participantSession != null)
replicationSession = participantSession;
else {
replicationSession = session;
}
WorkflowData data = workItem.getWorkflowData();
String path = null;
String type = data.getPayloadType();
if ((type.equals("JCR_PATH")) && (data.getPayload() != null)) {
String payloadData = (String) data.getPayload();
if (session.itemExists(payloadData))
path = payloadData;
}
else if ((data.getPayload() != null) && (type.equals("JCR_UUID"))) {
Node node = session.getNodeByUUID((String) data.getPayload());
path = node.getPath();
}
ReplicationOptions opts = null;
String rev = (String) data.getMetaDataMap().get("resourceVersion", String.class);
if (rev != null) {
opts = new ReplicationOptions();
opts.setRevision(rev);
}
opts = prepareOptions(opts);
if (path != null) {
ResourceCollection rcCollection =
ResourceCollectionUtil
.getResourceCollection(
(Node) this.admin.getItem(path),
(ResourceCollectionManager) this.rcManager);
boolean isWFPackage = isWorkflowPackage(path, resolverFactory, workflowSession);
List<String> paths = getPaths(path, rcCollection);
for (String aPath : paths)
if (canReplicate(replicationSession, aPath)) {
if (opts != null) {
if (isWFPackage) {
setRevisionForPage(aPath, opts, data);
}
this.replicator
.replicate(replicationSession,
getReplicationType(),
aPath,
opts);
} else {
this.replicator
.replicate(replicationSession,
getReplicationType(),
aPath);
}
} else {
log.debug(session.getUserID() + " is not allowed to replicate " + "this page/asset " + aPath + ". Issuing request for 'replication");
Dictionary properties = new Hashtable();
properties.put("path", aPath);
properties.put("replicationType", getReplicationType());
properties.put("userId", session.getUserID());
Event event = new Event("com/day/cq/wcm/workflow/req/for/activation", properties);
this.eventAdmin.sendEvent(event);
}
} else {
log.warn("Cannot activate page or asset because path is null for this workitem: " + workItem.toString());
}
} catch (RepositoryException e) {
throw new WorkflowException(e);
} catch (ReplicationException e) {
throw new WorkflowException(e);
} finally {
if ((participantSession != null) && (participantSession.isLive())) {
participantSession.logout();
participantSession = null;
}
}
}
2 回答
com.adobe.granite.workflow.core.job
根本不在AEM中导出 . 这意味着,您无法使用它,因为它对您的代码是不可见的 .com.adobe.granite.workflow.core
包仅导出com.adobe.granite.workflow.core.event
. 如果您使用AEM工作流程,则应该坚持使用com.adobe.granite.workflow.api
包 .以下包在此捆绑包中导出,因此可用:
即使
uber.jar
有包,如果您在/system/console/bundles
上查看AEM实例并单击com.adobe.granite.workflow.core
包,您将看到"exported packages"中没有com.adobe.granite.workflow.core.job
可用 . 因此,即使您的IDE,Maven和/或Jenkins可以处理它,AEM也无法执行您的代码 .在AEM中,您只能使用在其中一个可用捆绑包中导出的包或捆绑包中包含的包 - 这不是一个坏主意 . 然后,您将拥有相同代码的两个版本,这将导致进一步的问题 .
看过代码后我会说这里有另一个问题 . 解决这个问题也可以帮助你摆脱另一个问题 .
您尝试为已在工作流中使用的路径启动另一个WF(激活请求) . 您必须终止当前工作流实例才能执行此操作 .
干净方法的一个例子是:
出现错误的可能原因可能是您的工作流程
com.myApp.workflow.ActivatemyAppPageProcess
服务/组件未处于活动状态,因此未绑定到JobHandler的可用进程列表,从而导致此异常 .您可以在
/system/console/components
中检查您的自定义流程组件是否处于活动状态?如果没有,那么您将必须解决导致服务/组件不可用的依赖性 .