You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Aaron Tavistock <aa...@geekshow.com> on 2000/05/05 22:47:17 UTC

taglibs reading web.xml instead of .tld?

I've had tomcat setup for a while and its worked fine, I've also created
a number of taglibs without problems.  Now after converting from 3.1b to
3.1, I have a weird problem with taglibs that I can't explain.   The
tomcat configuration have gone through some minor changes with the
version change, so I'm sure that I'm missing something in the taglib 
configurations...  

First the error --
JasperException: Unable to open taglibrary foo : Parse Error in the tag
library descriptor: Element "web-app" does not allow "context-param"
here.
<stack trace omitted>

Now keep in mind that the .tld has no references at all to either
"web-app" or "context-param".  It actually appears that the runtime
taglib stuff is reading web.xml as if it were a .tld.  So, the obvious
next question is about the configuration.

So I have a taglib package in that consists of two components, a
/WEB-INF/jsp/foo.tld and /WEB-INF/lib/foo.jar.  I've also got
appropriate lines in /WEB-INF/web.xml:

    <taglib>
        <taglib-uri>foo</taglib-uri>
        <taglib-location>/WEB-INF/jsp/foo.tld</taglib-location>
    </taglib>

The .tld file has not changed from a previously working version, so I'm
confident that it is not the tld (unless its permissons?).

Also, while I didn't seem to need to do this on earlier versions, 3.1
seems to like to have symlink from the actual directory into
$TOMCAT_HOME/webapps/foodir .

Finally, all JSP pages that do not use taglibs seem to work just fine. 
Information from the web.xml is accessible by the pages that work so I
know its reading the web.xml file properly (context-param information
shows up as initParameters in the ServletContext).

I've gone through everything with a fine tooth comb just short of
looking into the tomcat source (which will be my next step).  I've
checked the permissions on every file, gone back and forth over every
config file, and still no clue.  I was hoping that some here might have
some insight into whats going on.

Re: taglibs reading web.xml instead of .tld?

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Aaron Tavistock wrote:

> I've had tomcat setup for a while and its worked fine, I've also created
> a number of taglibs without problems.  Now after converting from 3.1b to
> 3.1, I have a weird problem with taglibs that I can't explain.   The
> tomcat configuration have gone through some minor changes with the
> version change, so I'm sure that I'm missing something in the taglib
> configurations...
>
> First the error --
> JasperException: Unable to open taglibrary foo : Parse Error in the tag
> library descriptor: Element "web-app" does not allow "context-param"
> here.
> <stack trace omitted>
>
> Now keep in mind that the .tld has no references at all to either
> "web-app" or "context-param".  It actually appears that the runtime
> taglib stuff is reading web.xml as if it were a .tld.  So, the obvious
> next question is about the configuration.
>

It is true that the /WEB-INF/web.xml file is being read.  But it's not being
read as a TLD -- instead, the JSP compiler is looking for your <taglib>
declarations so it can find where the TLDs really are.  It's also trying to
validate the XML against the DTD for the deployment descriptor, and is
finding something out of place (the <context-param> entry).  Check the order
of your web.xml entries against the DTD in the servlet spec.

Craig McClanahan



Re: taglibs reading web.xml instead of .tld?

Posted by Volker Turau <tu...@informatik.fh-wiesbaden.de>.
Hi,

I had the same problem. V 3.1 seems to make a strict validation of the
tld-file against the DTD. Make sure that the tags are in the right order. 
In my example an info tag was not in the riight position. It worked with V
3.1 beta. 


volker turau
FH Wiesbaden Fachbereich Informatik 
Tel.: +49-611-9495-205 FAX +49-611-9495-210
http://www.informatik.fh-wiesbaden.de/~turau