Error with transformer breaks login screen

Avatar

Avatar

jkpanera

Avatar

jkpanera

jkpanera

05-12-2020

Hi guys,

We have a custom html transformer configured as follows:

<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="nt:unstructured"
contentTypes="[text/html]"
enabled="{Boolean}true"
generatorType="htmlparser"
order="{Long}1"
serializerType="htmlwriter"
transformerTypes="[linkchecker,jsonlinksmapper]">
<generator-htmlparser
jcr:primaryType="nt:unstructured"
includeTags="[BUTTON,IW-ORDER-SETUP-FLOW,DIV,META,/META,A,/A,/AREA,FORM,BASE,LINK,SCRIPT,BODY,/BODY,VIDEO,/VIDEO,ASIDE,/ASIDE,SECTION,/SECTION]"/>
</jcr:root>

Most of the time it works fine but if something does go wrong, it can actually take down the login screen. I see an exception with the root exception of this:

 

 

Caused by: java.io.IOException: Unable to get component of class 'interface org.apache.sling.rewriter.Transformer' with type 'jsonlinksmapper'.
at org.apache.sling.rewriter.impl.PipelineImpl.getPipelineComponent(PipelineImpl.java:161)
at org.apache.sling.rewriter.impl.PipelineImpl.init(PipelineImpl.java:103)
at org.apache.sling.rewriter.impl.ProcessorManagerImpl.getProcessor(ProcessorManagerImpl.java:480)
... 73 common frames omitted

 

 

I can usually fix whatever is wrong with the transformer (and sometimes it seems to be something else wrong with the bundle), but it's much harder if I can log in to crx etc. I can still use curl but it is pretty hard to diagnose issues without the system console, crx, etc.

I presume that the issue is that this html transformer is attempting to process the login screen and failing. I'd like to restrict the pipeline to only attempt to invoke it on specific paths or somehow exclude system paths.

Note that I'm not trying to fix the transformer. It's working fine at the moment.

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

BrianKasingli

MVP

Avatar

BrianKasingli

MVP

BrianKasingli
MVP

05-12-2020

@jkpanera 

As simple as it sounds, when working with the transformer configurations, there is a property that you can allow which paths to be HTML transformed, called paths. You can try other properties such as resourceTypes... for the full list of transformer configurations, checkout Apache's documentation page.

Your configuration can look something like this:

 

<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0"
   jcr:primaryType="nt:unstructured"
   contentTypes="[text/html]"
   enabled="{Boolean}true"
   generatorType="htmlparser"
   order="{Long}1"
-> paths="[/content/my-site,/content/experience-fragments/my-site]"
   serializerType="htmlwriter"
   transformerTypes="[linkchecker,jsonlinksmapper]">
  <generator-htmlparser
    jcr:primaryType="nt:unstructured"
    includeTags="[BUTTON,IW-ORDER-SETUP-FLOW,DIV,META,/META,A,/A,/AREA,FORM,BASE,LINK,SCRIPT,BODY,/BODY,VIDEO,/VIDEO,ASIDE,/ASIDE,SECTION,/SECTION]"/>
</jcr:root>

 

I hope this helps

 

Answers (0)