Monday, 3 July 2017

Not able to inherit page properties from parent page

Problem:
I have created a live copy from Geometrixx site. I have pointed cq:template and sling:resourceType of parent page to my custom template and page component. I have created a new child page, when I checked the page properties of child page I don't see inheritance (lock symbol) on my child page properties dialog.

-Sample/
     -en/
          -childpage/

Solution:
I am able to see the lock symbol on child page properties dialog after adding the mixin "cq:LiveRelationship".

Saturday, 1 July 2017

AEM Page Properties Touch UI Dialog conversion issue

When tried to create a touch dialog of page properties from classic ui we may may get duplicate widgets on the newly created touch dialog from dialog conversion tool. See how to create touch dialog from dialog conversion tool.

To avoid above issue you can use granite/ui/components/foundation/include resource type in the touch ui for including granite UI components in the current component dialogs. Take a look at the following example in crxde - /libs/wcm/foundation/components/page/cq:dialog/content/items/tabs/items/basic

Failed to execute goal org.apache.felix:maven-scr-plugin

Issue:
I have created maven archetype 10 project for AEM 6.1 and jdk 1.8. When I ran mvn clean install I ran in to below errors.

1) When maven-scr-plugin (1.11.0) and org.apache.felix.scr.annotations (1.9.0)
[ERROR] Failed to execute goal org.apache.felix:maven-scr-plugin:1.11.0:scr (generate-scr-descriptor) on project digital-spearhead-core: Execution generate-scr-descriptor of goal org.apache.felix:maven-scr-plugin:1.11.0:scr failed. IllegalArgumentException -> [Help 1]

2) When maven-scr-plugin (1.12.0) and org.apache.felix.scr.annotations (1.9.0)
[ERROR] Failed to execute goal org.apache.felix:maven-scr-plugin:1.12.0:scr (generate-scr-descriptor) on project aem-sample-core: SCR Descriptor parsing had failures (see log) -> [Help 1]

Solution:
Use correct maven-scr-plugin and org.apache.felix.scr.annotations versions.  I have used maven-scr-plugin (1.20.0) and org.apache.felix.scr.annotations (1.9.0), now build is success.


Tuesday, 27 June 2017

AEM Components not loading in touch ui

I am facing below issues when working on touch UI
  1. I don't see the components on the left rail though I have added the components from design mode. I am dragging and dropping the component from classic ui. I found in forum that there is cache issue in touch ui. Cannot find my components in touch ui sideline. I could see this error on page load /libs/wcm/core/content/components.1498484847911.html?_=1498484940719 500 (Server Error)
  2. When I tried to author the touch ui dialog and click on save, I don't see page is refreshed and authoring changes are not reflected. I see below JS error in browser console.
Error 1:

Error 2:
Uncaught TypeError: Cannot read property 'componentConfig' of undefined
    at f (editor.min.js:4355)
    at Object.<anonymous> (editor.min.js:4578)
    at i (jquery.min.js:784)
    at Object.fireWith [as resolveWith] (jquery.min.js:820)
    at cf (jquery.min.js:2421)
    at XMLHttpRequest.i (jquery.min.js:2519)

Error 3:

Uncaught Error: Components could not be loaded.

Error 4:
GET https://localhost:5433/libs/wcm/core/content/components.1537887896814.html 500 (Server Error)

Root Cause:
when I hit url [1], am getting below exception.
org.apache.sling.api.request.TooManyCallsException:
/libs/cq/gui/components/authoring/componentbrowser/component/component.jsp
It seems that total number of components in AEM instance is more than the default number i.e 1500 (AEM 6.1) or 1000 (AEM 6.2). So the new components are not displayed in side rail and not able to edit the existing components.

Solution: 
We need to increase the "sling.max.calls" property value of "Apache Sling Main Servlet" OSGI config. My total component count was 1602, I have increased to 2000 and solved above 2 issues

Wednesday, 21 June 2017

Bundle is not uploading after maven build

Check first if bundle is installed in /system/console/bundles. check if jar files is present in /apps/app-name/install folder. If bundle is not present then change the filter.xml as shown below.

Under the path definition /apps/<appname>, define the following include and exclude rules
  • include pattern="/apps/<appname>(/.*)?"
  • exclude pattern="/apps/<appname>/install(/.*)?"
Note: these rules ensure that your bundle will be reinstalled upon every reinstall of the package.
Example:
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
    <filter root="/apps/app-name">
<include pattern="/apps/app-name(/.*)?" />
<exclude pattern="/apps/app-name/install(/.*)?" />
</filter>
<filter root="/etc/designs/app-name">
</filter>
<filter root="/apps/sling/servlet/errorhandler/500.jsp" />
</workspaceFilter>

Tuesday, 20 June 2017

Create openssl certificate with SHA256 signature

1) Download OpenSSL  for windows 
2) Add  Bin  path to system path also copy openssl.conf file to c:/OpenSSL/  
3) run OpenSSL.exe file  
4) Run following command to run to create SHA256 with RSA encryption certificate 
A.      Generate SSL key file 
genrsa -out key_name.key 2048  ----  here 2048 is bit length for key 
** Please note that both these examples will not add a password to the key file. To do that you will need to add -des3 to the command. 
B.      Create a Certificate Signing Request (CSR) 
req -out Cert_file_name.csr -key key_name.key -new –sha256 
 i) You can check that your Certificate Signing Request (CSR) has the correct signature by running the following. 
req -in Cert_file_name.csr -noout –text 
It should display the following if the signature is correct. 
Signature Algorithm: sha256WithRSAEncryption