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);
}
}
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.0.1</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Name>cq-core bundle</Bundle-Name>
<Export-Package>twitter4j.*</Export-Package>
<Import-Package>
!twitter4j.internal.http.alternative,
!org.slf4j.impl,com.day.*,*
</Import-Package>
<Private-Package>com.day.twitter</Private-Package>
</instructions>
</configuration>
</plugin>
-------------------------------
Bnd-LastModified: 1334862237167
Build-Jdk: 1.6.0_21
Built-By: bvibor
Bundle-ManifestVersion: 2
Bundle-Name: cq-core bundle
Bundle-SymbolicName: com.day.twitter.workflow
Bundle-Version: 1.0.0
Created-By: Apache Maven Bundle Plugin
Export-Package: twitter4j.internal.util, twitter4j.internal.http; uses:="twitter4j, twitter4j.internal.logging, twitter4j.internal.util, twitter4j.http, twitter4j.conf, javax.xml.parsers, twitter4j.internal.org.json, org.w3c.dom, org.xml.sax", twitter4j; uses:="twitter4j.internal.org.json, twitter4j.internal.http, twitter4j.api, twitter4j.http, twitter4j.internal.async, twitter4j.conf, twitter4j.internal.logging", twitter4j.internal.org.json, twitter4j.api; uses:=twitter4j, twitter4j.http; uses:="twitter4j.internal.http, twitter4j, twitter4j.conf, javax.crypto.spec, javax.crypto, twitter4j.internal.logging", twitter4j.internal.async, twitter4j.conf; uses:="twitter4j.internal.http, twitter4j.http, twitter4j.internal.async, twitter4j", twitter4j.internal.logging; uses:="org.apache.commons.logging, org.apache.log4j, org.slf4j, twitter4j.conf", twitter4j.util; uses:="twitter4j.internal.http, twitter4j, twitter4j.internal.org.json, twitter4j.http"
Ignore-Package: org.slf4j.impl, twitter4j.internal.http.alternative
Import-Package: javax.crypto, javax.crypto.spec, javax.xml.parsers, org.apache.commons.logging, org.apache.log4j, org.osgi.framework; version="1.4", org.slf4j; version="1.5", org.w3c.dom, org.xml.sax, twitter4j, twitter4j.api, twitter4j.conf, twitter4j.http, twitter4j.internal.async, twitter4j.internal.http, twitter4j.internal.logging, twitter4j.internal.org.json, twitter4j.internal.util, twitter4j.util
Manifest-Version: 1.0
Service-Component: OSGI-INF/components.xml
Tool: Bnd-0.0.357
well thats what am trying to figure out. The final objective is to add this action class to a process step with a workflow inside day cq. Primarily, this is an entry class for the process step in the workflow. So yes this is the first service...that would eventually use a referenced service. Should I use service reference, if yes how..
Yes, that is what am doing for twitterService that is referenced within
SendMessageProcessAction, but SendMessageProcessAction is the entry level
service...cannot be referenced from anywhere. It will itself has references
to other services but it is like the parent service...it is not referenced
from anywhere.
Am I missing some annotation for the first parent entry level service..
oh actually there is nothing in there..its from the pom.xml. Just the way the project is build.
its the groupid.artifact id. Am I doing something wrong here....am guessing yes..
<modelVersion>4.0.0</modelVersion>
<groupId>com.day.twitter</groupId>
<artifactId>workflow</artifactId>
<version>1.0.0</version>
<packaging>bundle</packaging>
Tried...with no luck! :!....The service gets registered...however with the
same exception. Next when I associate it with the workflow, my workflow
inbox message also states that the sendmessageprocessaction (i.e my service
class) process implementation not found..which is primarily the message due
to the exception! ![]()
Attached is the zip file for reference and our discussions.
Steps to reproduce the error :
1. Using eclipse and maven plug-in - build the code base using the
commands "mvn clean" and "mvn package".
2. The compiled code with the jar file would be pushed under the "target"
directory.
Day CQ :
1. Navigate to the system console : http:/localhost:4502/system/console
2. Deploy the above created bundle (jar file) : once installed we would see
a "cq-core bundle" as the name in the bundle list.
3. Look at the error.log file. The error log file would state that the
package was installed and refreshed
4. Next, start the bundle to make it active. Look at the error.log (located
under C:\\Author\crx-quickstart\logs
5. We would notice that the error displays : that the
SendMessageProcessAction cannot be instantiated and there is a
classnotfound exception.
6. Note that the services in the packages are registered.
(SendMessageProcessAction and TwitterServiceImpl)
7. To validate the above error : Create a workflow using CQ workflow module
and add a process step.
8. Associate a process step with a registered service
(SendMessageProcessAction)
9. Run the workflow associating it with a web page or independently. You
would notice that the inbox message displays
(Process Implementation not found for SendMessageProcessAction)
Hope the above help us troubleshoot the issue.
North America
Europe, Middle East and Africa
Asia Pacific