Unable to find taglib "c" for URI: /WEB-INF/view/module/legacyui/taglibs/c-rt.tld

I want to setup the reference application modules in my local environment. So, I downloaded the platform and the modules from here. When I start the server and hit http://localhost:8080/openmrs/ it gives me the below exception.

org.apache.jasper.JasperException: /WEB-INF/view/uncaughtException.jsp (line: 9, column: 0) Unable to find taglib "c" for URI: /WEB-INF/view/module/legacyui/taglibs/c-rt.tld
	org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41)
	org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:291)
	org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:97)
	org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:348)
	org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:381)
	org.apache.jasper.compiler.Parser.parseDirective(Parser.java:484)
	org.apache.jasper.compiler.Parser.parseElements(Parser.java:1448)
	org.apache.jasper.compiler.Parser.parse(Parser.java:145)
	org.apache.jasper.compiler.ParserController.doParse(ParserController.java:244)
	org.apache.jasper.compiler.ParserController.parse(ParserController.java:105)

I have not mixed up the module versions. I just simply downloaded both the platform and the modules. The legacy-module which came with the bundle was legacyui-1.2.3.omod

Any help, guidance is much appreciated.

Regards, Jude Niroshan

1 Like

I cloned the legacy-ui and built it. Its version was legacyui-1.2.4-SNAPSHOT.omod

I copied the .omod to my %AppData%\modules folder and restarted the Tomcat. It worked. Problem seems to be like at the initial loading of my Tomcat server, it didn’t identified taglib file… :slight_smile:

The problem has nothing to do with the bundled legacyui module. You can confirm this by reverting to it instead of the new one and you will see that all is well. It is just that you left IRC without pinging me but i was about to tell you that the answer was simply a restart of tomcat. :slight_smile:

3 Likes

Could you expound on the reason for the need to restart tomcat if possible? I am the kind who loves to understand the intricacies of systems.

Thank you in advance.

I have never got the time to figure out why. :slight_smile:

1 Like

Hi,

There is an article here https://wiki.apache.org/tomcat/HowTo/FasterStartUp that discusses the taglib scanning that may be relevant depending on which version of Tomcat you are using:

"A note on TLD scanning: In Tomcat 7 and earlier the TLD scanning happens twice,

first, at startup time, to discover listeners declared in tld files (done by TldConfig class), second, by JSP engine when generating java code for a JSP page (done by TldLocationsCache)."

In later versions (>7), the second scan is not performed which is why, after the modules are extracted into the webapp’s WEB-INF/view/module directory, a second scan is required.

I stand to be corrected but that I believe is the reason why.

Cheers,

Ben

2 Likes

Thanks @benb123 for taking your precious time to explain this. :slight_smile:

Would it mean that the problem should not happen if running tomcat 7?

Using Tomcat 8.5 I ran into this issue but works ok when I downgrade to Tomcat 7.

Thanks.

I know this is 3 years later at this point, but I just want to say thanks to @benb123 for the insights in his post, as the changes to how Tomcat loads TLDs in Tomcat 8+ does appear to be the cause of this issue.

Basically, in Tomcat 8+, Taglibs are scanned at startup at a time that pre-dates the OpenMRS startup process that unpacks module TLDs into WEB-INF/view/<module_id>/<path-to-tld>.tld, and no further TLD scanning is done (which is different from the behavior in Tomcat 7, which scanned for TLDs at the time a JSP page is compiled as well).

We are working on a fix for this, which is being tracked in [LUI-169] - OpenMRS Issues .

There is another related post here, that I’m referencing just to cross-reference these topics.