Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

AEM 6.5 custom tag library

Avatar

Level 4

I am working on an upgrade from AEM 6.2 to AEM 6.5. I am also moving from a very old archetype to the newer archetype 40 with profiles so that the build and deploy may be automated instead of a lot of manual steps that are now being used.

I am having problems with the JSP files that include some custom tag libraries. Using the older pom files, the tag libraries seem to be being resolved, I'm guessing is that the TLD files are being deployed but I can't find them in the instance so I know where to install them. The taglib uri is not being resolved but is not a problem in the older archetype's install.

What do I need to do to get the custom TLD files to be installed or referenced by the JSP using them?

5 Replies

Avatar

Employee

Here are some steps you can take to resolve the issue:

  1. Check TLD Deployment: First, ensure that the custom TLD files are included in your project's deployment package. Verify that the TLD files are being copied to the appropriate location within the deployed AEM application.

  2. TLD Deployment Location: By default, custom TLD files should be placed in the /META-INF directory of your bundle. Make sure that your project structure is set up correctly to include the TLD files in the appropriate location.

  3. Check the Bundle Contents: After deploying your application to AEM 6.5, you can check the contents of the deployed bundle to see if the TLD files are present. You can do this by exploring the installed bundles in AEM's Web Console (http://localhost:4502/system/console/bundles) or by directly examining the contents of the deployed bundle in the crx-quickstart/launchpad/felix/bundle directory of your AEM instance.

  4. Check OSGi Configuration: If the TLD files are present in the bundle but not being resolved, it's possible that the OSGi bundle containing the TLD files is not active or not configured correctly. Check the OSGi configuration and ensure that the bundle containing the custom TLD files is active and has its dependencies resolved.

  5. Bundle Order: Check the order in which the bundles are started. If the bundle containing the TLD files depends on other bundles, ensure that those dependencies are resolved before the bundle with the TLD files starts.

  6. Bundle Export-Package: Verify that the packages containing the TLD files are properly exported by the OSGi bundle that contains them. If necessary, add the appropriate package exports to the bundle's manifest file.

Avatar

Level 4

So some questions.

1. For 6.5, where and how is the correct location?

2. I've seen documentation where the TLD files should be in /WEB-INF/tags. Is this correct or should they just be in the root?

3. The system console for bundles doesn't show the content in /WEB-INF. I can have the jar app tell me what the contents are and I can see them in there.

4. The bundle is active. What configuration needs to be done?

5. By the exports, are you just talking about the class files or the TLD as well?

 

I'm just having a hard time finding current documentation on this. Not sure what terms I should be using to get documentation for 6.5 instead of very old documents.

Avatar

Level 4

The taglibs are in the bundle under /META-INF/[tld file name]. I see the file there in the manifest in the /system/console/bundle page and when I run jar tvf [bundle name] then I see the files there and the correct byte size in the bundle. The JSP is still unable to discover the configuration. 

One caveat is that the JSP for the page is in a different bundle from the taglib classes and definition files. Should that matter?

Avatar

Level 4

I have the TLD files both under /META-INF/ and /META-INF/tags in the package that contains the supporting Java classes. The bundle is active, I can get a listing of the files in the bundle and I see the TLD files in the bundle under the /META-INF and /META-INF/tags folders. Still the URI is not resolving when the JSP is being compiled.

Avatar

Administrator

@RobertHarperFS If you have successfully found a solution on your own, we kindly ask that you share it with the community for future reference and mark it as the correct answer.



Kautuk Sahni