While creating audience in AEM contextHub, we see a component called Script Reference. When we drag-n-drop the component, we don't see any scripts by default in the drop down.
Menu
Saturday, 12 January 2019
Wednesday, 9 January 2019
URL Shortening in AEM
Content pages in AEM start with path /content/.
It is best practice to hide /content/site
in the URL.
Below configs show how to achieve URL shortening on
both AEM server and dispatcher.
Configs on AEM Server:
·
There are many ways to configure the rewrites on
publish server. e.g. Resource Resolver, Vanity URLs, Sling mapping.
·
Configuring the Apache Sling Resource
Resolver Factory is one of the ways to configure rewrites. This
service needs to be configured on the publish server so that if someone hits
the publish server directly; we see the correct rules applied there.
Make sure that the publish server has the below configuration applied
Make sure that the publish server has the below configuration applied
Sunday, 6 January 2019
Backend forbids caching, sent: 'Dispatcher: no-cache'
When using dispatcher if we use below code then pages will not be cached in dispatcher. Error in dispatcher.log is "Backend forbids caching, sent: 'Dispatcher: no-cache'"
response.setHeader("Dispatcher", "no-cache");
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
response.setDateHeader("Expires", 0);
response.setHeader("Dispatcher", "no-cache");
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
response.setDateHeader("Expires", 0);
Monday, 29 October 2018
Annotation @reference is disallowed for this location
Issue:
Annotation @reference is disallowed for this location.
Solution:
There are multiple ways to use @Reference annotations in OSGi annotations.
Option 1:
@Reference
MyService myService;
Option 2:
private MyService myService;
@Reference
public void bindMyService(MyService myService) {
this.myService = myService;
}
public void unbindMyService(MyService myService) {
this.myService = myService;
}
To avoid this error use option 2.
Saturday, 27 October 2018
Plugin org.apache.maven.plugins:maven-dependency-plugin:2.10 or one of its dependencies could not be resolved
I tried to create AEM 6.4 project using maven archetype 10. When tried to build the project got below error.
Error:
[ERROR] Plugin org.apache.maven.plugins:maven-dependency-plugin:2.10 or one of its dependencies could not be resolved:
Failed to read artifact descriptor for org.apache.maven.plugins:maven-dependency-plugin:jar:2.10:
Could not transfer artifact org.apache.maven.plugins:maven-dependency-plugin:pom:2.10 from/to central
( https://repo.maven.apache.org/maven2): Access denied to: https://repo.maven.apac he.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/2.10/maven-depend ency-plugin-2.10.pom , ReasonPhrase:Forbidden. -> [Help 1]
Check if you can download the jar from browser http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.jar.
If you are able to download the jar then your browser has connectivity to central but maven doesn't. So try using a proxy in settings.xml
Error:
[ERROR] Plugin org.apache.maven.plugins:maven-dependency-plugin:2.10 or one of its dependencies could not be resolved:
Failed to read artifact descriptor for org.apache.maven.plugins:maven-dependency-plugin:jar:2.10:
Could not transfer artifact org.apache.maven.plugins:maven-dependency-plugin:pom:2.10 from/to central
( https://repo.maven.apache.org/maven2): Access denied to: https://repo.maven.apac he.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/2.10/maven-depend ency-plugin-2.10.pom , ReasonPhrase:Forbidden. -> [Help 1]
Solution:
Check if you can download the jar from browser http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.jar.
If you are able to download the jar then your browser has connectivity to central but maven doesn't. So try using a proxy in settings.xml
If above didn't work try to build using command
mvn clean install -s
Saturday, 6 October 2018
com.adobe.cq.sightly,version=[2.5,3) -- Cannot be resolved
If you are migrating to AEM 6.3/AEM 6.4 then you may face the below issue
com.adobe.cq.sightly,version=[2.5,3) -- Cannot be resolved
Solution:
Add correct uber-jar version in pom.xml
<dependency>
<groupId>com.adobe.aem</groupId> <artifactId>uber-jar</artifactId> <version>6.4.0</version> <classifier>apis</classifier> <scope>provided</scope> </dependency>
If still issue exists, then add below in import package
<Import-Package>com.adobe.cq.sightly;version=2.5.3,*</Import-Package>
com.adobe.cq.sightly,version=[2.5,3) -- Cannot be resolved
Solution:
Add correct uber-jar version in pom.xml
<dependency>
<groupId>com.adobe.aem</groupId> <artifactId>uber-jar</artifactId> <version>6.4.0</version> <classifier>apis</classifier> <scope>provided</scope> </dependency>
If still issue exists, then add below in import package
<Import-Package>com.adobe.cq.sightly;version=2.5.3,*</Import-Package>
Subscribe to:
Posts
(
Atom
)