Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Error with transformer breaks login screen

jkpanera
Level 5
Level 5

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!

1 Accepted Solution
BrianKasingli
Correct answer by
Community Advisor
Community Advisor

@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

 

View solution in original post

1 Reply
BrianKasingli
Correct answer by
Community Advisor
Community Advisor

@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

 

View solution in original post