Thursday, November 30, 2017

Flush the dispatcher cache for DAM assets used on multiple websites(Domains) through ACS AEM Commons - Dispatcher Flush Rules

Flush the dispatcher cache for dam assets used on multiple websites through ACS AEM Commons - Dispatcher Flush Rules

Some cases, the same DAM asset is used on multiple websites(Domains) and the individual websites caches the assets locally, the regular replication agent configuration will not clear the cache for all the websites that use the common DAM asset.

This post will explain the approach to flush the dispatcher cache for common DAM assets used om multiple websites through ACS AEM Commons - Dispatcher Flush Rules - Adobe Experience Manager(AEM).

Install acs-aem-commons-content-3.9.0.zip package(ignore if it is already available):


ACS commons package download link:
https://github.com/Adobe-Consulting-Services/acs-aem-commons/releases/tag/acs-aem-commons-3.9.0
 

Configure the ResourceOnly Flush agent in publisher:


Create the Flush agent in publisher with following configuration


Dispatcher DAM Flush Agent



Friday, November 24, 2017

Rewrite Rules with PT(Pass Through) Flag is not working in AEM Dispatchers - Adobe Experience Manager(AEM)

Rewrite Rules with PT(Pass Through) Flag is not working in AEM Dispatchers - Adobe Experience Manager(AEM)

How to define SEO/User friendly URL's in Adobe Experience Manager(AEM)


The Rewrite Rules with PT Flag helps us to define the SEO/User friendly URL's by hiding the internal URL's.

Let consider a scenario - The product URL should be rewritten to SEO/User friendly URL.

The internal product URL is - /en/test/pdp/book.html?id=123, this URL is not SEO/User friendly as the title of the the product is not part of the URL

The URL should be rewritten to /en/test/Sample_Book/book/pdp.html?id=123 internally without changing the Browser URL

Rewrite_Rule_with_PT_flag



Sunday, November 5, 2017

ORABPEL-05250 Error - JDeveloper Part2

ORABPEL-05250 Error - JDeveloper Part2

I was facing a strange issue while deploying the composite to the server but The composite was successfully build in JDeveloper but during deployment to the server received the following exception.

[02:02:37 PM] Sending archive - sca_SuppressSelectionFailure_rev1.0.jar
[02:02:49 PM] Received HTTP response from the server, response code=500
[02:02:49 PM] Error deploying archive sca_SuppressSelectionFailure_rev1.0.jar to partition "default" on server AdminServer [http://inkaban3ua-eai05:8000]
[02:02:49 PM] HTTP error code returned [500]
[02:02:49 PM] Error message from server:
There was an error deploying the composite on AdminServer: Error occurred during deployment of component: SuppressSelectionFailure to service engine: implementation.bpel, for composite: SuppressSelectionFailure: ORABPEL-05250

Error deploying BPEL suitcase.
error while attempting to deploy the BPEL component file "/fmw/config/admin/domains/SOACoreDomain/servers/AdminServer/dc/soa_1b6f358e-8947-4572-a573-e036770c0591"; the exception reported is: java.lang.Exception: BPEL 1.1 compilation failed

This error contained an exception thrown by the underlying deployment module.
Verify the exception trace in the log (with logging level set to debug mode).
.

[02:02:49 PM] Check server log for more details.
[02:02:49 PM] Error deploying archive sca_SuppressSelectionFailure_rev1.0.jar to partition "default" on server AdminServer [http://localhost:8000]
[02:02:49 PM] ####  Deployment incomplete.  ####
[02:02:49 PM] Error deploying archive file:/C:/JDeveloper/mywork/Application1/SuppressSelectionFailure/deploy/sca_SuppressSelectionFailure_rev1.0.jar
 (oracle.tip.tools.ide.fabric.deploy.common.SOARemoteDeployer)


java.lang.ClassCastException for the same class com.sample.test.Test cannot be cast to com.sample.test.Test - Adobe Experience Manager(AEM)

java.lang.ClassCastException for the same class com.sample.test.Test cannot be cast to com.sample.test.Test - Adobe Experience Manager(AEM)

We were facing a strange ClassCastException - ClassCastException pointing to the same class in Adobe Experience Manager(AEM)

java.lang.ClassCastException: com.sample.test.Test cannot be cast to com.sample.test.Test

While analyzing through depfinder - http://localhost:4502/system/console/depfinder, there is two version of the same class available from two different packages.

But this class is only defined in one of the package and referred in the other package, after analyzing the Sling class loading is little different - If one of the class com.sample.test.Test is referred from different package, Sling copies the classes locally to the target package and if the target package export the same package(<Export-Package>) -  com.sample.* then Sling export the classes copied from other package that matches the export pattern, in this case our target package is already exporting com.sample.* so two version of same class is available now. This will lead to the ClassCastException specified above.

To fix this issue, we can change the target package pom.xml file to restrict the export of referred classes from other package.

<Export-Package>com.sample.*,!com.sample.test</Export-Package>

Please make sure the restricted package - !com.sample.test is kept after the wider package - com.sample.*

Now only one version of the class from source package is available for reference.