Showing posts with label Troubleshooting. Show all posts
Showing posts with label Troubleshooting. Show all posts

Friday, 17 February 2017

Sidekick is not loading in AEM

We can hide/disable sidekick in author mode in page component by removing/commenting or by not including "/libs/wcm/core/components/init/init.jsp" in any of the jsps of the page or its super/parent resource.

In Sightly we can use below code
<sly data-sly-include="/libs/wcm/core/components/init/init.jsp" data-sly-unwrap/>

AEM 6.1 - Filter RequestDispatcher Forward breaks i18n

I just noticed that on AEM 6, in my Filter, when I call RequestDispatcher forward, i.e. request.getRequestDispatcher(...).forward(req, res);, it cause i18n to break. Here's a snippet of my codes:
...
boolean filtered = false;

SlingHttpServletRequest request = req instanceof SlingHttpServletRequest ? (SlingHttpServletRequest) req : null;
SlingHttpServletResponse response = res instanceof SlingHttpServletResponse ? (SlingHttpServletResponse) res : null;
            
if (request != null && response != null) {
                
    // block of codes to resolve the request uri and get the new desired URI 
                    
    if (this.resolvedUriResource != null) {
        String uri = this.resolvedUriResource.getPath() + ".html";
        RequestDispatcherOptions options = new RequestDispatcherOptions();
        options.setAddSelectors(uriSelectors);
        this.filterConfig.getServletContext().getRequestDispatcher(uri).forward(req, res); // OR
        //request.getRequestDispatcher(this.resolvedUriResource, options).forward(req, res);
        filtered = true;
    }
}

if (!filtered) {
    chain.doFilter(req, res);
}
...
The exact same codes was working on AEM6.0 and AEM 5.6.x.
Download this package to try out and see the issue: AEM6.1-i18n-issue-samplepackage.zip.

Saturday, 3 December 2016

Dispatcher serving, but not caching - request contains authorization

Problem:
Dispatcher is configured but pages are not getting cached due to request containing authorization.

Error:
[Thu Dec 03 7:58:58 2012] [D] [820(139934505617152)] no cache due to authorization header.
[Thu Dec 03 7:58:58 2012] [D] [820(139934505617152)] cache action for [http://localhost/content/geometrixx/en/toolbar.html] NONE

Solution:
By default, if the HTTP request includes an authorization header, the cache is not used. There is a property in the dispatcher.any file:

/allowAuthorized "1" - allow cache if request include authorization header.

Example:
/cache {
   /docroot "C:/Apache2/dispatcher/cache"
   /allowAuthorized "1"
   /rules {
    /0000 {
     /glob "*"
     /type "allow"
    }
   }
  }

Note: See how to configure dispatcher

Friday, 25 November 2016

Uncaught TypeError: Cannot read property 'extend' of undefined' - cq.extend

When we try to create a custom widget we extend the widget from the CompositeField. When we render this custom widget script, we may get error like "Uncaught TypeError: Cannot read property 'extend' of undefined' ".

Solution:

When custom component adds a dependency on cq.widgets it will always fail in the publisher.

When we include below statement in clientlibs, this script is also evaluated in the publisher for the purpose of assigning the variable, even if it is never used.

Search.CustomWidget = CQ.Ext.extend(CQ.form.CompositeField, { 
You can make this work by having the authoring part completely separated from the rest of the component, so that the publisher never tries to execute any part of it. For example by using a different category which is only included using WCMMode.fromRequest(request) != WCMMode.DISABLED

Thursday, 24 November 2016

Adobe AEM - Cross Domain AJAX Request

A common problem for developers is a browser to refuse access to a remote resource. Usually, this happens when you execute AJAX cross domain request using jQuery or plain XMLHttpRequest. As result is that the AJAX request is not performed and data are not retrieved.


jquery ajax cross domain
Figure 1. The same-origin policy restriction in effect

ERROR:

XMLHttpRequest cannot load http://remote-domain/url. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://localhost:5433' is therefore not allowed access

SAME-ORIGIN POLICY

This is a security policy who defines the rules of how a web page can access an external resource (e.g. fonts, AJAX requests). Under the same-origin policy, web browsers do not permit a web page to access resources who origin differ than that of the current page. The origin is considered to be different when the scheme, hostname or port of the resource do not match that of the page. Overcoming the limitations of same-origin security policy is possible using a technique called Cross-origin resource sharing or simply CORS.

Wednesday, 23 November 2016

Image upload issue in Internet Explorer from Author Dispatcher

If you came to happen to  face issue with image upload from AEM author through dispatcher, this article may help you. You may face issue when you upload an image from image component or uploading images through Assets dashboard. Performing the following things may fix this issue for you-

1. Increase the Upload Buffer Size from OSGi Console (http://host:port/system/console/configMgr)
   Configure service - "Apache Felix Jetty Based Http Service"
Increase following two parameters- "Request Buffer Size" and "Response Buffer Size" to 65536  or a reasonable limit as per your application requirement.

   

Tuesday, 22 November 2016

AEM Troubleshooting

Sharing few utility tools/ links-

1. To find the generated java files in AEM6.1

Generated JSP JAVA files used to be at -  /var/classes location but AEM6.1 on wards it's no longer present there. This is due to change of repository ClassLoader, now it uses FSClassLoader (File System ClassLoader) for better performance and throughput.

Generated JSP java files are located at- [AEM_INSTALL_DIR]/crx-quickstart/launchpad/felix/bundle[BUNDLE_ID]/data/classes


Source: For details read following article - https://www.danklco.com/posts/2015/06/23/new-apache-sling-fs-classloader-console/

Friday, 4 November 2016

Explore Request Log in AEM


Request log in AEM plays a very vital role towards analysis of site performance. For each request and response one entry is written into request.log file, you can analyze this log file to find out maximum time taken by a request to load and then troubleshoot the issue to increase overall site performance.

Wednesday, 7 September 2016

Issues while Migrating from Java6 to Java8 in AEM 6.1

Recently while working on AEM 6.1, I had to move from Java 6 to Java 8. Simply changing the Java version in POM led to some issues with OSGi services. Specifically, those services that were using @Reference annotation were not getting active and remained in “satistied” state.
Here are all the steps I followed firstly to change Java version and then fixing above mentioned issue:
1. To build an AEM project with Java8 as runtime environment, following configuration is required in pom.xml. The Compiler Plugin is added to the parent POM, it is used to compile the sources of your project.

Wednesday, 24 August 2016

Failed to decode downloaded font

When accessing AEM pages fonts may not be loaded properly

Error: 
OTS parsing error: Failed to convert WOFF 2.0 font to SFNT




Solution:
Add below plugin in pom.xml
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <executions>
        <execution>
            <id>copy-content-resources</id>
            <phase>process-resources</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <outputDirectory>${project.build.directory}/vault-work</outputDirectory>
                
                <nonFilteredFileExtensions>
                    <nonFilteredFileExtension>jpg</nonFilteredFileExtension>
                    <nonFilteredFileExtension>jpeg</nonFilteredFileExtension>
                    <nonFilteredFileExtension>gif</nonFilteredFileExtension>
                    <nonFilteredFileExtension>png</nonFilteredFileExtension>
                    <nonFilteredFileExtension>ico</nonFilteredFileExtension>
                    <nonFilteredFileExtension>svg</nonFilteredFileExtension>
                    <nonFilteredFileExtension>eot</nonFilteredFileExtension>
                    <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
                    <nonFilteredFileExtension>woff</nonFilteredFileExtension>
                    <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
                    <nonFilteredFileExtension>otf</nonFilteredFileExtension>
                    <nonFilteredFileExtension>eot</nonFilteredFileExtension>
                    <nonFilteredFileExtension>jar</nonFilteredFileExtension>
                    <nonFilteredFileExtension>zip</nonFilteredFileExtension>
                </nonFilteredFileExtensions>
                
                <resources>
                    <resource>
                        <directory>${basedir}/src/main/content</directory>
                        <filtering>true</filtering>
                        <excludes>
                            <exclude>/etc/designs/${project.parent.artifactId}/jcr:content(/.*)?</exclude>
                            <exclude>**/*.eot</exclude>
                            <exclude>**/*.svg</exclude>
                            <exclude>**/*.ttf</exclude>
                            <exclude>**/*.woff</exclude>
                            <exclude>**/*.woff2</exclude>
                            <exclude>**/*.otf</exclude>
                            <exclude>**/.svn</exclude>
                            <exclude>**/.vlt</exclude>
                            <exclude>**/.vltignore</exclude>
                            <exclude>**/.DS_Store</exclude>
                        </excludes>
                    </resource>
                    <resource>
                        <directory>${basedir}/src/main/content</directory>
                        <filtering>false</filtering>
                        <includes>
                            <include>/etc/designs/${project.parent.artifactId}/jcr:content(/.*)?</include>
                            <include>**/*.eot</include>
                            <include>**/*.svg</include>
                            <include>**/*.ttf</include>
                            <include>**/*.woff</include>
                            <include>**/*.woff2</include>
                            <include>**/*.otf</include>
                        </includes>
                    </resource>
                </resources>
            </configuration>
        </execution>
    </executions>
</plugin>

Saturday, 23 April 2016

Issue: Page displays i18n keys instead of values

Issue Description: 

AEM i18n keys values are displayed instead of values.

Solution:

This issue is observed when "Apache Sling Internalization Support" bundle is in resolved state. By restarting this bundle, i18n issue will be solved.


Friday, 13 November 2015

How To Change Default Admin Password

1  . Open the welcome screen.(http://localhost:4502/projects.html).




2.  Click on the Tools. You will get below screen.



3. Click on the Users link.




4. Click on the Administrator link and find the account settings.


5.  Click on the change password.






 Fill the form and click OK button,

Component not showing in Touch UI / SideKick of Classical UI in AEM / Adobe CQ5 / AEM6

To see component in the Touch UI

If you want to see the component in touch UI components list. The component Should have cq:editConfig node. Though if you add cq:editConfig node, if components are still not displayed then if you get TooManyCallsException. Check this post to avoid TooManyCallsException


  • 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


To See Component in the SideKick in Classic UI

  • The component should have dialog.
  • if component have dialog and not showing in sidekick. Check title of Component it should starts with capital letter.