Skip navigation
bvibor
Currently Being Moderated

osgi workflowprocess gives classnotfound exception when osgi bundle is activated

Apr 19, 2012 12:34 PM

Tags: #exception #cq #day #osgi #classnotfound #workflowprocess

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;

 

 

 

@Component

@Service

@Properties({

    @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{

 

   

   

    @Reference

    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()

            .getName());

       

    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");

                e.printStackTrace();

            }

        }

       

        logger.info("arguments");

       

        String msg = "CQ5 workflow event";

            // is there a message?

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

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

            

        if(equal){

            String recipient = argument.toString();

             sendDirectMessageOnTwitter(recipient, msg, path);

        } else {

            logger

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

    }

  

}

 
Replies
  • Currently Being Moderated
    Apr 19, 2012 12:43 PM   in reply to bvibor

    How is your pom.xml lool like ?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 19, 2012 1:06 PM   in reply to bvibor

    How are you using SendMessageProcessAction in com.day.twitter.workflow ? using service reference ?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 19, 2012 1:25 PM   in reply to bvibor

    using

     

    @Reference

        private SendMessageProcessAction sendMessageProcessAction;

     

    But ideally you should expose interface than actual class. Can you post code for com.day.twitter.workflow ?

     

    Yogesh

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 19, 2012 2:03 PM   in reply to bvibor

    From com.day.twitter.service.impl.SendMessageProcessAction not found by com.day.twitter.workflow it looks like com.day.twitter.workflow is trying to access SendMessageProcessAction. Can you post code for com.day.twitter.workflow

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 19, 2012 2:18 PM   in reply to bvibor

    Can you try to put com.day.twitter.service.impl.SendMessageProcessAction in export section of your pom.xml

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 19, 2012 4:45 PM   in reply to bvibor

    Can you put your package and let us know steps to reproduce ?

     

    Yogesh

     
    |
    Mark as:
  • Currently Being Moderated
    May 11, 2013 5:48 AM   in reply to bvibor

    one of the workaround is by adding -XX:-UseSplitVerifier option to the JVM .This issue seems to be an with CQ 5.6 and java 7

     
    |
    Mark as:
  • Currently Being Moderated
    May 11, 2013 5:48 AM   in reply to Avinashtan

    This issue arrises due to @Reference

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points