Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught Throwable javax.servlet.ServletException: java.lang.NullPointerException

sivaprasadreddy
Level 4
Level 4

Hi All,

I''m trying to create sample workflow dynamic participant chooser by following doc [1]. I'm getting error message as shown in the attached image. I've also verified bundles and all are in active state (http://localhost:4502/system/console/bundles). It would be great if someone can help me on this.

My Java class:

import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
import org.osgi.framework.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
 
import com.day.cq.workflow.WorkflowException;
import com.day.cq.workflow.WorkflowSession;
import com.day.cq.workflow.exec.ParticipantStepChooser;
import com.day.cq.workflow.exec.WorkItem;
import com.day.cq.workflow.metadata.MetaDataMap;

@Component
@Service
@Properties({
        @Property(name = Constants.SERVICE_DESCRIPTION, value = "An example implementation of a dynamic participant chooser."),
        @Property(name = ParticipantStepChooser.SERVICE_PROPERTY_LABEL, value = "Workflow Initiator Participant Chooser") })
public class DynamicParticipant implements ParticipantStepChooser {
 
    private Logger logger = LoggerFactory.getLogger(this.getClass());
 
    public String getParticipant(WorkItem arg0, WorkflowSession arg1,
            MetaDataMap arg2) throws WorkflowException {
 
        String initiator = arg0.getWorkflow().getInitiator();
        logger.info("Assigning Dynamic Participant Step work item to {}",initiator);
 
        return initiator;
    }
}

Error in the log:

ERROR* [0:0:0:0:0:0:0:1 [1471326869740] POST /libs/crxde/build HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught Throwable
javax.servlet.ServletException: java.lang.NullPointerException
    at com.day.crx.ide.AbstractCRXDEServlet.throwError(AbstractCRXDEServlet.java:139)
    at com.day.crx.ide.CRXDEBuildServlet.handleAuthenticatedRequest(CRXDEBuildServlet.java:178)
    at com.day.crx.ide.AbstractCRXDEServlet.processRequest(AbstractCRXDEServlet.java:98)
    at com.day.crx.ide.AbstractCRXDEServlet.doPost(AbstractCRXDEServlet.java:79)
    at org.apache.sling.api.servlets.SlingAllMethodsServlet.mayService(SlingAllMethodsServlet.java:149)
    at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:345)
    at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:376)
    at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:533)
    at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:44)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:77)
    at com.day.cq.personalization.impl.TargetComponentFilter.doFilter(TargetComponentFilter.java:96)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:146)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.wcm.core.impl.WCMComponentFilter.filterRootInclude(WCMComponentFilter.java:371)
    at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:171)

[1]: https://docs.adobe.com/docs/en/aem/6-0/develop/extending/workflows/wf-ref.html

Note: I'm using AEM 6.1 and Java 7. I've not installed any hotfixes.

1 Reply
prateekkumar
Level 1
Level 1

Hi Siva,

 

Were you able to fix this issue? Would you be able to tell us the root cause and the fix? I am getting the same issue with the Workflows.