tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "T. Park" <tp...@borland.com>
Subject Re: Parse Error in the tag library descriptor: Element "web-app" does not allow "servlet" here
Date Wed, 11 Apr 2001 19:30:01 GMT
Hi,

based on the web.xml dtd, the servlet-mappings cannot be followed by
servlets, order is important -
servlet mappings must follow servlets.    (though tomcat 3.2 relaxed
this rule)

Servlet 2.2  web application DTD extract:

<!ELEMENT web-app (icon?, display-name?,description?, distributable?,
context-param*,servlet*,
 servlet-mapping*,... >


you should do something like the following:

<web-app>
  <!-- servlets... -->
  <servlet> servlet 1... </servlet>
  <servet> servlet 2.. </servlet>

<!-- servlet mappings -->
  <servlet-mapping> mapping 1 </servlet-mapping>
  <servlet-mapping> mapping 2 </servlet-mapping>

</web-app>

Tomcat 3.2 didn't enforce this mapping rule, tomcat 4 does - can't
explain why Tomcat 3.1 is catching this though...


-Thom


Adrian Perju wrote:

> Hello,
>
> I am using jakarta tomcat 3.1 and stuts.
>
> I get this error
>
> org.apache.jasper.JasperException: Unable to open taglibrary /WEB-INF/struts.tld : Parse
Error in the tag library descriptor: Element "web-app" does not allow "servlet" here.
>         at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEventListener.java:672)
>         at org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingListener.java:116)
>         at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:215)
>         at org.apache.jasper.compiler.Parser.parse(Parser.java:1073)
>         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:182)
>         at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
>         at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:149)
>         at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:161)
>         at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
>         at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
>         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
>         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
>         at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
>         at java.lang.Thread.run(Thread.java:484)
>
>  when I try to acces a jsp page which has this lines:
>
> <%@ page language="java" %>
> <%@ taglib uri="/WEB-INF/struts.tld" prefix="struts" %>
> <%@ taglib uri="/WEB-INF/app.tld" prefix="app" %>
>
> ...
>
> My web.xml file is:
>
> ----------------------------------------------------
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <!DOCTYPE web-app
>   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
>   "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
>
> <web-app>
>
>   <!-- Database Initialization Servlet Configuration -->
>   <servlet>
>     <servlet-name>database</servlet-name>
>     <servlet-class>ro.necomm.sites.company.connection.LoadConnectionFactory</servlet-class>
>     <init-param>
>       <param-name>debug</param-name>
>       <param-value>2</param-value>
>     </init-param>
>     <load-on-startup>1</load-on-startup>
>   </servlet>
>
>   <!-- Action Servlet Configuration -->
>   <servlet>
>     <servlet-name>action</servlet-name>
>     <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
>     <init-param>
>       <param-name>application</param-name>
>       <param-value>ro.necomm.sites.company.ApplicationResources</param-value>
>     </init-param>
>     <init-param>
>       <param-name>config</param-name>
>       <param-value>/WEB-INF/action.xml</param-value>
>     </init-param>
>     <init-param>
>       <param-name>debug</param-name>
>       <param-value>2</param-value>
>     </init-param>
>     <init-param>
>       <param-name>detail</param-name>
>       <param-value>2</param-value>
>     </init-param>
>     <load-on-startup>2</load-on-startup>
>   </servlet>
>
>   <!-- Action Servlet Mapping -->
>   <servlet-mapping>
>     <servlet-name>action</servlet-name>
>     <url-pattern>*.do</url-pattern>
>   </servlet-mapping>
>
>   <!-- EMAIL Servlet Configuration -->
>   <servlet>
>     <servlet-name>emailForm</servlet-name>
>     <servlet-class>ro.necomm.util.EMailFormServlet</servlet-class>
>     <init-param>
>       <param-name>configFile</param-name>
>       <param-value>/Config/EMailFormServletConfig.properties</param-value>
>     </init-param>
>     <init-param>
>       <param-name>debug</param-name>
>       <param-value>2</param-value>
>     </init-param>
>     <init-param>
>       <param-name>detail</param-name>
>       <param-value>2</param-value>
>     </init-param>
>     <load-on-startup>3</load-on-startup>
>   </servlet>
>
>   <servlet-mapping>
>     <servlet-name>emailForm</servlet-name>
>     <url-pattern>/email</url-pattern>
>   </servlet-mapping>
>
>   <!-- The Welcome File List -->
>   <welcome-file-list>
>     <welcome-file>/zeelandia/admin.jsp</welcome-file>
>   </welcome-file-list>
>
>   <!-- Struts Tag Library Descriptor -->
>   <taglib>
>     <taglib-uri>/WEB-INF/struts.tld</taglib-uri>
>     <taglib-location>/WEB-INF/struts.tld</taglib-location>
>   </taglib>
>
>   <!-- Application Tag Library Descriptor -->
>   <taglib>
>     <taglib-uri>/WEB-INF/app.tld</taglib-uri>
>     <taglib-location>/WEB-INF/app.tld</taglib-location>
>   </taglib>
>
> </web-app>
>
> ----------------------------------------------------
>
>
>
> What is wrong in my web.xml? I ask this because everything was ok before.
>
> Thank you in advance,
>
> Adrian
>
--
http://www.borland.com/newsgroups
http://www.borland.com/devsupport/disclaim.html


Mime
View raw message