Client Library Versioning in AEM 6.1

Avatar

Avatar

abhijitch

Avatar

abhijitch

abhijitch

28-02-2019

Hi All,

I tried to do clientlibs versioning in AEM 6.1 by creating rewriter sling-folder and copying the 'default' node from libs > cq > config > rewriter. But its not working and the whole AEM local instance in getting corrupted. Error log is showing "Unable to get component of class 'interface org.apache.sling.rewriter.Transformer' with type 'versioned-clientlibs'."

Tried from the link http://www.aemcq5tutorials.com/tutorials/versioned-clientlibs-aem/

Any kind of help would be appreciated.

Regards,

Abhijit Chowdhury

Replies

Avatar

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

942

Correct Reply

1.0K

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

942

Correct Reply

1.0K
Jörg_Hoh
Employee

01-03-2019

You should have ACS AEM Commons installed to make this work.

Avatar

Avatar

abhijitch

Avatar

abhijitch

abhijitch

04-03-2019

ACS AEM Commons is already installed. Still it is not working.

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

04-03-2019

See Versioned ClientLibs

YOu can comment at that URL too for questions why its not working.

Avatar

Avatar

Gaurav-Behl

MVP

Avatar

Gaurav-Behl

MVP

Gaurav-Behl
MVP

04-03-2019

If you follow Versioned ClientLibs, then this is all you need. No need for "default" node under rewriter as you mentioned.

/apps/<myapp>/config/rewriter/versioned-clientlibs.xml

The easiest way to configure the rewriter pipline is just to copy /libs/cq/config/rewriter/default to a path inside your application, e.g. /apps/myapp/config/rewriter/versioned-clientlibs. Note that the configuration node must be inside a four-level path that ends in config/rewriter

1703939_pastedImage_11.png

Avatar

Avatar

abhijitch

Avatar

abhijitch

abhijitch

05-03-2019

I have done all the steps with changes and now the instance is up & running. But the issue is, versioning is not reflecting in local AEM instance. Its all the same js & css files without query parameters.

Avatar

Avatar

Gaurav-Behl

MVP

Avatar

Gaurav-Behl

MVP

Gaurav-Behl
MVP

05-03-2019

Could you share the configuration screenshot the way I shared above?

In addition to that, how did you test, could you share a screenshot for the same?

Avatar

Avatar

abhijitch

Avatar

abhijitch

abhijitch

05-03-2019

Below is the screenshot of the configuration done

1704691_pastedImage_4.png

I ran a page from AEM, checked the source code. The js file should be appended with a query parameter, which is not getting done.

Please note, All the bundles are active, and Enforce MD5 is checked in Versioned Clientlibs Transformer Factory.

Avatar

Avatar

Gaurav-Behl

MVP

Avatar

Gaurav-Behl

MVP

Gaurav-Behl
MVP

05-03-2019

What works for me in my local is jcr:primaryType="sling:Folder" 

The same config is mentioned @ Versioned ClientLibs

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"

  jcr:primaryType="sling:Folder"
 
contentTypes="[text/html]"
   enabled="{Boolean}true"
   generatorType="htmlparser"
   order="{Long}1"
   serializerType="htmlwriter"
   transformerTypes="[linkchecker,versioned-clientlibs]"/>

I've not enforced MD5 in my local and it works fine. Per docs - Optionally, a filter can registered which checks incoming requests for client libraries and ensures that the hash in the path is the correct value

Avatar

Avatar

abhijitch

Avatar

abhijitch

abhijitch

05-03-2019

Thanks. But in libs > cq > config > rewriter, the default node is nt:unstructured. So when I copied, it became nt:unstructured. If manually I create the default node by choosing jcr:primaryType as sling:Folder then it appears as a folder and NOT as a node.

I am using AEM 6.1.