Web.xml help

hello people, i seem to have a hard time finding a listing of what you can put in the web.xml file. Is this a sun governed thing or can any application server create a layout as to there choosing? as an example i use tomcat for personal use but am trying to figure out websphere 5.1 for work.
can someone point me in the proper direction to look up these specs. i'm tired of trying to find this stuff on ibms site.
thanks in advance, graeme.

Well the DTD is available here: http://java.sun.com/dtd/web-app_2_3.dtd
It specifies the content and ordering of the standard web.xml.
Order DOES matter
<!ELEMENT web-app (icon?, display-name?, description?, distributable?,
context-param*, filter*, filter-mapping*, listener*, servlet*,
servlet-mapping*, session-config?, mime-mapping*, welcome-file-list?,
error-page*, taglib*, resource-env-ref*, resource-ref*, security-constraint*,
login-config?, security-role*, env-entry*, ejb-ref*,  ejb-local-ref*)>

Similar Messages

  • Weblogic refuses my web.xml - help ! ! !

              Hi all,
              I'm trying to deploy on weblogic a war file that
              I'm built with Tomcat. I get a parse exception when
              it comes across servlets declaration:
              Mon Jul 16 11:08:33 GMT+02:00 2001:<E> <HTTP> Error parsing descriptor in Web
              aplication 'c:/weblogic/myserver/tomcat.war'
              org.xml.sax.SAXParseException: Element "web-app" does not allow "servlet" here.
              at com.sun.xml.parser.Parser.error(Parser.java:2775)
              at com.sun.xml.parser.ValidatingParser$ChildrenValidator.consume(Valida
              ingParser.java:310)
              at com.sun.xml.parser.Parser.maybeElement(Parser.java:1280)
              at com.sun.xml.parser.Parser.content(Parser.java:1498)
              at com.sun.xml.parser.Parser.maybeElement(Parser.java:1399)
              at com.sun.xml.parser.Parser.parseInternal(Parser.java:491)
              at com.sun.xml.parser.Parser.parse(Parser.java:283)
              at weblogic.xml.dom.SunDOMParser.getDocument(SunDOMParser.java:69)
              at weblogic.xml.dom.DOMParser.getDocument(DOMParser.java:102)
              at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoade.java:132)
              My web.xml looks clean...here's a bit of it:
              <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 1.2//EN"
              "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
              <web-app>
              <servlet>
              <servlet-name>
              controller
              </servlet-name>
              <servlet-class>
              ServletController
              </servlet-class>
              </servlet>
              <servlet-mapping>
              <servlet-name>
              controller
              </servlet-name>
              <url-pattern>
              /Controller
              </url-pattern>
              </servlet-mapping>
              <servlet>
              <servlet-name>
              shopper
              </servlet-name>
              <servlet-class>
              ShopperServlet
              </servlet-class>
              </servlet>
              <servlet-mapping>
              <servlet-name>
              shopper
              </servlet-name>
              <url-pattern>
              /Shopper
              </url-pattern>
              </servlet-mapping>
              </web-app>
              Does anybody know how to solve this problem ?
              Thanks a lot in advance.
              Francesco
              

    you package it all into a WAR file (zip/jar format)
              read about it in the spec
              http://java.sun.com/products/servlet/download.html#specs
              the format is
              --WEB-INF
              web.xml
              -----classes
              -----lib
              or take a look at some sample war files
              Filip
              ~
              Namaste - I bow to the divine in you
              ~
              Filip Hanik
              Software Architect
              [email protected]
              www.filip.net
              "Francesco" <[email protected]> wrote in message
              news:[email protected]...
              >
              > Hi Filip,
              > thanks for your answer, now this problem is solved
              > and jsp pages are loaded but servlets not.
              > I'm developing under "myserver" folder: could you give me
              > a hint about where should I put
              > 1) "web.xml"
              > 2) servlets classes ?
              >
              > Thanks
              > Francesco
              >
              >
              >
              > "Filip Hanik" <[email protected]> wrote:
              > >try this one instead (define all <servlet> elements first, and then
              define
              > >the <servlet-mapping> elements
              > >
              > > <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
              > >1.2//EN"
              > > "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
              > >
              > > <web-app>
              > >
              > > <servlet>
              > > <servlet-name>
              > > controller
              > > </servlet-name>
              > > <servlet-class>
              > > ServletController
              > > </servlet-class>
              > > </servlet>
              > >
              > > <servlet>
              > > <servlet-name>
              > > shopper
              > > </servlet-name>
              > > <servlet-class>
              > > ShopperServlet
              > > </servlet-class>
              > > </servlet>
              > >
              > > <servlet-mapping>
              > > <servlet-name>
              > > controller
              > > </servlet-name>
              > > <url-pattern>
              > > /Controller
              > > </url-pattern>
              > > </servlet-mapping>
              > >
              > >
              > > <servlet-mapping>
              > > <servlet-name>
              > > shopper
              > > </servlet-name>
              > > <url-pattern>
              > > /Shopper
              > > </url-pattern>
              > > </servlet-mapping>
              > >
              > > </web-app>
              > >--
              > >~
              > >Namaste - I bow to the divine in you
              > >~
              > >Filip Hanik
              > >Software Architect
              > >[email protected]
              > >www.filip.net
              > >"Francesco" <[email protected]> wrote in message
              > >news:[email protected]...
              > >>
              > >> Hi all,
              > >> I'm trying to deploy on weblogic a war file that
              > >> I'm built with Tomcat. I get a parse exception when
              > >> it comes across servlets declaration:
              > >>
              > >> Mon Jul 16 11:08:33 GMT+02:00 2001:<E> <HTTP> Error parsing descriptor
              > >in
              > >Web
              > >> aplication 'c:/weblogic/myserver/tomcat.war'
              > >> org.xml.sax.SAXParseException: Element "web-app" does not allow
              "servlet"
              > >here.
              > >> at com.sun.xml.parser.Parser.error(Parser.java:2775)
              > >> at
              > >com.sun.xml.parser.ValidatingParser$ChildrenValidator.consume(Valida
              > >> ingParser.java:310)
              > >> at com.sun.xml.parser.Parser.maybeElement(Parser.java:1280)
              > >> at com.sun.xml.parser.Parser.content(Parser.java:1498)
              > >> at com.sun.xml.parser.Parser.maybeElement(Parser.java:1399)
              > >> at com.sun.xml.parser.Parser.parseInternal(Parser.java:491)
              > >> at com.sun.xml.parser.Parser.parse(Parser.java:283)
              > >> at
              weblogic.xml.dom.SunDOMParser.getDocument(SunDOMParser.java:69)
              > >> at weblogic.xml.dom.DOMParser.getDocument(DOMParser.java:102)
              > >> at
              >
              >weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoade.java:1
              3
              > >2)
              > >>
              > >>
              > >> My web.xml looks clean...here's a bit of it:
              > >>
              > >> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
              Application
              > >1.2//EN"
              > >> "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
              > >>
              > >> <web-app>
              > >>
              > >> <servlet>
              > >> <servlet-name>
              > >> controller
              > >> </servlet-name>
              > >> <servlet-class>
              > >> ServletController
              > >> </servlet-class>
              > >> </servlet>
              > >>
              > >> <servlet-mapping>
              > >> <servlet-name>
              > >> controller
              > >> </servlet-name>
              > >> <url-pattern>
              > >> /Controller
              > >> </url-pattern>
              > >> </servlet-mapping>
              > >>
              > >> <servlet>
              > >> <servlet-name>
              > >> shopper
              > >> </servlet-name>
              > >> <servlet-class>
              > >> ShopperServlet
              > >> </servlet-class>
              > >> </servlet>
              > >>
              > >> <servlet-mapping>
              > >> <servlet-name>
              > >> shopper
              > >> </servlet-name>
              > >> <url-pattern>
              > >> /Shopper
              > >> </url-pattern>
              > >> </servlet-mapping>
              > >>
              > >> </web-app>
              > >>
              > >> Does anybody know how to solve this problem ?
              > >> Thanks a lot in advance.
              > >> Francesco
              > >>
              > >
              > >
              >
              

  • SessionListener and web.xml help

    Hello everyone.
    I'm having trouble getting a sessionListener to work in a tomcat3.1 environment.
    Everything works okay in my win2k developer setup.
    Here's the web.xml file I am using:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'>
    <web-app>
    <display-name>slp</display-name>
    <description> sessionlistener problem </description>
    <listener>
    <listener-class>headrunner.listeners.HRSessionListener</listener-class>
    </listener>
    <context-param>
    <param-name>test value</param-name>
    <param-value>hello</param-value>
    </context-param>
    <context-param>
    <param-name>test value2</param-name>
    <param-value>hello</param-value>
    </context-param>
    <servlet>
    <servlet-name>hr/servlet-name>
    <display-name>hr</display-name>
    <servlet-class>hr</servlet-class>
    </servlet>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    </web-app>
    Could it be that the sessionlistener is inside a package?, or the order of the components in the web.xml ?
    Has anyone got a working web.xml file with the setup of a session-listener?
    Thanks in advance for any feedback

    The SessionListener interface is part of the 2.3 Servlet API. I may be wrong, but I believe Tomcat 4+ is required to run the 2.3 API.

  • Basic authen and web.xml help

    I'm having a few problems getting BASIC authentication working with 2 user groups. I want to restrict /admin/ to administrators and /profile/ to users and administrators:
      <security-constraint>
              <web-resource-collection>
                   <web-resource-name>My App</web-resource-name>
                   <url-pattern>/admin/*</url-pattern>
              </web-resource-collection>
              <auth-constraint>
                   <description>
                                                List of Administrators
                   </description>
                   <role-name>admin</role-name>
              </auth-constraint>
         </security-constraint>
      <security-constraint>
    <web-resource-collection>
                   <web-resource-name>My App</web-resource-name>
                   <url-pattern>/profile/*</url-pattern>
              </web-resource-collection>
              <auth-constraint>
                   <description>
                        List of members
                   </description>
                   <role-name>member</role-name>
              </auth-constraint>
      </security-constraint>
      <login-config>
              <auth-method>BASIC</auth-method>
              <realm-name>Restricted Area</realm-name>
         </login-config>
      <security-role>
              <description>list of members</description>
              <role-name>member</role-name>
      </security-role>
      <security-role>
              <description>list of administrators</description>
              <role-name>admin</role-name>
         </security-role>
         The problem is: I login with an admin account (inside the /admin/ dir) but i cant login into /profile/ with neither a user or administrator account. Any ideas?

    i'm guessing it can't be done?

  • Need help to set values from web.xml in a jsp class

    Hey :-)
    I`m trying to get value from my web.xml file into a jsp class. The problem is that the value always retur null. My web.xml file is replaced in the WEB-INF directory where should be. Here is my web.xml
    <servlet>
    <servlet-name>Html</servlet-name>
    <servlet-class>Html</servlet-class>
    <init-param>
    <param-name>html_test</param-name>
    <param-value>Value I want have in my jsp class
    </param-value>
    </init-param>
    </servlet>
    And her i my java class who don`t work:
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    import javax.servlet.ServletConfig;
    public class Html extends BodyTagSupport
    String title="";
    String html_test;
    ServletConfig config;
    public void doInitBody() throws JspException
    html_test = config.getInitParameter("html_test");
    }//End of method doInitBody()
    public int doStartTag() throws JspException
    try
    JspWriter out = pageContext.getOut();
    out.print( "<HTML>\n" );
    out.print( "<HEAD><TITLE>" + title + "</TITLE></HEAD>\n" );
    out.print( "<BODY>\n" );
    out.print( "<BR><H1>" + html_test + "</H1>" );
    And here are my html_test variable return null.
    I hope somone can help me, duke dollars will be given away for the solution answer.
    paulsep

    Nothing seems to work, have change the string and rewritten the web.xml file to:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
              <context-param>
                   <param-name>html_test</param-name>
                   <param-value>Value I want have in my jsp class</param-value>
              </context-param>
    </web-app>

  • Help needed in Mapping servlet in web.xml file

    Hi Can anyone please tell me what am doing wrong here. I can't see this servlet in my url. Please help.
    <servlet>
    <servlet-name>HelloWorld</servlet-name>
         <servlet-class>HelloWorld</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloWorld</servlet-name>
    <url-pattern>/com/jci/fi/application/eems/HelloWorld/*</url-pattern>
    </servlet-mapping>
    package com.jci.fi.application.eems;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class HelloWorld extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<html>");
    out.println("<body>");
    out.println("<head>");
    out.println("<title>Naveen Wants to goto TollyWood......!</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<h1>Hello World!</h1>");
    out.println("</body>");
    out.println("</html>");

    your web.xml shoould be something like this...
    <servlet>
    <servlet-name>HelloWorld</servlet-name>
    <servlet-class>com.jci.fi.application.eems.HelloWorld</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloWorld</servlet-name>
    <url-pattern>HelloWorld</url-pattern>
    </servlet-mapping>
    Hope this helps..
    CK

  • Success_URL in web.xml not working - Need help

    Hi:
    I developed my whole application in Jdeveloper 10.1.3.2 and all the security are done through custom module. Everything is working fine except one of the part that is success_url in web.xml.
    1. There are total 10 pages in my application independent of each other.
    2. I configured the custom login procedure and it is working fine.
    3. From Jdeveloper if I run any page (i.e. one of 10 pages) it is prompting me to login and after login it is redirecting to the page I ran.
    My issue is that after the login is completed as in step 3, I want the page to be redirected to predefined page called UserResp.jspx. I don't want to redirect to the page from where the login page was called. As per the notes in the ADF document, I configured the success_url in the adfAuthentication servlet as below. But after login it is not redirecting to the success_url but it is redirecting to the page from where the login was prompted.
    Do I need to perform any other step for this success_url to work. Could you please guide.
    Below is the details of my web.xml.
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <web-app 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" xmlns="http://java.sun.com/xml/ns/j2ee">
    <description>Empty web.xml file for Web Application</description>
    <context-param>
    <param-name>javax.faces.CONFIG_FILES</param-name>
    <param-value>/WEB-INF/efile-faces-config.xml</param-value>
    </context-param>
    <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
    </context-param>
    <context-param>
    <param-name>CpxFileName</param-name>
    <param-value>userinterface.DataBindings</param-value>
    </context-param>
    <context-param>
    <param-name>oracle.adf.view.faces.CHECK_FILE_MODIFICATION</param-name>
    <param-value>false</param-value>
    </context-param>
    <filter>
    <filter-name>adfFaces</filter-name>
    <filter-class>oracle.adf.view.faces.webapp.AdfFacesFilter</filter-class>
    </filter>
    <filter>
    <filter-name>adfBindings</filter-name>
    <filter-class>oracle.adf.model.servlet.ADFBindingFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>adfFaces</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <filter-mapping>
    <filter-name>adfBindings</filter-name>
    <url-pattern>*.jsp</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>adfBindings</filter-name>
    <url-pattern>*.jspx</url-pattern>
    </filter-mapping>
    <servlet>
    <servlet-name>adfAuthentication</servlet-name>
    <servlet-class>oracle.adf.share.security.authentication.AuthenticationServlet</servlet-class>
    <init-param>
    <param-name>success_url</param-name>
    <param-value>faces/app/user/UserResp.jspx</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>resources</servlet-name>
    <servlet-class>oracle.adf.view.faces.webapp.ResourceServlet</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>UploadMultiFileServlet</servlet-name>
    <servlet-class>oracle.apps.xxcust.servlet.UploadMultiFileServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>resources</servlet-name>
    <url-pattern>/adf/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>UploadMultiFileServlet</servlet-name>
    <url-pattern>/UploadMultiFileServlet</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>adfAuthentication</servlet-name>
    <url-pattern>/adfAuthentication/*</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>35</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <jsp-config/>
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>All Pages</web-resource-name>
    <url-pattern>faces/app/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name>ADMIN</role-name>
    <role-name>MANAGER</role-name>
    <role-name>USER</role-name>
    </auth-constraint>
    </security-constraint>
    <login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
    <form-login-page>/Login.jsp</form-login-page>
    <form-error-page>/Login.jsp</form-error-page>
    </form-login-config>
    </login-config>
    <security-role>
    <role-name>ADMIN</role-name>
    </security-role>
    <security-role>
    <role-name>MANAGER</role-name>
    </security-role>
    <security-role>
    <role-name>USER</role-name>
    </security-role>
    </web-app>

    Hi All:
    Thanks for all your help regarding the adfAuthentication success_url. Now I am able to configure to make this work. But now I am facing another issue i.e. I am getting 401 Not authorized message when the success_url is pointed to the jspx page.
    Note: I am using custom login module similar to DBProcOraDataSourceLoginModule so my roles are stored in the custom Role class. So I am not sure how to pass this role info to the security in ADF in order to authorize the page to be viewed.
    Could you please help and can you point me to any specific link.
    Thanks & Regards
    Sridhar Doki

  • Error web.xml  customized ..... Plz help

    Hi
    I would like to handle custom message on exception raised by web container such as 404.
    Will this code om mine work (coded in web.xml )
    Please some body help
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <error-page>
    <error-code>404</error-code>
    <location>/common/ErrorPage.jsp</location>
    <init-param>
         <param-name>NEWERROR</param-name>
         <param-value>NEWERRPGE</param-value>
    </init-param>
         <init-param>
         <param-name>VSERRNO</param-name>
         <param-value>pAGE UNDER CONSTRUCTION</param-value>
    </init-param>
    </error-page>Please some body help ASP
    with regards
    Karthik

    Hi
    I would like to handle custom message on exception raised by web container such as 404.
    Will this code om mine work (coded in web.xml )
    Although the Response was able to go to Error.jsp file,the params/values could not be retrieved.
    Please some body help
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <error-page>
    <error-code>404</error-code>
    <location>/common/ErrorPage.jsp</location>
    <init-param>
    <param-name>NEWERROR</param-name>
    <param-value>NEWERRPGE</param-value>
    </init-param>
    <init-param>
    <param-name>VSERRNO</param-name>
    <param-value>pAGE UNDER CONSTRUCTION</param-value>
    </init-param>
    </error-page>
    Please some body help ASP
    with regards
    Karthik

  • Help me out to specify driver in web.xml

    i am new programmer and i dont no where to specify driver in web.xml so that i ll get connection using datasource. i know the code in jsp but i dont no where and how to specify driver and under what tag.
    This is few steps which i know
    !>jsp side i know what to write ie
    Context ctx=new IntialContext();
    DataSource ds=(DataSource) ctx.lookup("java:comp/env/jdbc/test");
    Connection cn=ds.getConnection("umesh","umesh");
    2> what and where to write in web.xml
    3> i am going to control panel and in that obdc datasource i am going in system tab
    there i am adding oracle and DATASOURCE NAME as "test"
    is this will work or i have to write something in web.xml also
    thanks in advance
    help me out

    In addittion to following the steps as indicated by the above URL, make the context entries in the
    app_root/META-INF/context.xml file .
    As I encountered lots of probelms in settingup the JNDI datasource via server.xml or web.xml file
    To be precise , do follwoing:
    1. Make META-INF directory and add context.xml file to include following:
    <Context path="/app_name" docBase="app_name"
    debug="5" reloadable="true" crossContext="true">
    <Logger className="org.apache.catalina.logger.FileLogger"
    prefix="Test_log." suffix=".txt"
    timestamp="true"/>
    <Resource name="jdbc/yourDB"
    auth="Container"
    type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/yourDB">
    <parameter>
    <name>factory</name>
    <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    <!-- Maximum number of dB connections in pool. Make sure you
    configure your mysqld max_connections large enough to handle
    all of your db connections. Set to 0 for no limit.
    -->
    <parameter>
    <name>maxActive</name>
    <value>100</value>
    </parameter>
    <!-- Maximum number of idle dB connections to retain in pool.
    Set to 0 for no limit.
    -->
    <parameter>
    <name>maxIdle</name>
    <value>30</value>
    </parameter>
    <!-- Maximum time to wait for a dB connection to become available
    in ms, in this example 10 seconds. An Exception is thrown if
    this timeout is exceeded. Set to -1 to wait indefinitely.
    -->
    <parameter>
    <name>maxWait</name>
    <value>10000</value>
    </parameter>
    <!-- MySQL dB username and password for dB connections -->
    <parameter>
    <name>username</name>
    <value>dbuser</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>dbpwd</value>
    </parameter>
    <!-- Class name for the official MySQL Connector/J driver -->
    <parameter>
    <name>driverClassName</name>
    <value>com.mysql.jdbc.Driver</value>
    </parameter>
    <!-- The JDBC connection url for connecting to your MySQL dB.
    The autoReconnect=true argument to the url makes sure that the
    mm.mysql JDBC Driver will automatically reconnect if mysqld closed the
    connection. mysqld by default closes idle connections after 8 hours.
    -->
    <parameter>
    <name>url</name>
    <value>jdbc:mysql://localhost:3306/yourDB?autoReconnect=true</value>
    </parameter>
    </ResourceParams>
    </Context>
    2. In the web.xml include following:
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <display-name>Hello, World Application</display-name>
    <description>
         None </description>
    <description>
    Resource reference to a factory for java.sql.Connection
    instances that may be used for talking to a particular
    database that is configured in the server.xml file.
    </description>
    <resource-ref>
    <description> Database </description>
    <res-ref-name>jdbc/yourDB</res-ref-name>
    <res-ref-type>javax.sql.DataSource</res-ref-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </web-app>
    Try to make a war file for your application and deploy it using the Tomcat manager application..
    Asif

  • Help with web.xml and deploying a servlet

    Hello,
    I've been tearing me hair out for the last few hours trying to get this to work... I've got a servlet org.fatbaob.servtest.Servtest that I want to deploy with Tomcat 4.0.4. It doesn't seem to mater what I put in the web.xml file I'm always getting 404 errors.
    The servlet is contained in a file c:\development\projects\servtest\WEB_INF\classes\org\fatboab\servtest\Servtest
    which mapped with a <context> tag in the Tomcat conf\server.xml file:
    <!-- Servtest context -->
         <Context path="/servtest" docBase="C:\development\projects\servtest" debug="0" privileged="true" reloadable="true">
         <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_servtest_log." suffix=".txt" timestamp="true"/>
    </Context>
    My web.xml file contains:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <servlet>
    <servlet-name>ServTest</servlet-name>
    <servlet-class>org.fatboab.servtest.Servtest</servlet-class>
    </servlet>
    </web-app>
    Although I have tried putting in <servlet-mapping> tags, but they didn't seem to work either.
    My html file contains:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
    <title>Servlet Test</title>
    </head>
    <body>
    <h1>Servlet Test</h1>
    <form action="/servtest/servlet/org.fatboab.servtest.Servtest" method="post">
    <table>
    <tbody>
    <tr>
    <td>Name:</td>
    <td><input type="text" size="77" name="name" /></td>
    </tr>
    <tr>
    <td>Email:</td>
    <td><input type="text" size="77" name="email" /></td>
    </tr>
    <tr>
    <td colspan="2"><input type="submit" value="Submit" /></td>
    </tr>
    </tbody>
    </table>
    </form>
    </body>
    </html>
    The 404 error I get is:
    description The requested resource (/servtest/servlet/org.fatboab.servtest.Servtest) is not available.
    Help!
    Cheers,
    Bob.

    Hello,
    I've been tearing me hair out for the last few hours
    trying to get this to work... I've got a servlet
    org.fatbaob.servtest.Servtest that I want to deploy
    with Tomcat 4.0.4. It doesn't seem to mater what I put
    in the web.xml file I'm always getting 404 errors.
    The servlet is contained in a file
    c:\development\projects\servtest\WEB_INF\classes\org\fa
    boab\servtest\Servtest
    which mapped with a <context> tag in the Tomcat
    conf\server.xml file:
    <!-- Servtest context -->
    <Context path="/servtest"
    docBase="C:\development\projects\servtest" debug="0"
    privileged="true" reloadable="true">
    <Logger
    er className="org.apache.catalina.logger.FileLogger"
    prefix="localhost_servtest_log." suffix=".txt"
    timestamp="true"/>
    </Context>
    My web.xml file contains:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems,
    Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <servlet>
    <servlet-name>ServTest</servlet-name>
    <servlet-class>org.fatboab.servtest.Servtest</servlet-
    lass>
    </servlet>
    </web-app>
    Although I have tried putting in <servlet-mapping>
    tags, but they didn't seem to work either.
    My html file contains:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
    xml:lang="en">
    <head>
    <title>Servlet Test</title>
    </head>
    <body>
    <h1>Servlet Test</h1>
    <form
    action="/servtest/servlet/org.fatboab.servtest.Servtest
    method="post">
    <table>
    <tbody>
    <tr>
    <td>Name:</td>
    <td><input type="text" size="77" name="name"
    ="name" /></td>
    </tr>
    <tr>
    <td>Email:</td>
    <td><input type="text" size="77" name="email"
    "email" /></td>
    </tr>
    <tr>
    <td colspan="2"><input type="submit"
    submit" value="Submit" /></td>
    </tr>
    </tbody>
    </table>
    </form>
    </body>
    </html>
    The 404 error I get is:
    description The requested resource
    (/servtest/servlet/org.fatboab.servtest.Servtest) is
    not available.
    Help!
    Cheers,
    Bob.Bob,
    Here an servlet definition I have defined in my web.xml...just plug in your values.
    <servlet>
    <servlet-name>AutoUpload</servlet-name>
    <servlet-class>com.lendleaserei.webservices.AutoUpload</servlet-class>
    <display-name></display-name>
    <description></description>
    </servlet>
    <servlet-mapping>
    <url-pattern>/webs</url-pattern>
    <servlet-name>com.lendleaserei.webservices.AutoUpload</servlet-name>
    </servlet-mapping>
    Hope this helps,
    Marco

  • Help with web.xml under WL5.1sp3

    Hello,
    I just started to explore Weblogic Server 5.1sp3 as part
    of setting it up for the JASIG uPortal project here at UBC.
    I'm unable to get web.xml to work for me. I've created the
    file, I know WL is seeing it and parsing it (through various
    typos during the installation process) but when my index.jsp page
    runs, getInitParameter() comes back with nothing.
    Any ideas what I could be missing?
    Thanks
    George
    [email protected] ITServices, UBC
    Programmer/Analyst
    phone: 604.822.4375 fax: 604.822.5116

    Please post this to the weblogic.developer.interest.servlet
    thanks
    mbg
    In article <[email protected]>, [email protected] says...
    Hello,
    I just started to explore Weblogic Server 5.1sp3 as part
    of setting it up for the JASIG uPortal project here at UBC.
    I'm unable to get web.xml to work for me. I've created the
    file, I know WL is seeing it and parsing it (through various
    typos during the installation process) but when my index.jsp page
    runs, getInitParameter() comes back with nothing.
    Any ideas what I could be missing?
    Thanks
    George
    ==================================================
    NewsGroup Rant
    ==================================================
    Rant 1.
    The less info you provide about your problem means
    the less we can help you. Try to look at the
    problem from an external perspective and provide
    all the data necessary to put your problem in
    perspective.

  • Help required in depolying EAR file. web.xml file not recognised.

    Hi All,
    I have created EAR project using WAR. While I'm trying to deploy the EAR file using SDM tool of J2EE engine. I'm getting the following error: bold com.sap.engine.services.servlets_jsp.server.exceptions.WebDeploymentException: Web application [redirectForm] does not contain "/WEB-INF/web.xml" file or it is spelt incorrectly bold . I have checked the WAR file, it has web.xml file. Please tell me how to resolve this error?
    Thanks in advance
    Srikant

    Hi Srikant,
    check the directory entry in your war file if it is woth upper case i.e. WEB-INF
    Best regards
    Bojidar

  • Help on web.xml file, what if the parameters contains key words ?

    Hi:
    I am just wondering what should I do if I want to include key words suchs
    as <param> in web.xml file for a servlet config.
    Example:
    <servlet>
    <servlet-name>testServlet</servlet-name>
    <parameter>
    <param-name>some name</param-name>
    <param-value>some value</param-value>
    </parameter>
    </servlet>
    What should I do if I want to repleace 'some value' with '</param-value>some
    value' and still to prevent the engine to terminate parsing the param-value
    at the fake ending? Is there a standard way in XML to distanguish that?
    (in URL format it can be replaced %xx for some chars).
    ie,
    <param-value> </param-value>some value</param-value>
    where the second </param-value> is the real ending.
    Thank you!
    Gang

    Hi!
    You can use "& lt ;" and "& gt ;" xml entities for that. Or wrap text element in <![CDATA[...]]> section.
    Regards,
    Ignat.

  • Web.xml not working? help!

    Hi, I am able de deply correctly on tomcat, but on jboss 4 I have this problem:
    When I run my servlet from the browser it says that the resource is not avaible, without any exceptions on the console, it means that couldnt find the servlet to display. But the web.xml is inside the WEB-INF folder and is correctly done, I have reviewed and remaked it several times.
    Any idea of the problem, I am using windows XP.

    No, the port is okay, because in fact jboss is running, but the servlet is not loaded the mesasge on the web page is a message of the jboss. About the code give some time to post it.

  • Help! web.xml security without using WAR files

    I'm currently using the RDBMSRealm and URL ACL security for my app. I would like to use the web.xml descriptor for security so that I can specify login pages and such. We currently are not using WAR files. I've been having alot of trouble setting this up. Is there a way to use the RDBMS realm along with the web.xml security? It looks like it should work, but I can't seem to get it to function. How do I specify the regular document root as a webapp? I'm currently running WLS 5.1 with SP4. Thanks.

    The RDBMSRealm is just the authentication mechanism underneath WLS versus the
    web.xml of the WebApplication which describes all the access control for that WebApp.
    the later being scoped only to that WebApp.
    you don't need to deploy in a war file, you can expand the archive into an identical
    directory structure and then just point us towards the top level of that structure.
    see: http://www.weblogic.com/docs51/classdocs/webappguide.html
    .paul
    chris wrote:
    I'm currently using the RDBMSRealm and URL ACL security for my app. I would like to use the web.xml descriptor for security so that I can specify login pages and such. We currently are not using WAR files. I've been having alot of trouble setting this up. Is there a way to use the RDBMS realm along with the web.xml security? It looks like it should work, but I can't seem to get it to function. How do I specify the regular document root as a webapp? I'm currently running WLS 5.1 with SP4. Thanks.

Maybe you are looking for