Category: Uncategorized

Profile based Deployment using Maven In AEM (CQ5)

This presume Maven skeleton has been already created.

  • UI
  • Bundle
  • root pom.xml files.

Update/create  this entries specific to your environment in root pom.xml

Step 1.

<!– Development/Integration Server properties –>
<!– Author –>
<!– Publish –>

Step2 .

Create below profile entry in same pom.xml or where ever you want.


and finally run this command from command line or any CI Server profile.

mvn clean install -P dev-int


AEM 5.6.1 with Dispacther on IIS 7 Content not displayed

I came across a very unique problem today during one of my production deployment.

IIS with dispatcher on Windows Server and AEM 5.6.1

All Set up and networks good, however when hitting some CQ5 page on web server URL, not showing correct content/synced up content.

  1. Dispatcher.any, Logs, publish agent , Flush agent, accessed  URL directly on browser.
  2. then finally realized DefaultAppPool setting is needed to be increased for this problem to be resolved and it worked.

AEM/CQ5 On/Off Time vs Activate Later On Content and Understanding

Activate later and On-Off Time of Content are two different behavior in CQ5/AEM 6. When you apply activate later on any content , that content gets activated at given time and exist in publish instance until it is deactivated or deleted.
On-Off time is little different . It adds additional attribute as properties to the content but it does not activate content. To make it available on publish, it has to be activated. The On and Off Time gets applied on publish site. When Off time matches or greater than current time , CQ5 OSGI Services consider that content as dead and if you try to access using HTTP, CQ5 would return 404 error.

However that content resides in JCR opposite to deactivate feature that deletes content from Publish JCR.That’s the catch and generally Developer thinks  that off time would make content disappear but that’s not the fact.

Off time related content can be checked in CQ5 Component like this.

<% currentPage.isValid()%> or You can use ResourceUtil Class that will return false because Off time has been applied and even that exist in Publish JCR would be considered as dead content.


CQ5 Query Builder API, Debugging and troubleshooting

Helpful for CQ5 developers who want to know How Felix works in terms of saving Configuration, OSGI Properties, How query  builder API works, Production vs Lower environment etc.

ConfigurationAdmin Through OSGI Component Service

One of the fundamental requirement to create a OSGi service to read OSGI config to read  configurable properties .

1. Create Osgi Config Node under your apps  and read that through Service like this

2. Sample OSGI Component reads default PID.

import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class AbcOsgiConfigService {
    private final Logger LOGGER = LoggerFactory
    ConfigurationAdmin configurationAdmin;
    public void activate(ComponentContext ctx){” activating “);
        BundleContext bundleCtx=ctx.getBundleContext();
        ServiceReference ref = bundleCtx.getServiceReference(ConfigurationAdmin.class.getName());
        if (ref != null) {
            configurationAdmin = (ConfigurationAdmin) bundleCtx.getService(ref);
            Configuration config;
            try {
              config = configurationAdmin.getConfiguration(“”);
    ” Got the Config”+config.getProperties().get(“”).toString());
            } catch (IOException e) {
                LOGGER.error(“Error trying to look up datasource configuration”, e);


Spring WS WebServiceTransportException: Not Found [404]

The main reason for that error to be thrown is endpoint is not correct when your Web Service client is making a call to service based on SOAP.

Error log.

How to fix it.

1. if you are making a call from java class and passing Default Web Service URI  of End Point , please check URL that’s incorrect that’s why you get 404 error.

2. if you passing from application context.xml. correct there.

Code snippet.


final SoapActionCallback soapActionCallback = new SoapActionCallback(“;);

<beans:bean id=”weatherServiceTemplate” class=””>
        <beans:constructor-arg ref=”messageFactory” />
        <beans:property name=”marshaller” ref=”weatherServiceMarshaller”></beans:property>
        <beans:property name=”unmarshaller” ref=”weatherServiceMarshaller”></beans:property>        
        <beans:property name=”defaultUri” value=”; />







Custom Rewriter Transformer to rewrite any HTML Output generated by Sling Rendering Process

Problem Context.  I came across a unique business problem and found such solution is not available on the web so writing this blog might help others. Sling Link Rewriting based on sling: pipeline is mainly focused on how to rewrite any anchor link inside or … Continue reading Custom Rewriter Transformer to rewrite any HTML Output generated by Sling Rendering Process

MySQL Setup, login first time as root and troublshooting

Presuming you are using Redhat or CentOS and yam command is available .

  1.  yum install mysql-server
  2. /etc/init.d/mysqld start
  3. mysqladmin -u root password ‘{password}’, if it gives issue try to reset default password in this manner
  4. /etc/init.d/mysqld stop
    mysqld_safe –skip-grant-tables &
    mysql -u root
    mysql> use mysql;
    mysql> update user set password=PASSWORD(“newrootpassword”) where User=’root’;
    mysql> flush privileges;
    mysql> quit
    /etc/init.d/mysqld stop
    /etc/init.d/mysqld start