geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Boynes <jboy...@apache.org>
Subject Re: servlet mapping in web.xml
Date Sat, 13 Aug 2005 17:30:02 GMT
The servlet-mapping element should follow the servlet one e.g.

<web-app
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

      <servlet>
        <servlet-name>HolaMundo</servlet-name>
        <servlet-class>classes.HolaMundo</servlet-class>
        <init-param>
          <param-name>parametro1</param-name>
          <param-value>300</param-value>
        </init-param>
      </servlet>

      <servlet-mapping>
        <servlet-name>HolaMundo</servlet-name>
        <url-pattern>/servlet/HolaMundo</url-pattern>
      </servlet-mapping>
    </web-app>

IƱigo wrote:
> Hello everybody as this is my first post on this list:
>    I am trying to deploy a very simple web application. There is a JSP 
> that calls a Servlet. I have created the war file with ant, and wen I 
> try to deploy it I get this message:
> 
> C:\geronimo-1.0-M4>java -jar bin\deployer.jar --user system --password 
> manager deploy ../HolaMundo/dist/holamundo.war
>    Error: Unable to distribute holamundo.war: Error parsing web.xml
>    caused by Invalid deployment descriptor: [error: Element not
>    allowed: servlet-mapping@http://java.sun.com/xml/ns/j2ee in element
>    servlet@http://java.sun.com/xml/ns/j2ee]
> 
>    Descriptor: <web-app
>    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
>    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"
>    xmlns="http://java.sun.com/xml/ns/j2ee"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> 
>      <servlet>
> 
>        <servlet-name>HolaMundo</servlet-name>
> 
>        <servlet-class>classes.HolaMundo</servlet-class>
> 
>        <init-param>
> 
>          <param-name>parametro1</param-name>
> 
>          <param-value>300</param-value>
> 
>        </init-param>
> 
>        <servlet-mapping>
> 
>          <servlet-name>HolaMundo</servlet-name>
> 
>          <url-pattern>/servlet/HolaMundo</url-pattern>
> 
>        </servlet-mapping>
> 
>      </servlet>
> 
>    </web-app>
> 
> The web.xml deployment descriptor is this:
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
> version="2.4">
> <servlet>
>    <servlet-name> HolaMundo </servlet-name>
>    <servlet-class> classes.HolaMundo </servlet-class>
>    <init-param>
>        <param-name>parametro1</param-name>
>        <param-value>300</param-value>
>    </init-param>
>    <servlet-mapping>
>        <servlet-name>HolaMundo</servlet-name>
>        <url-pattern>/servlet/HolaMundo</url-pattern>
>    </servlet-mapping>
> </servlet>
> </web-app>
> 
> Thanks in advance for the answers.
> 
> 


Mime
View raw message