21 Replies Latest reply: May 11, 2013 5:48 AM by Avinashtan RSS

    osgi workflowprocess gives classnotfound exception when osgi bundle is activated


      I did create an osgi service that extends workflowprocess interrface using eclipse. I install the bundle that contains this service and then deploy and activate the bundle in day cq. However, on activation I receive an error stating that my class is not found. Please note that both this service and the referenced service(twitterservice that I created) gets registered and the bundle is activated, however, its unable to find the class SendMessageProcessAction on the activation of the bundle. Hope someone could assist.



      POST /system/console/bundles/246 HTTP/1.1] com.day.twitter.workflow [com.day.twitter.service.impl.SendMessageProcessAction] Error during instantiation of the implementation object (java.lang.ClassNotFoundException: com.day.twitter.service.impl.SendMessageProcessAction not found by com.day.twitter.workflow [246]) java.lang.ClassNotFoundException: com.day.twitter.service.impl.SendMessageProcessAction not found by com.day.twitter.workflow [246]

          at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:787 )

          at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)



      package com.day.twitter.service.impl;



      import javax.jcr.RepositoryException;

      import javax.jcr.Session;


      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.Reference;

      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.WorkItem;

      import com.day.cq.workflow.exec.WorkflowData;

      import com.day.cq.workflow.exec.WorkflowProcess;

      import com.day.cq.workflow.metadata.MetaDataMap;

      import com.day.twitter.service.SendMessageProcess;

      import com.day.twitter.service.TwitterService;







          @Property(name = Constants.SERVICE_DESCRIPTION, value = " An example of Social Publish Implementation"),

          @Property(name = Constants.SERVICE_VENDOR, value = "RIM POC"),

          @Property(name = "process.label", value = "RIM POC Social Publish")


      public class SendMessageProcessAction implements WorkflowProcess{





          private TwitterService twitterService; 



          public TwitterService getTwitterService() {

              return twitterService;




          public void setTwitterService(TwitterService twitterService) {

              this.twitterService = twitterService;




           * @scr.reference


          private static final String TYPE_JCR_PATH = "JCR_PATH";



          private final Logger logger = LoggerFactory.getLogger(this.getClass()



          private final Logger logger1 = LoggerFactory.getLogger(SendMessageProcessAction.class);


          public void execute(WorkItem workItem, WorkflowSession workflowSession,MetaDataMap args)

          throws WorkflowException {

              final Session session = workflowSession.getSession();

              final WorkflowData data = workItem.getWorkflowData();


              logger.info("TEST VIBHOR!!");

              logger1.info("TEST VIBHOR BHATIA!!");


              String path = null;

              String type = data.getPayloadType();

              if (type.equals(TYPE_JCR_PATH) && data.getPayload() != null) {

                  String payloadData = (String) data.getPayload();

                  try {

                      if (session.itemExists(payloadData)) {

                          path = payloadData;


                  } catch (RepositoryException e) {

                      // TODO Auto-generated catch block

                      logger.error("Exception - Check repository for Payload data path");







              String msg = "CQ5 workflow event";

                  // is there a message?

              String argument = args.get("PROCESS_ARGS", "default value");

              boolean equal = argument.equals("argument1");



                  String recipient = argument.toString();

                   sendDirectMessageOnTwitter(recipient, msg, path);

              } else {


                          .error("for sending a DM on Twitter (make sure Twitter allows you to DM that account): dm,(recipient id)");   

                 //  return "Check config - error";







          private void sendDirectMessageOnTwitter(String recipient, String msg, String path) {

              getTwitterService().sendDirectMessage(recipient, msg + ", path: " + path);