Wednesday, February 21, 2018

Caused by: java.lang.NoClassDefFoundError: javax/management/InstanceAlreadyExistsException while connecting to Oracle Database from OSGI - Adobe Experience Manager(AEM)

Caused by: java.lang.NoClassDefFoundError: javax/management/InstanceAlreadyExistsException while connecting to Oracle Database from OSGI - Adobe Experience Manager(AEM)

I was getting the below exception while connecting to the Oracle 11g database using ojbdc6.jar from OSGI in Adobe Experience Manager(AEM)

20.02.2018 15:43:39.259 *INFO* [CM Event Dispatcher (Fire ConfigurationEvent:] day.commons.datasource.jdbcpool Configuring and activating data source with name=SampleOracleDS
20.02.2018 15:43:39.260 *ERROR* [CM Event Dispatcher (Fire ConfigurationEvent:] day.commons.datasource.jdbcpool [] The activate method has thrown an exception (java.lang.IllegalArgumentException: Cannot initialize driver 'oracle.jdbc.driver.OracleDriver')
java.lang.IllegalArgumentException: Cannot initialize driver 'oracle.jdbc.driver.OracleDriver'
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(
at org.apache.felix.scr.impl.helper.BaseMethod.access$500(
at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(
at org.apache.felix.scr.impl.helper.BaseMethod.invoke(
at org.apache.felix.scr.impl.helper.ActivateMethod.invoke(
at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(
at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(
at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(
at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(
at org.apache.felix.framework.ServiceRegistrationImpl.getService(
at org.apache.felix.framework.ServiceRegistry.getService(
at org.apache.felix.framework.Felix.getService(
at org.apache.felix.framework.BundleContextImpl.getService(
at org.apache.felix.scr.impl.manager.SingleRefPair.getServiceObject(
at org.apache.felix.scr.impl.helper.BindMethod.getServiceObject(
at org.apache.felix.scr.impl.manager.DependencyManager.getServiceObject(
at org.apache.felix.scr.impl.manager.DependencyManager.invokeUnbindMethod(
at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeUnbindMethod(
at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.removedService(
at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.removedService(
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerRemoved(
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerRemoved(
at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.untrack(
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(
at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(
at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(
at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(
at org.apache.felix.framework.Felix.fireServiceEvent(
at org.apache.felix.framework.Felix.access$000(
at org.apache.felix.framework.Felix$1.serviceChanged(
at org.apache.felix.framework.ServiceRegistry.unregisterService(
at org.apache.felix.framework.ServiceRegistrationImpl.unregister(
at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.unregister(
at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.unregister(
at org.apache.felix.scr.impl.manager.RegistrationManager.changeRegistration(
at org.apache.felix.scr.impl.manager.AbstractComponentManager.unregisterService(
at org.apache.felix.scr.impl.manager.AbstractComponentManager.doDeactivate(
at org.apache.felix.scr.impl.manager.AbstractComponentManager.deactivateInternal(
at org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(
at org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(
at org.apache.felix.scr.impl.config.ConfigurableComponentHolder.configurationUpdated(
at org.apache.felix.scr.impl.config.ConfigurationSupport.configurationEvent(
at Source)
Caused by: java.lang.NoClassDefFoundError: javax/management/InstanceAlreadyExistsException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
... 54 common frames omitted
Caused by: java.lang.ClassNotFoundException: not found by [446]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(
at org.apache.felix.framework.BundleWiringImpl.access$400(
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(Unknown Source)
... 59 common frames omitted

Based on the analysis the classes required by the ojdbc.jar is missing in the generated bundle.

Steps to fix the issue -

Refer the following post for complete steps to integrate Adobe Experience Manager(AEM) with Oracle Database -

Add the below Import-Package in META-INF\MANIFEST.MF file

Import-Package: javax.sql, javax.naming,, org.ietf.jgss


  • Generate the bundle by adding the above configuration(Export --> Deployable plug-ins and fragments)
  • Delete the bundle if already exist in the server
  • Install the updated bundle
  • Restart the server
  • Test the integration

How to extend the OOB Adobe Experience Manager(AEM) Hybris connector

How to extend the OOB Adobe Experience Manager(AEM) Hybris connector

This video explains the details on extending the OOB Adobe Experience Manager(AEM) Hybris connector with custom functionalities

Saturday, February 17, 2018

Approach to implement content preview environment in Adobe Experience Manager(AEM)

Approach to implement content preview environment in Adobe Experience Manager(AEM)

By default Adobe Experience Manager(AEM) not provides the preview instance to preview the content before publishing to live environment but most of the cases preview is required before publishing the content to live environment.

This post explain the approach to preview and approve the content before publishing to live environment.

The below diagram explains the preview flow


  • Author creates the content in production author and start the workflow
  • Workflow sends the content to Stage author and Publishers
  • Workflow assign the task to approver group and send the notification email
  • Approver reviews the content in stage environment and approve or reject the content (workflow)t - provides the detailed information for rejection
  • if the content is approved 
    • Workflow sends the approved content to production publishers.
  • If the content is rejected
    • Workflow assign the task to author and sends the notification
    • Author review the details and completes the workflow
    • Start the process again by correcting the content

Define Replication process step with ECMA script:

Create ecma file replicate.ecma under /etc/workflow/scripts/<<application>>  e.g. /etc/workflow/scripts/blog - This ecma script helps to replicate the content to stage environments

var workflowData = workItem.getWorkflowData();
var path = workflowData.getPayload().toString();
var session = workflowSession.getSession();

var replicator = sling.getService(;
var options = new;

for(var i=0;i<args.length;i++) {
    var agent= args[i];
    var filter = new;
    try {
        replicator.replicate(session,, path, options);
} catch(e) {
    log.error("Cannot replicate page : " + path +"on publisher. (agentId: " + agent + "): " + e);


Saturday, January 27, 2018

How to integrate Adobe Experience Manager(AEM) and SAP Hybris through OOB connector

How to integrate Adobe Experience Manager(AEM) and SAP Hybris through OOB connector

This post explains the detailed steps for AEM and Hybris integration through OOB connector. AEM comes with default Hybris connector and sample demo site(should be downloaded via package manager), the steps covered in the post is for integrating AEM 6.3 with Hybris 6.1 but the same steps works for other AEM and Hybris versions with minimal changes.

AEM Configuration:

Install JDK 8
Install AEM 6.3 server
Install, and packages from package share (I am considering geo-metrixx for demo, we.retail should be the recommended one in AEM 6.3)


Change the Hybris server version in "Day CQ Commerce Hybris Configuration", ignore to default value if the specified version is not listed.


Change the Hybris OAuth endpoint in "Hybris OAuth Handler" based on the Hybris version, /authorizationserver/oauth/token for Hybirs 6 and later and /rest/oauth/token for earlier Hybris versions   - This step can be ignored for AEM 6.3 as the connectes defaults the values based on the Hybris version selected in the previous step.


If the OAuth URL is not configured with correct value then the below exception will be displayed in error log

com.adobe.cq.commerce.hybris.impl.OAuthHandler Server did not respond with 2xx -> authentication failed.

Saturday, January 20, 2018

Re-Fetching Flush Agent in Adobe Experience Manager(AEM)

Re-Fetching Flush Agent in Adobe Experience Manager(AEM)

This video explains the details on Re-Fetching Flush agent on Adobe Experience Manager(AEM).