Quantcast
Channel: AEM Guide
Viewing all 162 articles
Browse latest View live

Create openssl certificate with SHA256 signature

$
0
0
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 

Bundle is not uploading after maven build

$
0
0
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>

Cannot read property 'componentConfig' of undefined

$
0
0
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)

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

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

$
0
0
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.


AEM Page Properties Touch UI Dialog conversion issue

$
0
0
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

Not able to inherit page properties from parent page

$
0
0
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".

Display number in different number patterns

$
0
0
You can use the java.text.DecimalFormat class to control the display of leading and trailing zeros, prefixes and suffixes, grouping (thousands) separators, and the decimal separator. DecimalFormat offers a great deal of flexibility in the formatting of numbers, but it can make your code more complex.
The example that follows creates a DecimalFormat object, myFormatter, by passing a pattern string to the DecimalFormat constructor. The format() method, which DecimalFormat inherits from NumberFormat, is then invoked by myFormatter—it accepts a double value as an argument and returns the formatted number in a string:
Here is a sample program that illustrates the use of DecimalFormat:
import java.text.*;

publicclassDecimalFormatDemo {

staticpublicvoid customFormat(String pattern, double value ) {
DecimalFormat myFormatter
=new DecimalFormat(pattern);
String output = myFormatter.format(value);
System.out.println(value+"===>"+ pattern +"===>"+ output);
   }

staticpublicvoid main(String[] args) {

customFormat("###,###.###", 123456.789);
customFormat("###.##", 123456.789);
customFormat("000000.000", 123.78);
customFormat("$###,###.###", 12345.67);
}
}

The output is:
123456.789 ===> ###,###.### ===> 123,456.789
123456.789 ===> ###.## ===> 123456.79
123.78 ===> 000000.000 ===> 000123.780
12345.67 ===> $###,###.### ===> $12,345.67

Reference:

Display number in different number patterns with locale

$
0
0
Sample code to display numbers in different pattern with locale like en_US
package com.kishore.samples;

import java.util.*;
import java.text.*;

publicclassDecimalFormatDemo {

staticpublicvoid customFormat(String pattern, double value ) {
DecimalFormat myFormatter =new DecimalFormat(pattern);
String output = myFormatter.format(value);
System.out.println(value+" ===> "+ pattern +" ===> "+ output);
}

staticpublicvoid localizedFormat(String pattern, double value,
Locale loc ) {
NumberFormat nf = NumberFormat.getNumberInstance(loc);
DecimalFormat df = (DecimalFormat)nf;
df.applyPattern(pattern);
String output = df.format(value);
System.out.println(pattern +" ===> "+ output +" ===> "+ loc.toString());
}

staticpublicvoid main(String[] args) {
System.out.println("Number formats without Locale");
customFormat("###,###.###", 123456.789);
customFormat("###.##", 123456.789);
customFormat("000000.000", 123.78);
customFormat("$###,###.###", 12345.67);
customFormat("\u00a5###,###.###", 12345.67);

Locale currentLocale =new Locale("en", "US");

DecimalFormatSymbols unusualSymbols =
new DecimalFormatSymbols(currentLocale);
unusualSymbols.setDecimalSeparator('|');
unusualSymbols.setGroupingSeparator('^');
String strange ="#,##0.###";
DecimalFormat weirdFormatter =new DecimalFormat(strange, unusualSymbols);
weirdFormatter.setGroupingSize(4);
String bizarre = weirdFormatter.format(12345.678);
System.out.println(bizarre);

Locale[] locales = {
new Locale("en", "US"),
new Locale("de", "DE"),
new Locale("fr", "FR")
};
System.out.println("Number formats with Locale");
for (int i =0; i < locales.length; i++) {
localizedFormat("###,###.###", 123456.789, locales[i]);
}

}
}

Output:

Number formats without Locale
123456.789 ===> ###,###.### ===> 123,456.789
123456.789 ===> ###.## ===> 123456.79
123.78 ===> 000000.000 ===> 000123.780
12345.67 ===> $###,###.### ===> $12,345.67
12345.67 ===> ¥###,###.### ===> ¥12,345.67
1^2345|678
Number formats with Locale
###,###.### ===> 123,456.789 ===> en_US
###,###.### ===> 123.456,789 ===> de_DE
###,###.### ===> 123 456,789 ===> fr_FR

Reference:
https://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html

Format currency in Java

$
0
0
Sample code to format currency in java
package com.kishore.samples;

import java.text.NumberFormat;
import java.util.Locale;

/**
* * How to format Number to different currency in Java. Following Java program
* * will show you, how you can display double value in different currency e.g.
* * USD, GBP and JPY. This example show price in multiple currency.
*/

publicclassCurrencyFormater {
publicstaticvoid main(String args[]) {
double price =100.25;
showPriceInUSD(price, getExchangeRate("USD"));
showPriceInGBP(price, getExchangeRate("GBP"));
showPriceInJPY(price, getExchangeRate("JPY"));
}

/** * Display price in US Dollar currency * * @param price * @param rate */
publicstaticvoid showPriceInUSD(double price, double rate) {
double priceInUSD = price *rate;
NumberFormat currencyFormat = NumberFormat
.getCurrencyInstance(Locale.US);
System.out.printf("Price in USD : %s %n",
currencyFormat.format(priceInUSD));
}

/** * Display prince in British Pound * * @param price * @param rate */
publicstaticvoid showPriceInGBP(double price, double rate) {
double princeInGBP = price *rate;
NumberFormat GBP = NumberFormat.getCurrencyInstance(Locale.UK);
System.out.printf("Price in GBP : %s %n", GBP.format(princeInGBP));
}

/** * Display prince in Japanese Yen * * @param price * @param rate */
publicstaticvoid showPriceInJPY(double price, double rate) {
double princeInJPY = price *rate;
NumberFormat currency = NumberFormat.getCurrencyInstance(Locale.JAPAN);
System.out.printf("Price in JPY : %s %n", currency.format(princeInJPY));
}

/** * @return FX exchange rate for USD * @param currency */
publicstatic double getExchangeRate(String currency) {
switch (currency) {
case"USD":
return1;
case"JPY":
return102.53;
case"GBP":
return0.60;
case"EURO":
return0.73;
default:
thrownew IllegalArgumentException(String.format(
"No rates available for currency %s %n", currency));
}
}
}

Output:

Price in USD : $100.25
Price in GBP :£60.15
Price in JPY :?10,279


Java code to format date

$
0
0
Sample code to format date
package com.kishore.samples;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
*
* Java program to show how to format date in Java using SimpleDateFormat
* Examples. Java allows to include date, time and timezone information
* while formatting dates in Java.
*
*/

publicclassDateFormatExample {

publicstaticvoid main(String args[]) {

// This is how to get today's date in Java
Date today =newDate();

//If you print Date, you will get un formatted output
System.out.println("Today is : "+ today);

//formatting date in Java using SimpleDateFormat
SimpleDateFormat DATE_FORMAT =new SimpleDateFormat("dd-MM-yyyy");
String date = DATE_FORMAT.format(today);
System.out.println("Today in dd-MM-yyyy format : "+ date);

//Another Example of formatting Date in Java using SimpleDateFormat
DATE_FORMAT =new SimpleDateFormat("dd/MM/yy");
date = DATE_FORMAT.format(today);
System.out.println("Today in dd/MM/yy pattern : "+ date);

//formatting Date with time information
DATE_FORMAT =new SimpleDateFormat("dd-MM-yy:HH:mm:SS");
date = DATE_FORMAT.format(today);
System.out.println("Today in dd-MM-yy:HH:mm:SS : "+ date);

//SimpleDateFormat example - Date with timezone information
DATE_FORMAT =new SimpleDateFormat("dd-MM-yy:HH:mm:SS Z");
date = DATE_FORMAT.format(today);
System.out.println("Today in dd-MM-yy:HH:mm:SSZ : "+ date);
}
}

Output:

Today is : MonJul0323:16:17IST2017
Todayin dd-MM-yyyy format : 03-07-2017
Todayin dd/MM/yy pattern : 03/07/17
Todayin dd-MM-yy:HH:mm:SS : 03-07-17:23:16:95
Todayin dd-MM-yy:HH:mm:SSZ : 03-07-17:23:16:95+0530

Currency converter service

$
0
0
I am attaching simple program about, How to write Simple Currency Converter using Java Program. The program was written using Fixer Currency Converter Webservice. In this example, I am using Gson 2.8.0 API to convert JSON to Object in Java. you can download API from here.

CurrencyConversionResponse.java

package com.kishore.generic;

import java.util.Map;
import java.util.TreeMap;

publicclassCurrencyConversionResponse {

privateString base;
privateString date;

private Map<String, String> rates =new TreeMap<String, String>();

public Map<String, String> getRates() {
return rates;
}

publicvoid setRates(Map<String, String> rates) {
this.rates = rates;
}

publicString getBase() {
return base;
}

publicvoid setBase(String base) {
this.base = base;
}

publicStringgetDate() {
return date;
}

publicvoidsetDate(String date) {
this.date = date;
}

}

CurrencyConvertor.java

package com.kishore.generic;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Scanner;

import com.google.gson.Gson;

publicclassCurrencyConvertor {

// API Provider URL
privatestatic final String API_PROVDIER ="http://api.fixer.io/";

publicstatic double convert(String fromCurrencyCode, String toCurrencyCode) {

if ((fromCurrencyCode !=null&&!fromCurrencyCode.isEmpty())
&& (toCurrencyCode !=null&&!toCurrencyCode.isEmpty())) {

CurrencyConversionResponse response= getResponse(API_PROVDIER
+"/latest?base="+ fromCurrencyCode);

if (response!=null) {

Stringrate=response.getRates().get(toCurrencyCode);

double conversionRate = Double.valueOf((rate!=null) ?rate:"0.0");

return conversionRate;
}

}

return0.0;
}

// Method to get the response from API
privatestatic CurrencyConversionResponse getResponse(String strUrl) {

CurrencyConversionResponse response=null;

Gson gson =new Gson();
StringBuffer sb =new StringBuffer();

if (strUrl ==null || strUrl.isEmpty()) {

System.out.println("Application Error");
returnnull;
}

URLurl;
try {
url=newURL(strUrl);

HttpURLConnection connection = (HttpURLConnection) url
.openConnection();

InputStream stream = connection.getInputStream();

intdata= stream.read();

while (data!=-1) {

sb.append((char) data);

data= stream.read();
}

stream.close();

response= gson.fromJson(sb.toString(),
CurrencyConversionResponse.class);

} catch (MalformedURLException e) {

System.out.println(e.getMessage());
e.printStackTrace();

} catch (IOException e) {

System.out.println(e.getMessage());
e.printStackTrace();
}

returnresponse;
}

publicstaticvoid main(String[] args) throws IOException {

Scanner scanner =new Scanner(System.in);

System.out.println("What is your currency code ?");
String fromCurrencyCode = scanner.next();

System.out.println("Enter the Amount :");
double amount = scanner.nextDouble();

System.out
.println("Enter the Currency Code that you want to covert : ");
String toCurrencyCode = scanner.next();

fromCurrencyCode = fromCurrencyCode.toUpperCase();
toCurrencyCode = toCurrencyCode.toUpperCase();

// Currency Conversion
double coversionRate = convert(fromCurrencyCode, toCurrencyCode);

System.out.println("Hi, The "+ amount +""+ fromCurrencyCode
+" is equivalent to "+ (coversionRate * amount) +""
+ toCurrencyCode +" today.");

scanner.close();
}

}

Output

What is your currency code ?
USD
Enter the Amount :
1
Enter the Currency Code that you want to covert :
GBP
Hi, The1.0 USD is equivalent to0.77341 GBP today.



AEM Repository Size Growing Rapidly

$
0
0
Sometimes we observe AEM repository size increase rapidly. Check how to compact repository size.

AEM Repository Compaction

  • Create new folder compact and place oak-run-1.2.2.jar and below .bat file.
  • Create a .bat file containing below code

java -jar oak-run-1.2.2.jar compact C:\Users\Kishore\AEM\crx-quickstart\repository\segmentstore

Download oak-run-1.2.2.jar

java.lang.NoClassDefFoundError: com/day/cq/commons/Externalizer

$
0
0
I have developed a website using AEM 6.1 API. In some piece of java code I used the Externalizer class from AEM (com.day.cq.commons). This piece of code worked fine in 6.1 aem instance. When tried to deploy on AEM 6.2 got below error.


06.07.201709:55:54.242*ERROR* [0:0:0:0:0:0:0:1 [1499331350444] GET/content/kishore/en/test.html HTTP/1.1] 
com.day.cq.wcm.core.impl.WCMDebugFilter Exception: com/day/cq/commons/Externalizer
java.lang.NoClassDefFoundError: com/day/cq/commons/Externalizer

Solution:

Fixed this issue by rebuilding the package with AEM 6.2 uber.jar



org.osgi.framework.BundleException: osgi.wiring.package=com.adobe.cq.mcm.salesforce

$
0
0
Sometimes when we try to deploy code, bundles may not be in active state in AEM 6.1. We can see below error message.

Error Message:
18.07.2017 23:44:01.519 *ERROR* [qtp1756110899-265] org.apache.felix.http.jetty %bundles.pluginTitle: Cannot start (org.osgi.framework.BundleException: Unresolved constraint in bundle com.aem.kishore.bundle-core [654]: Unable to resolve 654.1: missing requirement [654.1] osgi.wiring.package; (&(osgi.wiring.package=com.adobe.cq.mcm.salesforce)(version>=1.1.0)(!(version>=2.0.0))))
org.osgi.framework.BundleException: Unresolved constraint in bundle com.aem.kishore.bundle-core [654]: Unable to resolve 654.1: missing requirement [654.1] osgi.wiring.package; (&(osgi.wiring.package=com.adobe.cq.mcm.salesforce)(version>=1.1.0)(!(version>=2.0.0)))

Solution:
Daycare team provided the solution 

  • Delete (or stop) the ''org.eclipse.equinox.region" bundle from the felix.
  • Delete the existing custom bundle.
  • Restart the server (check without restarting) and then redeploy your code bundle.
This bundle has some dependency with eclipse and should not be in AEM6.1, it was meant for AEM 6.2. But somehow it got introduced in this version.

org.osgi.framework.BundleException:osgi.wiring.package=com.adobe.cq.sightly

$
0
0
Sometimes when we try to deploy code, bundles may not be in active state in AEM 6.1. We can see below error message.

Error Message:
22.07.2017 10:40:27.509 *ERROR* [qtp2141213534-59] org.apache.felix.http.jetty %bundles.pluginTitle: Cannot start (org.osgi.framework.BundleException: Unresolved constraint in bundle com.aem.kishore.bundle-core [463]: Unable to resolve 463.2: missing requirement [463.2] osgi.wiring.package; (&(osgi.wiring.package=com.adobe.cq.sightly)(version>=2.2.0)(!(version>=3.0.0))))

org.osgi.framework.BundleException: Unresolved constraint in bundle com.aem.kishore.bundle-core[463]: Unable to resolve 463.2: missing requirement [463.2] osgi.wiring.package; (&(osgi.wiring.package=com.adobe.cq.sightly)(version>=2.2.0)(!(version>=3.0.0)))


Solution:
  • Add below code in bundle pom.xml and rebuild the code.
<Import-Package>
!org.apache.log.*,
!org.apache.avalon.*
-----------------------------
-----------------------------
</Import-Package>

Generic way to author text in AEM dialog

$
0
0
I am trying to author text in dialog, text contains dynamic values like name etc. I tried declaring sightly variable names in AEM dialog to fetch the data dynamically but it didn't work.



 I tried below approaches..

Approach 1:
/*
* Using String format
*/
String authoredText= "Hi %s, welcome to %s";
authoredText = authoredText.format(authoredText,"Kishore","AEM Quickstart");
log.info("---Using String format----\n"+authoredText);

Approach 2:
/*
* Using StrSubstitutor - org.apache.commons.lang.text.StrSubstitutor
*/
Map valuesMap = new HashMap();
valuesMap.put("name", "Kishore");
valuesMap.put("blog", "AEM Quickstart");
String templateString = "Hi ${name}, welcome to ${blog}.";
StrSubstitutor sub = new StrSubstitutor(valuesMap);
String resolvedString = sub.replace(templateString);
log.info("---Using StrSubstitutor----\n"+resolvedString);

Approach 3:
/**
* Using String replace
*/
String authoredText= "Hi ${name}, welcome to ${blog}";
authoredText = authoredText.replace("${name}","Kishore");
authoredText = authoredText.replace("${blog}","AEM Quickstart");
log.info("---Using String replace----\n"+authoredText);

From above approaches we can author the text in any of the format and parse it in java and we can get the text in HTL.

Configuring Index Connector in Adobe Search & Promote

$
0
0


Why Index Connector?

Use Index Connector to define additional input sources for indexing XML pages or any kind of feed. Check how to integrate AEM with Search & Promote

You can use a data feed input source to access content that is stored in a form that is different from what is typically discovered on a website using one of the available crawl methods. However, a data feed either comes from an XML document or from a comma- or tab-delimited text file, and contains the content information to index.

An XML data source consists of XML stanzas, or records, that contain information that corresponds to individual documents. These individual documents are added to the index. A text data feed contains individual new-line-delimited records that correspond to individual documents. These individual documents are also added to the index. In either case, an index connector configuration describes how to interpret the feed. Each configuration describes where the file resides and how the servers access it. The configuration also describes "mapping" information. That is, how each record's items are used to populate the metadata fields in the resulting index.

How to enable Index Connector?

By default Index Connector option is disabled for all users. Request your Adobe Partner Consultant to add the Index Connector option for you Search & Promote account.

After you add an Index Connector definition to the Staged Index Connector Definitions page, you can change any configuration setting,except for the Name or Type values.



Index Connector Definitions?

Navigate to Settings-> Crawling -> Index Connector to see the Index Connector definitions which are configured earlier or create a new configuration.

The Index Connector page shows you the following information:
  • The name of defined index connectors that you have configured and added.
  • One of the following data source types for each connector that you have added:
    • Text – Simple "flat" files, comma-delimited, tab-delimited, or other consistently delimited formats.
    • Feed – XML feeds.
    • XML – Collections of XML documents.
  • Whether the connector is enabled or not for the next crawl and indexing done.
  • The address of the data source.

Create a Index Connector Definition


Enter below required data to create new Index Connector.
  • Name: Enter Index Connector name.
  • Type: Select Index Connector type. You can select either Text, Feed or XML.
  • Host Address: Enter the host address from where you want to pick the data to crawl.
  • File Path: Enter the absolute file path where the feed file is stored.
  • Incremental File Path: Enter the absolute incremental file path where the feed file is stored.
  • Protocol: Select the related protocol.
  • Username: Enter username to login to your server where the feed file is placed.
  • Password: Enter password to login to your server where the feed file is placed.
  • Timeout: Enter timeout in milli seconds.
  • Retries: Enter number of retries to be done when connection is not successful.
  • Itemtag: Enter the root item name of the record.
<Item>
<title>aemquickstart</title>
<id>101</id>
<description>Site to learn AEM</description>
</Item>
  • Enter all metadata details and click on Add button.

Configure the URL Entry Point:

Navigate to Settings -> Crawling -> URL Entry points. All the Index Connector definitions are displayed in the "--Add Index Connector Configurations--". Select new configuration created in above steps. An entry point is added below in the text area. Click on Save Changes button.



Configure Multiple Index Connectors:

Navigate to Settings -> Crawling -> URL Entry points. All the Index Connector definitions are displayed in the "--Add Index Connector Configurations--". Select new configuration created in above steps. An entry point is added below in the text area. Add one more index connector as mentioned above. Click on Save Changes button.

Read More:


Sling Resource API vs JCR API - Performance

$
0
0
Check the article to compare the performance when using Sling Resource API and JCR API.

This article illustrates different tests performed to compare the performance of sling resource api and jcr api.

Test 1: Traversing /content/geometrixx tree
Result: JCR API is roughly twice as fast as the Sling API when traversing a tree.

Test 2: Creating simple pages (single save)
When creating a 1000 simple pages and saving them in one go, it takes respectively 0.20 and 0.26 ms for the JCR and Sling API to create a single page. Creating 1000 pages took 200 and 260 ms respectively for JCR and Sling in total.






Troubleshooting AEM 6.1 to AEM 6.2 upgradation

$
0
0
When we try to upgrade website developed on AEM 6.1 to AEM 6.2 we need to consider below points.

Update uber.jar version to 6.2.0

<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<version>6.2.0</version>
<scope>provided</scope>
<classifier>obfuscated-apis</classifier>
</dependency>

Issue 1:

When tried to build code we normally see below error message.
java.lang.NoClassDefFoundError: com/day/cq/commons/Externalizer

06.07.201709:55:54.242*ERROR* [0:0:0:0:0:0:0:1 [1499331350444] GET/content/kishore/en/test.html HTTP/1.1] 
com.day.cq.wcm.core.impl.WCMDebugFilter Exception: com/day/cq/commons/Externalizer
java.lang.NoClassDefFoundError: com/day/cq/commons/Externalizer

Solution:
Fixed this issue by rebuilding the package with AEM 6.2 uber.jar

Issue 2:
Caused by: org.apache.sling.scripting.sightly.SightlyException: 
Cannot find a a file corresponding to class com.aem.kishore.HelloWorld in the repository.

Solution:

This issue is caused due to the Java version. Use the correct java version preferably Java 8.




Install NodeJs

$
0
0

What is NodeJS

  • Node.js is an open source server framework
  • Node.js is free
  • Node.js runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
  • Node.js uses JavaScript on the server

Click here to checkWhy Node.js

What is npm?

npm makes it easy for JavaScript developers to share and reuse code, and it makes it easy to update the code that you're sharing.
Click here to learn more on npm.

Install npm

Click here to download and install the npm on your machine.

Test if nodeJs is installed correctly, run below command.
npm -v
or 
npm --version
npm version

Start npm run start, if you get below error 
npm ERR! path C:\Users\Kishore\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\Kishore\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR!A complete logof this run can be found in:
npm ERR!C:\Users\Kishore\AppData\Roaming\npm-cache\_logs\2017-08-19T14_53_13_265Z-debug.log


You can avoid above error by following below

  • running the npm command from bin folder
  • set environment variables (~\bin)


Viewing all 162 articles
Browse latest View live