Saturday 13 May 2017

AEM - Salesforce lightning component - Access-Control-Allow-Origin

When I try to access salesforce lightning components in AEM, I was not able to access the lightning script from AEM server, I got below error in browser console.


XMLHttpRequest cannot load 
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' 
header is present on the requested resource. Origin 'https://localhost:5544' is therefore not allowed access.


We need to whitelist the origin i.e. our aem server in salesforce. 
  • Goto site, click on Setup -> search for CORS
  • Goto CORS console, give the AEM server url pattern, in my case it is https://localhost:5544

Tuesday 2 May 2017

Create AEM porject structure using Lazybones

Lazybones is a command line tool to create AEM project structure. Adobe is recommending its customers to create AEM project structure using Lazybones instead of traditional Maven archetype 10. As when we create a aem project using Maven archetype it is not easy to customize, it provides lots of sample content and packages like test, launcher. Which might not be required for your project, on contrary lazybones bones is very interactive , flexible and easy to customize according to your project need. Adobe consulting Services (ACS) provides a aem multi module template using which you can create AEM projects, which includes lot of default config options and also provides an option to include the ACS commons package as a sub package.
The aim of this tutorial is to learn what is lazybones and how we can use it to create an aem skeleton project structure, as Adobe consulting Services (ACS) has updated the template version and provided the support for AEM 6.3 also i am going to create project structure for AEM 6.3, for learning i am using windows machine so we are going to install lazybones on windows, but you can install it on linux and other operating systems also.
Lazybones Overview:- Lazybones is a command line tool and is build in two parts. First lazybones command line tool and second project templates. This command line tool allows you to create a new project structure for any framework or library for which the tool has a template. Currently ACS has contributed one template for creating AEM multi module project, which we are going to use in this tutorial. You can also contribute templates by sending pull requests to this GitHub project or publishing the packages to the relevant Bintray repository.