We've moved all our custom tag files from the main application to a new project with the plan to reuse them in different contexts/simplify the development process.
We've packed all the files inside the META-INF/tags class. To access the tags we've written a TLD file where all the tags are referenced. The tags have not been changed from the original ones.
All the JSP pages have been updated to use the URI instead or the tagdir to reference our custom tag files.
Everything works, most of the times. Most of the times because sometimes, for tags that are widely used in other JSP pages, the rendering step gives up with the exception "ClassDefNotFound". The problem is that the class should exist, and indeed it exists, because on the same page the same tag is rendered.
The only difference between working pages and not working page is the last ones load all this elements using AJAX calls.
There's some kind of caching that could cause this strange behavior? We're using jboss 4.2.3.
Months later I've found the guilty.
It is how is defined the JspServlet in the server where the application is running.
Indeed, changing the values of development (default is TRUE) or reducing the checks for changes (hence giving more time between a recompilation of the tag) augmenting the value of modificationTestInterval (default is 4) gives more time to compile the same tag and the whole page is generated.
The problem was with just some pages that were using the same tag a lot of times (up to 20, or more). With the new values the errors are disappeared because now the servlet has always enough time to generate the whole page without triggering a new compilation.
Anyway, why this was working for the embedded tags (defined inside the web application) while failing for the externalized ones (defined in another JAR) is still unknown.