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

Error with transformer breaks login screen

Avatar

Avatar
Springboard
Level 3
jkpanera
Level 3

Likes

18 likes

Total Posts

107 posts

Correct Reply

2 solutions
Top badges earned
Springboard
Establish
Validate 10
Validate 1
Ignite 5
View profile

Avatar
Springboard
Level 3
jkpanera
Level 3

Likes

18 likes

Total Posts

107 posts

Correct Reply

2 solutions
Top badges earned
Springboard
Establish
Validate 10
Validate 1
Ignite 5
View profile
jkpanera
Level 3

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
Establish
MVP
BrianKasingli
MVP

Likes

613 likes

Total Posts

590 posts

Correct Reply

231 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

613 likes

Total Posts

590 posts

Correct Reply

231 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
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)