Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

AEM 6.5 - Implementation of Versioning for Clientlibs and CSS

Avatar

Level 2

Hello AEM Guru,

 

We have many versioning documents available but still have few queries.

 

I am new to AEM and have to implement  clientlibs versioning as with every deployment client libs are not getting updated in the normal browser even after flushing the dispatcher cache and CDN cache. Tried to implement as suggested by many.

Facing below few issues :

1. I am tried to implement this via crxde in local . if we want to do it via code how to do that . /apps/<project folder/config/rewriter/ - should a create an xml file and copy paste this code :

<?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]"/>

This is required, as in our higher environment we don't have access to CRXDE console.  

 

#2 - In my local, i did the changes via  crxde and save all.  After restarting i am getting below :

Configuration versioned-clientlibs

Name : versioned-clientlibs
Content Types : [text/html]
Order : -1
Active : true
Valid : true
Process Error Response : true
Pipeline : 
    Generator : 
        htmlparser
    Transformers : 
        linkchecker
         versioned-clientlibs 
    Serializer : 
        htmlwriter
Resource path: /apps/shc/config/rewriter/versioned-clientlibs

But my author environment is blank . When checked the error logs found this :
Caused by: org.apache.sling.api.SlingException: Unable to setup processor: Unable to get component of class 'interface org.apache.sling.rewriter.Transformer' with type ' versioned-clientlibs '.
at org.apache.sling.rewriter.impl.ProcessorManagerImpl.getProcessor(ProcessorManagerImpl.java:487) [org.apache.sling.rewriter:1.2.2]
at org.apache.sling.rewriter.impl.RewriterResponse.getProcessor(RewriterResponse.java:172) [org.apache.sling.rewriter:1.2.2]
at org.apache.sling.rewriter.impl.RewriterResponse.getWriter(RewriterResponse.java:110) [org.apache.sling.rewriter:1.2.2]
at org.apache.sling.scripting.core.impl.helper.OnDemandWriter.getWriter(OnDemandWriter.java:38) [org.apache.sling.scripting.core:2.0.56]
at org.apache.sling.scripting.core.impl.helper.OnDemandWriter.write(OnDemandWriter.java:61) [org.apache.sling.scripting.core:2.0.56]
at java.io.PrintWriter.write(PrintWriter.java:426)
at org.apache.sling.scripting.jsp.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:119) [org.apache.sling.scripting.jsp:2.3.4]
at org.apache.sling.scripting.jsp.jasper.runtime.PageContextImpl.release(PageContextImpl.java:191) [org.apache.sling.scripting.jsp:2.3.4]
at org.apache.sling.scripting.jsp.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:99) [org.apache.sling.scripting.jsp:2.3.4]
at org.apache.sling.scripting.jsp.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:71) [org.apache.sling.scripting.jsp:2.3.4]
at org.apache.sling.scripting.jsp.jasper.compiler.JspRuntimeContext$JspFactoryHandler.releasePageContext(JspRuntimeContext.java:112) [org.apache.sling.scripting.jsp:2.3.4]
at org.apache.jsp.apps.sling.servlet.errorhandler.default_jsp._jspService(default_jsp.java:456)
at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [org.apache.sling.scripting.jsp:2.3.4]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) [org.apache.felix.http.servlet-api:1.1.2]
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:502) [org.apache.sling.scripting.jsp:2.3.4]
... 76 common frames omitted
Caused by: java.io.IOException: Unable to get component of class 'interface org.apache.sling.rewriter.Transformer' with type ' versioned-clientlibs '.
at org.apache.sling.rewriter.impl.PipelineImpl.getPipelineComponent(PipelineImpl.java:161) [org.apache.sling.rewriter:1.2.2]
at org.apache.sling.rewriter.impl.PipelineImpl.init(PipelineImpl.java:103) [org.apache.sling.rewriter:1.2.2]
at org.apache.sling.rewriter.impl.ProcessorManagerImpl.getProcessor(ProcessorManagerImpl.java:480) [org.apache.sling.rewriter:1.2.2]
... 90 common frames omitted

Any help would be highly appreciated

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@aem_dev2 thank you for reaching out to community. It is a great place to collaborate and learn.

 

Based the question you posted, it seems like you are trying to configure acs commons versioned clientlubs, and rewriter configuration has been correctly done but acs commons needs to be installed in the instance to make it work. Please see the below 

https://adobe-consulting-services.github.io/acs-aem-commons/features/versioned-clientlibs/index.html

 

View solution in original post

18 Replies

Avatar

Correct answer by
Community Advisor

@aem_dev2 thank you for reaching out to community. It is a great place to collaborate and learn.

 

Based the question you posted, it seems like you are trying to configure acs commons versioned clientlubs, and rewriter configuration has been correctly done but acs commons needs to be installed in the instance to make it work. Please see the below 

https://adobe-consulting-services.github.io/acs-aem-commons/features/versioned-clientlibs/index.html

 

Avatar

Level 2
@Shashi_Mulugu .. Thanks for the reply.- tried that as well.downloaded the git code and tried to install that package but it says jcr root not found.

Avatar

Level 2
@Shashi_Mulugu .. Thanks for the reply . I am unable to open my CRXDE or local application .. it's giving me error 07.03.2021 14:33:14.664 *ERROR* [0:0:0:0:0:0:0:1 [1615107793579] GET /libs/granite/core/content/login.html HTTP/1.1] org.apache.sling.engine.impl.SlingMainServlet service: Uncaught Problem handling the request org.apache.sling.api.SlingException: Unable to setup processor: Unable to get component of class 'interface org.apache.sling.rewriter.Transformer' with type ' versioned-clientlibs '. Can you please let me know , how to manually install this package.

Avatar

Community Advisor
Try directly to either crx/de or crxpackmgr or system console or crx explorer so that you can first delete that entry and then follow the proper procedure to install first acs commons and then configure rewriter

Avatar

Level 2

@Shashi_Mulugu.. Thanks for the reply . I did the fresh install and then as suggested first installed the package and then then did the configuration. Now , in Sling i can see new configuration.

Configuration versioned-clientlibs

Name : versioned-clientlibs
Content Types : [text/html]
Order : -1
Active : true
Valid : true
Process Error Response : true
Pipeline : 
    Generator : 
        htmlparser
    Transformers : 
        linkchecker
        versioned-clientlibs
    Serializer : 
        htmlwriter
Resource path: /apps/shc/config/rewriter/versioned-clientlibs

Have few more question :

1. How i can validate this in local ?

 

2. in our dev/qa/PROD we don't have access to crx/de so how to do this changes in code. Should i just create a filde /apps/<project>/config/rewriter/versioned-clientlibs.xml file and then deploy the code. Will this work ?

 

Would be great help if you help me in clearing my above doubt .

Avatar

Community Advisor
1. To validate open any page you created and see the source, you should see a SHA code in your css or js file urls 2. For code movement yes, commit the nodes in code

Avatar

Level 2
Thanks alot @Shashi_Mulugu . I am seeing file as - http://localhost:4502/etc.clientlibs/<abc>/clientlibs/clientlib-base.f790a18b9d4df60886adf9b5f01f9e44.js . i try this in our QA environment like this - /apps/<project>/config/rewriter/versioned-clientlibs.xml

Avatar

Community Advisor
sure. First install acs commons and then place config. All the very best.

Avatar

Level 2
@Shashi_Mulugu - Thanks alot sir for your quick reply and help on this. Much appreciated .

Avatar

Level 2
@Shashi_Mulugu - Sir , one more question.. If we redeploy the same code i.e without any file changes does the versioning will be same or it should change. In my case it is the same.

Avatar

Administrator
@Shashi_Mulugu, Thank you for posting the solution with AEM Community. This helps in posterity. Keep the wonderful contribution going (both as learner and contributor).


Kautuk Sahni

Avatar

Level 2
@Shashi_Mulugu - Post production deployment we faced an issue with versioning. As per Adobe support this solution won't work for AEM cloud

Avatar

Community Advisor
Hey, As per the question you have mentioned version as AEM 6.5, Is it 6.5 or Cloud?

Avatar

Level 2
Good day, so I have also followed the steps in the above link, I can see the rewrite in the sling rewrite status, but when looking at the code of a webpage, the XF css and JS have the versioning but not any of the clientlib css or js, could anybody perhaps guide me in what could be wrong? Thank you

Avatar

Level 1

Hi,

I had implemented all the steps mentioned for versioning. I can see the rewriter information in the sling rewriter status. Still, when checked on page, clientlibs are not versioned. aem-service pack used is 6.5.14 and acs commons version is 5.0.4.

Can anyone help on anything missed/wrong..?

Thank you!