On DD4T Java version2, component link(dynamic linking) in rich text field(format area) doesn't resolved.

On rich text field, link to component can be added by clicking "Hyperlink" button, then selecting "Component" on Type dropdownlist and select a component. Following code is added to richtext field.

<a href="tcm:6-109">link</a>

But following error occurs when publishing by DD4T TBB(Version of TBB is 2.0.2-beta.).

This Component is not a Multimedia Component: tcm:64-109

So I modified TBB source code,BinaryPublisher class, PublishBinariesInRichTextField method, not to publish components which are not multimedia component.

My modified source code is following.

  foreach (XmlElement elmt in xml.SelectNodes("//*[@xlink:href[starts-with(string(.),'tcm:')]]", xml.NamespaceManager))
                log.Debug("found node " + elmt.OuterXml);
                XmlAttribute link = (XmlAttribute)elmt.SelectSingleNode("@xlink:href", xml.NamespaceManager);

                log.Debug("this is not multimedia component, so skip:" + link.FirstChild.Value);

Now publishing succeed and following content is published.

<a xlink:href="tcm:6-109">link</a>

On WEB application server,there is a XSLT file "resolveXhtmlWithLinks.xslt". This XSLT seems to resolve component link, but it causes compile error, because a class "LinkResolverFactory" specified on variable element is not existing.

   <xsl:template match="*[@xlink:href]">
        <xsl:variable name="factory"
        <xsl:variable name="resolver"
        <xsl:variable name="resolved-link"
                      select="java:resolve($resolver, string(@xlink:href))"/>

I tried customize source code to make it work, but I couldn't.

What is "LinkResolverFactory"? Can I get it from somewhere? How can I make link to component in rich text field work?



It works by following customizations

Add "getInstance" method to DefaultLinkResolver

private static final DefaultLinkResolver INSTANCE = new DefaultLinkResolver();
public static final DefaultLinkResolver getInstance() {
    return INSTANCE;

Edit resolveXhtmlWithLinks.xslt.

<xsl:variable name="resolver"
    <xsl:variable name="resolved-link"
                  select="java:resolve($resolver, string(@xlink:href))"/>

In urlmapping.xml, add "factory-method" attribute to bean with id="LinkResolver".

<bean id="LinkResolver" class="org.dd4t.core.resolvers.impl.DefaultLinkResolver" factory-method="getInstance">

1 Answer 1


It appears this is a remnant of some other version; could you remove the factory declaration and try with the following:

<xsl:variable name="linkresolver" select="java:org.dd4t.core.processors.impl.DefaultLinkResolver.new()"/>
  • I could make it work by customizing some source code. I added customized code to my question. Commented Jul 30, 2015 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.