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

Similar Messages

  • ClassNotFound Exception when try to list cardservice

    I was trying to list the applications in the card with the codes in OCF1.2 programmer's guide, but got a ClassNotFound Exception. Here is my code:
         AppletAccessCardService aacs = null;
                   aacs = (AppletAccessCardService)sc.getCardService(AppletAccessCardService.class, true);
                   if(aacs != null){
                        AppletInfo[] ai = aacs.list();
                        for(int i=0; i<ai.length; i++)
                             System.out.println(ai.toString());
    The output message:
    java.lang.ClassNotFoundException: CardService implementing interface opencard.opt.applet.mgmt.AppletAccessCardService
    at opencard.core.service.CardServiceRegistry.getCardServiceInstance(CardServiceRegistry.java:269)
    at opencard.core.service.SmartCard.getCardService(SmartCard.java:331)
    at GetCID.main(GetCID.java:27)
    But cardman list shows there are applets in the card:
    Application: PERSONALIZED (--------) 080000000A0001
    Load File : LOADED (--------) A0000000620001 (java.lang)
    Load File : LOADED (--------) A0000000620101 (javacard.framework)
    Load File : LOADED (--------) A0000000620102 (javacard.framework)
    Load File : LOADED (--------) A0000000620201 (javacardx.crypto)
    Load File : LOADED (--------) A0000000030000 (visa.openplatform)
    Load File : LOADED (--------) A000000167413001
    Load File : LOADED (--------) A0000001320001
    Load File : LOADED (--------) A0000000035350
    Load File : LOADED (--------) A000000063 (PKCS15)
    Load File : LOADED (--------) 080000000A00
    Why did I get this Exception? Is it because that no applet in the card implements the AppletAccessService interface? Thanks in advance.

    The problem is located in your opencard.properties file:
    You have to include opencard.opt.emv.mgmt.EMVCardServiceFactory to your list of OpenCard.services.
    My complete opencard.properties is as follows:
    # Card service configuration  #
    OpenCard.services = \
        com.ibm.opencard.factory.MFCCardServiceFactory \
        opencard.opt.util.PassThruCardServiceFactory \
         opencard.opt.emv.mgmt.EMVCardServiceFactory
    # Card terminal configuration #
    OpenCard.terminals = com.ibm.opencard.terminal.pcsc10.Pcsc10CardTerminalFactory
    # Trace configuration         #
    OpenCard.trace = opencard:5

  • ClassNotFound exception, when load own Customizer

    I have own BooleanCustomizer that implements DescriptorCustomizer, it's packed in the same jar as entity classes. It's registered in persistence.xml:
    <property
         name="toplink.descriptor.customizer.MyEntityClass"
         value="jpa.util.BooleanCustomizer"/>
    Customizer works fine out of container - JUnit tests from Eclipse and Swing app. But in JSF app running on Tomcat, I get exception:
    oracle.toplink.essentials.exceptions.EntityManagerSetupException Exception Description: ClassNotFound: [jpa.util.BooleanCustomizer]
    It looks similar as:
    class not found exception - where to put custom session customizer?
    Any solution ?

    Which version are you using? A change was made recently to TopLink essentials to correct a classloader issue on session customizers.
    Cheers,
    Guy

  • IASAT gives OutOfMemory exception when adding servers

    Im trying to add a new server to the Admin Tool using File\New Server
    dialog. If I enter the correct info for my server I get a
    java.lang.OutOfMememory exception. The box Im using is a fresh
    install of NT4 Server SP5 with Option Pack, IE5 and Oracle8i. I tried
    turning off the JIT and setting max heap size in the JavaArgs
    registry key for iAS6.0 but still the same problem. So far I can only
    find references to problems running iASAT on Solaris.
    Any help much appreciated. Its got to be something stupid and obvious
    that I've missed.

    I know this forum isnt really the right place to ask this question as
    strictly it isnt a JATO related problem, but I need to sort it before
    starting the upgrade process.
    --- In [email protected], steve.archer@f... wrote:
    Im trying to add a new server to the Admin Tool using File\New Server
    dialog. If I enter the correct info for my server I get a
    java.lang.OutOfMememory exception. The box Im using is a fresh
    install of NT4 Server SP5 with Option Pack, IE5 and Oracle8i. I tried
    turning off the JIT and setting max heap size in the JavaArgs
    registry key for iAS6.0 but still the same problem. So far I can only
    find references to problems running iASAT on Solaris.
    Any help much appreciated. Its got to be something stupid and obvious
    that I've missed.

  • Classnotfound exception when locking account

    Hi All,
    thought I'd post this here. before heading to support.
    I recently noticed that accounts are not getting locked after the number of failed logon attempts has been exceeded. what I am getting is....
    2008-05-06 07:50:55,850 ERROR [XELLERATE.ACCOUNTMANAGEMENT] [ExecuteThread: '13' for queue: 'weblogic.kernel.Default'] - Class/Met
    hod: XellerateLoginModuleImpl/login encounter some problems: com/thortech/xl/scheduler/common/SchedulerUtil
    java.lang.NoClassDefFoundError: com/thortech/xl/scheduler/common/SchedulerUtil
    Has anyone run into this? I think it started after a patch was applied a long time ago.
    Thanx
    Fred

    The problem is located in your opencard.properties file:
    You have to include opencard.opt.emv.mgmt.EMVCardServiceFactory to your list of OpenCard.services.
    My complete opencard.properties is as follows:
    # Card service configuration  #
    OpenCard.services = \
        com.ibm.opencard.factory.MFCCardServiceFactory \
        opencard.opt.util.PassThruCardServiceFactory \
         opencard.opt.emv.mgmt.EMVCardServiceFactory
    # Card terminal configuration #
    OpenCard.terminals = com.ibm.opencard.terminal.pcsc10.Pcsc10CardTerminalFactory
    # Trace configuration         #
    OpenCard.trace = opencard:5

  • Cannot load css files into osgi bundle

    I want to create JavaFX application based on several osgi bundles. I use Felix framework for osgi container. I face the same issue as this post
    Exception logged when using custom css in JavaFX in Felix OSGI
    How I can set globally
    -Dbinary.css=false
    Into the start JavaFX method. I would like at a low level to configure this.

    This should not be any issue with PE7 as it is meant for opening any supported not corrupted image. Can you please re check this issue with you. Make sure you have copied the image successfully and completely from your phone to your machine.
    If again you are facing the issue please share the image your are trying to open.
    Cheers,
    Sam

  • Replication from an OSGI bundle - help

    I am an OSGI newb!
    I create a custom WorkflowProcess that is called from a WorkflowLauncher when a certain node gets created on the Author instance.  The WorkflowProcess needs to replicate the node structure onder this node to the publisher.  
    I am having problems using the Replicator from the WorkflowProcess in the OSGI bundle.  I am not about to instantiate an instance of  com.day.cq.replication.Replicator.  I have tried using the @Reference annotation, but at runtime the replicator is null.  I have seen suggestions of using the Sling on the front end but that is not what I am looking for. 
    So my questions are:
    1.) How do I get an instance of  com.day.cq.replication.Replicator from inside a WorkflowProcess (WorkflowSession)?
    2.) Can I use Sling in the bundle?
    3.) Is there an easier way to do this?
    4.) Can I programmatically connect to the Publish server from my WorkflowSession and create the nodes with jcr?
    Thanks.

    The code to manually trigger replicator would look somewhat like this:
    import javax.jcr.Session;
    import com.day.cq.replication.Replicator;
    import org.apache.sling.jcr.api.SlingRepository;
    @Reference
    private Replicator replicator;
    @Reference
    private SlingRepository repository;
    try{
         Session session = repository.loginAdministrative(null);
         replicator.replicate(session, ReplicationActionType.ACTIVATE, path);
    finally{
         if (session != null){
              session.logout();
              session = null;

  • OSGi bundle JNI load/unload problem

    Hi everybody!!
    One more thread about the topic. I still didn't find a solution. Can anybody help me?
    I have an OSGi bundle that access native methods from a JNI library (for a medical device). I could make my bundle work once, but the second time I tried to access the methods, the dll was still in use I couldn't get data from the methods.
    This is the class I used (I even tried with a custom libloader):
    public class Omron637ITjni {
         /*Native functions from the JNI dll*/
         public native int OmronInit();
         public native int OmronClose();
         public native int OmronFinish();
         public native int OmronOpen(int disp);
         public native int OmronRead(MeasurementData MData, int pos);
         public native void OmronNumRead(DataCount DCount);
         static{
              //Using LibLoader
              /*try {
              LibLoader.loadCommLib("omron637IT");
              catch ( Exception x ) {
              // do what is necessary
                   System.out.println(x);
              //Using System Commander
              try{
                   System.out.println("Charging Library Omron");
                   System.loadLibrary("omron637IT");
              }catch(UnsatisfiedLinkError unsatisfiedlinkerror)
    System.out.println("Error loading library: " + unsatisfiedlinkerror);
    As it seems not to work, I'm trying with Singleton pattern. This is my new class:
    public class Omron637ITjni_Singleton {
              * Native functions from the JNI dll
              public native int OmronInit();
              public native int OmronClose();
              public native int OmronFinish();
              public native int OmronOpen(int disp);
              public native int OmronRead(MeasurementData MData, int pos);
              public native void OmronNumRead(DataCount DCount);
              private static Omron637ITjni_Singleton singleton;
              * Instance accessor following singleton.
              public static Omron637ITjni_Singleton getInstance() {
                   if (singleton == null){
                        System.out.println("Create Object");
                        singleton = new Omron637ITjni_Singleton();
                   else{
                        System.out.println("Object already created; use instance");
                   return singleton;
              * Private constructor to ensure that a <tt>ResourceManager</tt>
              * cannot be constructed from outside this class.
              private Omron637ITjni_Singleton() {     
              static{
                   //Using LibLoader
                   /*try {
                   LibLoader.loadCommLib("omron637IT");
                   catch ( Exception x ) {
                   // do what is necessary
                        System.out.println(x);
                   try {
                        System.out.println("Charging Omron library from Singleton");
                        System.loadLibrary("omron637IT");
                        System.out.println("Library charged");
                   } catch (UnsatisfiedLinkError ule) {
                        System.out.println("Error loading library: " + ule);
    At this very moment, when executing
    Omron637ITjni_Singleton jni = Omron637ITjni_Singleton.getInstance();
    from the Activator, I get from the Knopflerfish console:
    [stdout] omron637ITBPM starting...
    [stdout] Service registered: Omron 637IT Blood Pressure Monitor
    [stdout] Charging Library Omron desde Singleton
    [stdout] Library chatged
    [stdout] Create object
    Then, I call a services provided by the bundle:
    framework call omron637IT.Omron637ITInterface getData
    which calls the following function:
    public void getData() {
              // TODO Auto-generated method stub
              //Omron637ITjni jni = new Omron637ITjni();
              //Singleton
              Omron637ITjni_Singleton jni = Omron637ITjni_Singleton.getInstance();
              try {
                   int res = jni.OmronInit();
                   int ok_open = jni.OmronOpen(res);
                   System.out.println("The attempt of connecting the Omron637IT device ended with code: " + ok_open + " [(0) normal (1) still in process (2) error]");
                   if (ok_open == 0){ //OK
                        DataCount NumData = new DataCount();
                        jni.OmronNumRead(NumData);
                        System.out.println("DATA");
                        System.out.println("----");
                        for (int pos = 0;pos<NumData.nData1;pos++){
                             MeasurementData Data = new MeasurementData();
                             int ok_read = jni.OmronRead(Data,pos);
                             int annyo = Data.cYear + 2000;
                             int i = pos + 1;
                             if (ok_read == 0)
                                  System.out.println("Num: " + i + "; Date-> " + Data.cDay + "/" + Data.cMonth + "/" + annyo + "; Time-> " + Data.cTime + ":" + Data.cMinute + ":" + Data.cSecond + "; Sys-> " + Data.nSys + "; Dia-> " + Data.cDia + "; Pls-> " + Data.cPls);
                        int stop = jni.OmronClose();
                        System.out.println("Close with code " + stop + " Right?");
                        int finish = jni.OmronFinish();
                        System.out.println("Finish with code " + finish + " Right?");
                        System.gc();
                        System.gc();
                   else
                        System.out.println("The process of opening the device ended with error");
              }catch (UnsatisfiedLinkError ule) {
                   System.out.println("BRUTAL ERROR: " + ule);
    [stdout] The objeto already exists
    [stdout] BRUTAL ERROR: java.lang.UnsatisfiedLinkError: OmronInit
    Result: null
    which indicates that this time I'm using the same instance of the singleton class created in the activation process, but that I cannot access the method. ANY HINT??
    I also provide you the JNI dll code (because I add the exporting of the JNI_OnLoad & OnUnload methods:
    .h
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class omron637IT_Omron637ITjni */
    #ifndef Includedomron637IT_Omron637ITjni
    #define Includedomron637IT_Omron637ITjni
    #ifdef __cplusplus
    extern "C" {
    #endif
    * OnLoad & UnLoad
    JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM vm, void reserved);
    JNIEXPORT void JNICALL JNI_OnUnload(JavaVM vm, void reserved);      
    * Class: omron637IT_Omron637ITjni
    * Method: OmronInit
    * Signature: ()I
    JNIEXPORT jint JNICALL Java_omron637IT_Omron637ITjni_OmronInit
    (JNIEnv *, jobject);
    * Class: omron637IT_Omron637ITjni
    * Method: OmronOpen
    * Signature: (I)I
    JNIEXPORT jint JNICALL Java_omron637IT_Omron637ITjni_OmronOpen
    (JNIEnv *, jobject, jint);
    * Class: omron637IT_Omron637ITjni
    * Method: OmronRead
    * Signature: (Lomron637IT/MeasurementData;I)I
    JNIEXPORT jint JNICALL Java_omron637IT_Omron637ITjni_OmronRead
    (JNIEnv *, jobject, jobject, jint);
    * Class: omron637IT_Omron637ITjni
    * Method: OmronNumRead
    * Signature: (Lomron637IT/DataCount;)V
    JNIEXPORT void JNICALL Java_omron637IT_Omron637ITjni_OmronNumRead
    (JNIEnv *, jobject, jobject);
    * Class: omron637IT_Omron637ITjni
    * Method: OmronClose
    * Signature: ()I
    JNIEXPORT jint JNICALL Java_omron637IT_Omron637ITjni_OmronClose
    (JNIEnv *, jobject);
    * Class: omron637IT_Omron637ITjni
    * Method: OmronFinish
    * Signature: ()I
    JNIEXPORT jint JNICALL Java_omron637IT_Omron637ITjni_OmronFinish
    (JNIEnv *, jobject);
    #ifdef __cplusplus
    #endif
    #endif
    and part of the code (.cpp):
    JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM vm, void reserved)
         return JNI_VERSION_1_4;
    JNIEXPORT void JNICALL JNI_OnUnload(JavaVM vm, void reserved)
    JNIEXPORT jint JNICALL Java_omron637IT_Omron637ITjni_OmronInit
    (JNIEnv *env, jobject obj)
         iNumberOflist = DEVLISTMAX;
         iSpeed = USF_SPEED4800;
         iStopBit = USF_STOP2;
         iProduct = USF_BPM;
         ret = USF_Search(hDlg, iSpeed, iStopBit, iProduct, DevList, &iNumberOflist);
         return iNumberOflist;
    Can anybody tell me what I'm doing wrong???. This really drives me crazy
    BR & very thanks in advance for any input.

    This is a known bug. Check out http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4712793

  • Problem using WebRowSetImpl within OSGI bundle.

    Hallo to everyone,
    I used to use standard WebRowSetImpl in my Java programs to pass data between application layers without problem. Now, I'm facing an issue using WebRowSetImpl in an OSGI module: I get a ClassNotFound Exception while trying to instantiate it. That sounds really strange because if I just run my bundle using java interpreter (as if it were a normal executable jar), I get no errors.
    May you help me, please ?
    Thanks you in advance.

    Use the brace notation."#{usr['user.user_name.label']}"

  • WebLogic 12c and OSGi bundles ClassCastException error

    When I deploy an OSGi bundle to WebLogic 12c there are no errors. However, when I try and access my application I get the following error:
    java.lang.ClassCastException: com.sun.faces.taglib.jsf_core.ViewTag cannot be cast to javax.servlet.jsp.tagext.Tag
    I suspect that WebLogic 12c is loading different versions of the JSF than what I have in my OSGi bundle but I am unable to confirm (I tried to deploy the wls-cat tool but I continue to get 503 errors even after a server restart).
    My bundle currently uses JSF 1.1. After reading various forum posts, I have done the following but have not had any success:
    1. Followed the steps in Re: jsf 1.2 on weblogic 12c (i.e. deploying the jsf-1.2.war, modified my weblogic.xml accordingly in my war and then deployed, etc)
    2. Checked all of my manifest entries (which were correct) and even tried to set the required-bundles to my own JSF in the WEB-INF/lib directories
    Are there any instructions/settings for having OSGi bundles work within WebLogic 12c? Note that my OSGi bundle works correctly in WebLogic 11.
    Side question..I read that even though WebLogic 12c ships JSF 1.2 for backwards compatibility, it is deprecated for this release (as per http://docs.oracle.com/cd/E24329_01/web.1211/e21049/configurejsfandjtsl.htm#i163099). Does that mean that even if I get my bundle deployed/working that if there are other errors/issues in the future then I would not be supported? I am just trying to confirm so that I can make a decision about upgrading my JSF.
    Thanks :)

    gday -
    WLS 12c (12.1.1) doesn't recognize OSGi bundles -- if you have a library you wish to use with your web application, then it needs to conform the packaging requirements for the Java EE deployment model you are using.
    If you are getting conflicts with a WLS supplied library (JSF in this case it appears) then you need to specify a filtering classloader definition in a weblogic deployment descriptor so that the web/app classloader is instructed to ignore a specified set of packages/resources from the parent loaders and load them locally.
    By way of an example, assume you have a web application in which you are bundling JSF 1.2 and you want to use this in place of the JSF 2.1 API/impl that is provided by WLS 12.1.1. In that case, you'd create a WEB-INF/weblogic.xml file and provide the following settings within in.
    <weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
            <container-descriptor>
                        <prefer-application-packages>
                            <package-name>javax.faces.*</package-name>
                            <package-name>com.sun.faces.*</package-name>
                            <package-name>com.bea.faces.*</package-name>
                        </prefer-application-packages>
                        <prefer-application-resources>
                            <resource-name>javax.faces.*</resource-name>
                            <resource-name>com.sun.faces.*</resource-name>
                            <resource-name>com.bea.faces.*</resource-name>
                            <resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</resource-name>
                        </prefer-application-resources>
            </container-descriptor>
    </weblogic-web-app>Deploying that with your application, in which you have supplied the JSF 1.2 API and implementation jars in the standard WEB-INF/lib directory will direct WLS to use those locally supplied libraries instead of its JSF API/implementation.
    Hope that helps.
    -steve-

  • JMS for Osgi-Bundle Communication

    Hey,
    I want to use jms for commuication between OSGi-Bundles. I have implementet the bundles so far, but I get the following error message:
    javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
         at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
         at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
         at javax.naming.InitialContext.init(Unknown Source)
         at javax.naming.InitialContext.<init>(Unknown Source)
         at jmsQueueStubBundlePackage.Activator.start(Activator.java:60)
         at org.knopflerfish.framework.BundleImpl$1.run(BundleImpl.java:281)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.knopflerfish.framework.BundleImpl.start(BundleImpl.java:255)
         at org.knopflerfish.framework.Framework.startBundle(Framework.java:453)
         at org.knopflerfish.framework.Main.handleArgs(Main.java:305)
         at org.knopflerfish.framework.Main.main(Main.java:190)
    Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
         ... 11 more
    Has anybody an idea, how I can fix this
    Chris

    Hello there,
    Many thanks for the reply,
    Well just clarify i may be wrong, i said i need 100 queues is because
    we have hunderds of brokers office where we can place orders
    our requirement is as below.
    a) One client can place multiple orders with MULTIPLE brokers simultaneously. i.e choose different brokers and do a long and short
    at the same time
    b) Now based on the brokers chosen by the client orders must be
    routed to multiple broker's office
    c) same way trade updates / trade confirmation's need to be sent
    to the client , please note that MULTIPLE brokers will be sending
    the orders to the SINGLE client
    d) Now i need a reliable channel to do this, both of the actions (point
    b and c ) is async . Unless i create a seperate queue for each of
    the brokers how is it possible to reliably (i mean specific broker / client) to communicate with each other
    e) It is a complex scenario , please do let me know if you can get the point , if not please do mention i will try to simplify my questions
    Would greatly appreciate if someone can help to scrutinize on the architecture , more importantly if JMS is appropriate here.
    Many thanks,

  • Are JUnit jar and spring OSGi bundle in OEPE compatible with each other?

    The OEPE 11g comes with org.junit4_4.3.1 and Spring OSGi Bundle (org.springframework.bundle.spring_2.5.6.v200808081800.jar). However, these two seem to be incompatible. For example, @RunWith(SpringJUnit4ClassRunner.class) in a test case gives error because org.junit.internal.runners.JUnit4ClassRunner is not in the junit.jar.

    Hello,
    There could be a compatibility issue.
    I mentioned in the other thread that downloading a more recent JUnit JAR and using it in your project might help us diagnose the issue further.
    Let us know the results of that test.
    Regards,
    Andrew

  • Coherence 3.5  as OSGi bundle

    Hi,
    We are starting out on an OSGi project which will use Coherence 3.5 as a data grid for storing and manipulating application data. I see that Coherence (as a separate product) is getting released as a Jar and not as an OSGi bundle. When I looked on the web, I see that Coherence (3.4) is getting packaged along with other Oracle products (CEP 10.3) as OSGi bundle (http://blogs.oracle.com/CEP/2008/10/oracle_complex_event_processin_1.html) and Oracle Fusion Middleware 11g.
    Let us know if we can expect to see Coherence getting released as an OSGi bundle in the near future.
    Till that time, Is there any guidance/recommendation on:
    1) Running Coherence in OSGi environment
    2) Accessing Coherence from an OSGi client application
    Thanks,
    Prakash

    1. Generally, it's easiest if there is membership in only one Coherence cluster per OSGi container. In other words, one member of one cluster per container.
    2. (From Stephen Felts, note that this was pre-3.5) Coherence currently uses the context classloader of the thread to find the default configuration file (coherence-cache-config.xml) and the JMX configuration (reports/report-group.xml). This is generally not the correct thing when running in OSGi. Applications will need to reset the context classloader before getting the class.
    ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
    ClassLoader newLoader = com.tangosol.net.CacheFactory.class.getClassLoader();
    Thread.currentThread().setContextClassLoader(newLoader);
    CacheFactory.getCache(cacheName);  //Start coherence cache instance
    Thread.currentThread().setContextClassLoader(oldLoader);"
    {code}
    3. (From Hal Hildebrand) There are issues that can come up specifically with respect to serialization with complex dependencies across bundles. Basically, OSGi allows classes to be hidden through the modules, so you have to be really careful as to the class loader you use for the cache.  Here's a simple scenario showing the issue: Let's say that we're using the class loader from Bundle A.  Bundle A imports the interface FOO from Bundle B.  Bundle A uses an implementation of FOO, FooImpl, from Bundle C.  However, Bundle C either doesn't import FooImpl (i.e. it's a private class) or Bundle A doesn't import the package from Bundle C. So, if you serialize FooImpl into the cache, what happen in the above scenario is that the cache will not be able to deserialize FooImpl using Bundle A's class loader.
    4. There are various issues around the use of static fields in Coherence. These are very "non OSGI like". It's generally an issue when you are trying to create a Coherence bundle and decide what APIs to expose. Some of the "builder" work that went into 3.5 was designed to help rectify this and make Coherence easier to use in OSGi.
    5. (From Jeff Trent, in lieu of having a Coherence bundle as part of the Coherence distribution) Bundlizing Coherence jar(s) is a prerequisite for using Coherence w/ OSGi.  For this, you can essentially lift the bundles out of (e.g.) CEP.  There are tools like BND (http://www.aqute.biz/Code/Bnd) integrated into Maven that really make this quite simple to do.
    The summary I have so far is that using Coherence in OSGi is easy for easy stuff today, but there are a number of things that we're developing to make the more complex use cases simple in the future.
    Peace,
    Cameron Purdy | Oracle Coherence
    http://coherence.oracle.com/                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • OSGI bundle creation using third party jar files

    Hi,
    I have a requirement to integrate our CQ5.5 based application with a third party. As part of this, I have to use some jar files. After lot of digging, I realised that the way to use external jar files is to create an OSGI bundle wrapping these jar files.
    So, I tried to do the same, but when I see the service details in system/console, I see errors. Can someone please suggest what could have gone wrong?
    I have to use 3 jar files. So, I placed them in lib folder as shown in the screenshot below.
    Ibuilt the bundle using .bnd file. It generated a jar file in install folder and I am able to to see its details in system/console/bundles. When I try to view details of the OSGI bundle that is installed, I see errors as follows:

    Here is my bnd file with all directives:
    Export-Package: *
    Import-Package: *
    Private-Package: *
    # Include-Resource:
    Bundle-Name: External Jar OSGI
    Bundle-Description: This OSGI bundle contains external jar file
    Bundle-SymbolicName: com.self.learning.externaljarosgi
    Bundle-Version: 1.0.0-SNAPSHOT
    Bundle-Activator: com.self.learning.osgi.oauth.Activator
    And here is what is shown in systems/console/bundle:
    Imported Packagesjavax.crypto from org.apache.felix.framework (0)
    javax.crypto.spec from org.apache.felix.framework (0)
    javax.servlet from cqse-httpservice (21)
    javax.servlet.http from cqse-httpservice (21)
    net.oauth -- Cannot be resolved
    net.oauth.client -- Cannot be resolved
    net.oauth.client.httpclient3 -- Cannot be resolved
    net.oauth.client.httpclient4 -- Cannot be resolved
    net.oauth.server -- Cannot be resolved
    net.oauth.signature -- Cannot be resolved
    org.apache.commons.codec.binary from org.apache.commons.codec (46)
    org.apache.commons.httpclient from com.day.commons.osgi.wrapper.commons-httpclient (77)
    org.apache.commons.httpclient.methods from com.day.commons.osgi.wrapper.commons-httpclient (77)
    org.apache.http -- Cannot be resolved
    org.apache.http.client -- Cannot be resolved
    org.apache.http.client.methods -- Cannot be resolved
    org.apache.http.entity -- Cannot be resolved
    org.apache.http.impl.client -- Cannot be resolved
    org.apache.http.params -- Cannot be resolved
    org.apache.http.util -- Cannot be resolved
    org.osgi.framework from org.apache.felix.framework (0)
    org.slf4j from slf4j.api (11)
    Regarding Export-Package, I know the function, class and its package I need to use. Would it be fine if I just export that package instead of using '*'? In such case, if this has dependency on some function in one of the 4 jar files I need to use, how does it get resolved? Do I need to Export those packages as well?

  • What is the best practise to provide a text file for a Java class in a OSGi bundle in CQ?

    This is probably a very basic question so please bear with me.
    What is the best way to provide a .txt file to be read by a Java class in a OSGi bundle in CQ 5.5?
    I have been able to read a file called "test.txt" that I put in a structure like this /src/resources/<any-sub-folder>/test.txt  from my java class  at /src/main/java/com/test/mytest/Test.java using the bundle's getResource and getEntry calls but I was not able to use the context.getDataFile. How is this getDataFile method call to be used?
    And what if I want to read the file located in another bundle, is it possible? or can I add the file to some repository and then access it - but I am not clear how to do this.
    And I would also like to know what is the best practise if I need to provide a large  data set in a flat file to be read by a Java class in CQ5.
    Please provide detailed steps or point me to a how to guide or other helpful resources as I am a novice.
    Thank you in advance for your time and help.
    VS

    As you can read in the OSGi Core specification (section 4.5.2), the getDataFile() method is to read/write a file in the bundle's private persistent area. It cannot be used to read files contained in the bundle. The issue Sham mentions refers to a version of Felix which is not used in CQ.
    The methods you mentioned (getResource and getEntry) are appropriate for reading files contained in a bundle.
    Reading a file from the repository is done using the JCR API. You can see a blueprint for how to do this by looking at the readFile method in http://svn.apache.org/repos/asf/jackrabbit/tags/2.4.0/jackrabbit-jcr-commons/src/main/java /org/apache/jackrabbit/commons/JcrUtils.java. Unfortunately, this method is not currently usable as it was declared incorrectly (should be a static method, but is an instance method).
    Regards,
    Justin

Maybe you are looking for