tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Justyna Horwat" <Justyna.Hor...@eng.sun.com>
Subject Re: error using taglib
Date Fri, 21 Jul 2000 20:36:59 GMT
The order of servlet elements is defined in the servlet specification.

http://java.sun.com/products/servlet/download.html

Chapter 13 talks about dtd's and gives some examples.

If you are familiar with dtd's you can take a look at the web.xml dtd
directly:

http://java.sun.com/j2ee/dtds/web-app_2_2.dtd

The structure of you web.xml file has to follow the rules defined in the
dtd. Order is important.

Without seeing your web.xml file I can't tell you what is wrong exactly
but I can give you an example that would cause the error like you're seeing.

In the dtd defined in the spec, the servlet element is defined as follows:

<!ELEMENT servlet (icon?, servlet-name, display-name?, description?,
(servlet-class|jsp-file), init-param*, load-on-startup?,
security-role-ref*)>

Here is what an incorrect servlet element could look like. Note that I
have <load-on-startup> coming before <init-param>. This is INCORRECT
and would cause the error that you see:

...
<servlet>
  <servlet-name>myservlet</servletname>
  <load-on-startup>1</load-on-startup>
  <init-partam>
    <param-name>myparam</param-name>
    <param-value>0</param-value>
  </init-param>
</servlet>
...

Make sure that the order of your elements is correct as specified in the
dtd.

Here's an FYI, Tomcat 3.1 does not use a validating parser when reading
the web.xml file. That is why you didn't see an error on start-up. When you
access the JSP page, the Jasper compiler reads the web.xml. It is the JSP
page compiler that uses a validating parser and reports an error if the
contents
are invalid.

Justyna
< horwat@eng.sun.com >

----- Original Message -----
From: "Fred R." <frahmanian@sourcetechcorp.com>
To: <taglibs-user@jakarta.apache.org>
Sent: Friday, July 21, 2000 11:54 AM
Subject: error using taglib


> I'm trying to use a taglib library that I've developed and I keep
> getting the follwoing error. The interesting thing is that if the
> web.xml has only the taglib tags I get no error and everything works
> fine. Any idea what could be wrong? I've been fighting this problem
> almost all day. Obviously the error message is not the indicator of the
> actual error here. I love tomcat, but in this case I wish it would give
> a more descriptive error.
>
> TIA.
> Fred R.
>
> org.apache.jasper.JasperException: Unable to open taglibrary /xxxtags :
> Parse Error in the tag library descriptor: Element "web-app" does not
> allow "init-param" here.
>         at
>
org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEve
ntListener.java,
> Compiled Code)
>         at
>
org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingList
ener.java:116)
>
>         at
> org.apache.jasper.compiler.Parser$Directive.accept(Parser.java, Compiled
> Code)
>         at org.apache.jasper.compiler.Parser.parse(Parser.java, Compiled
> Code)
>         at org.apache.jasper.compiler.Parser.parse(Parser.java:1038)
>         at org.apache.jasper.compiler.Parser.parse(Parser.java:1034)
>         at org.apache.jasper.compiler.Compiler.compile(Compiler.java,
> Compiled Code)
>         at
> org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
>         at
>
org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
rvlet.java:149)
>
>         at
>
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
va:161)
>
>         at
> org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
>
>         at org.apache.jasper.runtime.JspServlet.service(JspServlet.java,
> Compiled Code)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
> Compiled Code)
>         at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
>         at
>
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java,
> Compiled Code)
>         at
> org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java,
> Compiled Code)
>         at java.lang.Thread.run(Thread.java, Compiled Code)
>
>
>


Mime
View raw message