CQ 5.6.1 getWorkflowSession导致Uncaught Throwable java.lang.NullPointerException

时间:2017-04-14 11:40:41

标签: session content-management-system workflow cq5 aem

at com.cuso.Mao.doGet(Mao.java:97)     在org.apache.sling.api.servlets.SlingSafeMethodsServlet.mayService(SlingSafeMethodsServlet.java:268)     在org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:344)     在org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:375)     at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:508)     在org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:45)     at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:64)     在com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:146)     at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)     在com.day.cq.wcm.core.impl.WCMComponentFilter.filterRootInclude(WCMComponentFilter.java:356)     在com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:168)     at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)     在com.day.cq.personalization.impl.TargetComponentFilter.doFilter(TargetComponentFilter.java:96)     at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)     at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:254)

第97行只是调用WorkflowSession wf = workflowServiceObject.getWorkflowSession(jcrsessionObject); 我应该使用JACKRABBIT SESSION而不是jcrSession吗?哪一个是对的?

1 个答案:

答案 0 :(得分:0)

我遇到了类似的情况。你传递的模型节点没有任何问题。

从workflowService获取新的workflowSession正在给出nullpointer所以我必须使用 getServiceReference 方式在我的Activator中获取workflowService并将它分配给实用程序类中的静态变量。我得到了: 以下是记录: -

无法从节点读取工作流模型:/ etc / workflow / models / deletecontent / jcr:content / model

还有一个"会话已经关闭"问题。为此,我再次将resolverFactory作为我的实用程序类的一部分,使用它我可以在我的servlet中获得administrativeResourceResolver。