Expand my Community achievements bar.

SOLVED

Unable to load tag handler class

Avatar

Level 6

Hi all.

 

Our custom tag stops working after upgrading from AEM 6.0 to AEM 6.5.0. We are using tldgen library(https://github.com/icoloma/tldgen). 

Here is our pom.xml in 6.0

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-javadoc-plugin</artifactId>

<version>2.6.1</version>

<configuration>

<includes>

<include>**</include>

</includes>

<doclet>org.tldgen.TldDoclet</doclet>

<docletArtifacts>

<docletArtifact>

<groupId>org.extrema-sistemas</groupId>

<artifactId>tldgen</artifactId>

<version>1.3</version>

</docletArtifact>

</docletArtifacts>

<show>private</show>

<additionalparam>

-htmlFolder ${basedir}/target/docs

-tldFolder ${basedir}/src/main/resources/META-INF

-license NONE

</additionalparam>

<useStandardDocletOptions>true</useStandardDocletOptions>

<author>false</author>

<encoding>utf-8</encoding>

</configuration>

<executions>

<execution>

<phase>generate-resources</phase>                                       

<goals>

<goal>javadoc</goal>

</goals>

</execution>

</executions>

</plugin>

In bundle/pom.xml

<dependency>

            <groupId>org.extrema-sistemas</groupId>

            <artifactId>tldgen</artifactId>

            <version>1.3.1</version>

            <scope>compile</scope>

        </dependency>

It has been working perfectly. When upgrading to 6.5, we add the plugin and dependency in both pom.xml and core/pom.xml respectively. `mvn clean install` works fine. 

 

Now we are getting 

Unable to load tag handler class "edu.nyu.tisch.aem.core.tags.BeanloaderTag" for tag "tisch:bean"

Our edu.nyu.tisch.nyu.core.tags package-info.java:

@org.tldgen.annotations.Library(uri="http://tisch.nyu.edu/jsp/tisch", shortName="tisch")

@version("1.0")

package edu.nyu.tisch.aem.core.tags;

import org.osgi.annotation.versioning.Version;

The 6.0 package-info.java is

@org.tldgen.annotations.Library(uri="http://tisch.nyu.edu/jsp/tisch", shortName="tisch")

package edu.nyu.tisch.aem.core.tags;

This is due to the annotation changes.

 

edu.nyu.tisch.aem.core.tags.BeanloaderTag.java:

package edu.nyu.tisch.aem.core.tags;

// some other imports here...

import org.tldgen.annotations.Tag;

import org.tldgen.annotations.BodyContent;

import org.tldgen.annotations.Attribute;

@TaG(name="bean", bodyContent=BodyContent.SCRIPTLESS)

public class BeanLoaderTag extends SimpleTagSupport {

   // other code here...    

 @Override

  public void doTag() throws JspException, java.io.IOException {

       // implementation here

  }

}

 

The .tld file:

<taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" version="2.0">

    <tlib-version>2.0</tlib-version>

    <short-name>tisch</short-name>

    <uri>http://tisch.nyu.edu/jsp/tisch</uri>

    <tag>

        <description>Tag that initializes a bean based on a number of parameters.</description>

        <name>bean</name>

        <tag-class>edu.nyu.tisch.aem.core.tags.BeanloaderTag</tag-class>

        <body-content>scriptless</body-content>

        <!-- other content below -->

The code causing the error:

<%@taglib prefix="tisch" uri="http://tisch.nyu.edu/jsp/tisch" %>

<tisch:bean var="p" resourceType="tisch/components/pages/base" scope="request" />

 

The code is running fine on AEM 6.0, but not AEM 6.5. I have been trying to isolate each section in order to identify the problem. The /system/console can find the package edu.nyu.tisch.aem.core.tags, bundle is active. Any help will be really appreciated!

 

-kt

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@kevingtan Can you please check if the uri needs to be changed? Something like below

<%@taglib prefix="tisch" uri="http://tisch.nyu.edu/bundles/core/tags"%>

Also, do can you add more information on error log?

I have seen usage of https://mvnrepository.com/artifact/com.day.cq.wcm/cq-wcm-taglib/5.7.4 in pom but not what you have shown.

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

@kevingtan Can you please check if the uri needs to be changed? Something like below

<%@taglib prefix="tisch" uri="http://tisch.nyu.edu/bundles/core/tags"%>

Also, do can you add more information on error log?

I have seen usage of https://mvnrepository.com/artifact/com.day.cq.wcm/cq-wcm-taglib/5.7.4 in pom but not what you have shown.

Avatar

Level 6

Hi @Shubham_borole ,

 

Really appreciate your help. I just did that, got the same error message. 

But I did something else interesting. I created a new class 'MyBeanLoader', copied the code from the old class to the new one, renamed the uri value to what you suggested in jsp and .tld. The error is gone. 

 

I am crossing my fingers that won't come back. Thanks a lot!

 

kt