Servlet mappings in web.xml is not picking up propelry

Hi,
I am developing on java web application in Jdeveloper and trying to deploy in integrated wls.
i have one jsp page, and one java servlet. and added url-pattern and servlet mappings in web.xml, but when running the jsp, it is not picking up the servelt . I am getting the error saying 'The server has not found anything matching the Request-URI.'
Can you help me in fixing this issue.
Thanks in advance.

Hi,
I have one Test.html file under public_html folder, and in that html form action url is as below:
<form action="/servlet/testServlet" method="post">
.</form>
and my web.xml content is:
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
<servlet>
<display-name>TestServlet</display-name>
<servlet-name>TestServlet</servlet-name>
<servlet-class>oracle.apps.servlet.TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>/servlet/testServlet</url-pattern>
</servlet-mapping>
</web-app>
When i run the HTML page, the URL is : http://local:7101/Application1-Test-context-root/Test.html
and when click on button, its redirecting to http://local:7101/servlet/testServlet and getting the error saying that 'The server has not found anything matching the Request-URI' ideally it shuld redirect to http://local:7101/Application1-Test-context-root/servlet/testServlet.
let me know what could be the problem?

Similar Messages

  • Order of servlet mapping in web.xml

    Hello,
    is the order of multiple <servlet-mapping> in web.xml important? Or it doesn't matter in which order they are declared?
    For example, if i have two controllers, one is
    <servlet-name>Faces Servlet</servlet-name>
      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
    </servlet>
    and the second:
      <servlet>
        <servlet-name>FrontController</servlet-name>
        <servlet-class>servlets.FrontController</servlet-class>
      </servlet>
    and the mapping are:
       <servlet-mapping>
        <servlet-name>FrontController</servlet-name>
        <url-pattern>/jsf/*</url-pattern>
      </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
      </servlet-mapping>where /jsf/ contains jsp pages containing jsf components.
    is the order important?
    And may second question is:
    if i call the jsp page test.jsf in /jsf/test.jsp , which controller is responseble? Faces servlet or Frontcontroller?

    Here is what the 2.4 specification says on the matter (section SRV.11.1):
    >
    The path used for mapping to a servlet is the request URL from the request
    object minus the context path and the path parameters. The URL path mapping rules below are used in order. The first successful match is used with no further matches attempted:
    1. The container will try to find an exact match of the path of the request to the
    path of the servlet. A successful match selects the servlet.
    2. The container will recursively try to match the longest path-prefix. This is done by stepping down the path tree a directory at a time, using the �/� character as a path separator. The longest match determines the servlet selected.
    3. If the last segment in the URL path contains an extension (e.g. .jsp), the servlet container will try to match a servlet that handles requests for the extension. An extension is defined as the part of the last segment after the last �.� character.
    4. If neither of the previous three rules result in a servlet match, the container will attempt to serve content appropriate for the resource requested. If a "default" servlet is defined for the application, it will be used.
    The container must use case-sensitive string comparisons for matching.
    It also notes that in prior versions of the specification these were only a suggestion so if you are on servlet 2.3 or prior, you need to consult the documentation for your container.
    So, to answer your questions, no, order in the descriptor is not important.
    Also, based on the rules above, using your mappings, any URL starting with /jsf will be handled by FrontController including /jsf/test.jsp and /jsf/test.jsf.

  • exception-type in web.xml does not appear to work

    WLS 60 SP1 (#101616)
              <exception-type> in web.xml does not appear to work. WLS shows standard
              "Internal error 500" page instead of a custom error page. The custom error
              page is shown if <error-code> is used instead of <exception-type>.
              Any ideas? Thanks
              

    Can you show me some of your code? This works for me.
    Also, you say that you are working with 6.0sp3. Are you sure? sp3 hasn't been
    released yet, except in a very limited beta. (I believe only internally, but I
    could be wrong about that.)
    David
    [email protected] wrote:
    Hi all,
    I have created a very simple servlet and an index.html file with a link
    to it, then packaged it into a WAR file with the appropriate web.xml and
    ias-web.xml files. I then created an application.xml file referencing
    only this servlet and adding a context root. After deployment via
    "iasdeploy deployapp simple.ear" and cycling the web server, I can reach
    the welcome file (index.html) correctly
    -"http://localhost/NASApp/simple". When I attempt to follow the link to
    the servlet ("simple servlet") the URL ends
    up as "http://localhost/NASApp/SimpleServlet" whereas it should be
    http://localhost/NASApp/simple/SimpleServlet If I type that url in, the
    servlet executes fine.
    I've deployed this into Tomcat and get the behavior I expect. It appears
    that the element in the application.xml file is ignored by
    iAS.
    I'm using iAS SP3 on Win2k (same problem on NT).
    This is such a basic behavior that I can't believe this is an existing
    bug. I must be doing something wrong...
    Any ideas?
    Thanks in advance,
    -Glen
    Files are attached.
    Name: simple.ear
    simple.ear Type: application/x-unknown-content-type-ear_auto_file
    Encoding: base64
    Description: filename="simple.ear"

  • Do I must put ALL my servlets inside the web.xml file?

    Hello everybody,
    I am trying to migrate from Webshere to TOMCAT a project with severals packets, one of those have 15 servlets and some classes.
    Is there any way to use the servlets without have to declare each one inside the web.xlm file ?
    Thanks in advance.

    All servlet definitions go into web.xml, though not the actual servlets themselves :) . Say if you wanted servlet A to have a different mapping you would define the mapping in web.xml to something other than the standard one.

  • How to run java servlet without using Web.xml?

    How to run servlet without using Web.xml? From a book, I know that web.xml descriptor is optional, but the book doesn't tell us how to run java servelet without web.xm descriptor. So how to do that? Thanks a lot.

    How to run servlet without using Web.xml?But Tomcat now uses a web.xml for its global server-wide configuration.
    If you'd like to invoke a servlet with:
    http://host/servlet/ServletName
    you have to enable the invoker servlet.
    [from an HTML]
      <FORM METHOD="POST" ACTION="/servlet/HGrepSearchSJ">
    [from resin.conf of Resin Web Server 2.1.12]
      <!--
         - The "invoker" servlet invokes servlet classes from the URL.
         - /examples/basic/servlet/HelloServlet will start the HelloServlet
         - class.  In general, the invoker should only be used
         - for development, not on a deployment server, because it might
         - leave open security holes.
        -->
      <servlet-mapping url-pattern='/servlet/*' servlet-name='invoker'/>
    [from TOMCAT5.0.19/conf/web.xml, a global server-wide web.xml file]
      <!-- The "invoker" servlet, which executes anonymous servlet classes      -->
      <!-- that have not been defined in a web.xml file.  Traditionally, this   -->
      <!-- servlet is mapped to URL pattern "/servlet/*", but you can map it    -->
      <!-- to other patterns as well.  The extra path info portion of such a    -->
      <!-- request must be the fully qualified class name of a Java class that  -->
      <!-- implements Servlet (or extends HttpServlet), or the servlet name     -->
      <!-- of an existing servlet definition.     This servlet supports the     -->
      <!-- following initialization parameters (default values are in square    -->
      <!-- brackets):                                                           -->
      <!--                                                                      -->
      <!--   debug               Debugging detail level for messages logged     -->
      <!--                       by this servlet.  [0]                          -->
        <servlet>
            <servlet-name>invoker</servlet-name>
            <servlet-class>
              org.apache.catalina.servlets.InvokerServlet
            </servlet-class>
            <init-param>
                <param-name>debug</param-name>
                <param-value>0</param-value>
            </init-param>
            <load-on-startup>2</load-on-startup>
        </servlet>
    ---comment out below----------------------------------------------------------
        <!-- The mapping for the invoker servlet -->
    <!--
        <servlet-mapping>
            <servlet-name>invoker</servlet-name>
            <url-pattern>/servlet/*</url-pattern>
        </servlet-mapping>
    -->

  • Is there any alternative for adding servlet name in Web.xml?

    Hi,
    I am new to Weblogic and I have an application(Ear file) which was developed
    in Websphere and I am trying to install in weblogic 8.1. I have installed my application
    in Websphere without adding servlet entries in Web.xml and it was working fine.
    I have installed the same Ear file in Tomcat and added the
    following to make all my all servlets work.
    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
    Is there any alternative of doing like that in WebLogic instead of adding each
    and every servlet entry in web.xml because my application has around 200 servlets
    Thanks&Regards,
    Gopi.

    Is Servlet servlet same as weblogic.servlet.ServletServlet?
    Deepak
    Rob Woollen <[email protected]> wrote:
    Yes, you could register weblogic.servlet.ServletServlet.
    -- Rob
    Gopi Krishna wrote:
    Hi,
    I am new to Weblogic and I have an application(Ear file) whichwas developed
    in Websphere and I am trying to install in weblogic 8.1. I have installedmy application
    in Websphere without adding servlet entries in Web.xml and it was workingfine.
    I have installed the same Ear file in Tomcat and added the
    following to make all my all servlets work.
    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
    Is there any alternative of doing like that in WebLogic instead ofadding each
    and every servlet entry in web.xml because my application has around200 servlets
    Thanks&Regards,
    Gopi.

  • Weblogic.servlet.reloadCheckSecs in web.xml not working

    Given the following web.xml file:
              <!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>
              <context-param>
              <param-name>weblogic.servlet.reloadCheckSecs</param-name>
              <param-value>100</param-value>
              </context-param>
              <servlet>
              <servlet-name>CookieCounter</servlet-name>
              <servlet-class>servlets.CookieCounter</servlet-class>
              </servlet>
              <servlet-mapping>
              <servlet-name>CookieCounter</servlet-name>
              <url-pattern>monster</url-pattern>
              </servlet-mapping>
              <welcome-file-list>
              <welcome-file>hello.html</welcome-file>
              </welcome-file-list>
              <error-page>
              <error-code>404</error-code>
              <location>/error.jsp</location>
              </error-page>
              </web-app>
              It seems the weblogic.servlet.reloadCheckSecs property is not taking effect.
              The
              default value of -1 is always used. I did stop and restart weblogic.
              I also trid to set the servlet classpath in the web.xml file with
              weblogic.servlet.classpath
              property and it did not change the classpath for the servlet. It seems that
              other
              items are working such as adding new servletrs to the web application. Note
              that
              this is the cookie sample application that installes with the beta 2
              download.
              Thanks,
              Dan.
              

    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

  • Registered servlets in web.xml do not work....WHY????

    Hi i am executing a web application on tomcat 4.1.29 and have the following structure...the jsp pages are executed but when sendinga request to a servlet the servlets are not executed...Can somebody guide me out of this....
    webapps
    {MyApp}->[web-inf][jsp]
    {web-inf}->[classes][lib]
    {classes}->[com][src]
    {src}->[source files]
    when the source files are compiled package structure is followed and the class files are grneated in
    com.MyApp.servlets
    ...etc
    the servlets are registered in the web.xml file as shown below.....few lines of my web.xml file
    <servlet>
    <servlet-name>userServlet</servlet-name>
    <servlet-class>com.MyApp.servlets.UserServlet</servlet-class>
    </servlet>
    even then when accessing a servlet it says the resource not found
    The requested resource (/MyApp/servlet/UserServlet) is not available.
    am i missing something some where...why are the servlets not executed????

        <servlet>
            <servlet-name>UserServlet</servlet-name>
            <servlet-class>com.MyApp.servlets.UserServlet</servlet-class>
            <load-on-startup>2</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>UserServlet</servlet-name>
            <url-pattern>/User</url-pattern>
        </servlet-mapping>I'd invoke it with this URL:
    http://localhost:8080/MyApp/UserServlet
    hmm something seems to be wrong here ;-)
    URL should be
    http://localhost:8080/MyApp/User (see <url-pattern>)

  • Web.xml file not being read

    Hello, I did a quick search but could not find an answer to my specific problem. (this is also my first night tackling servlets) i hope this hasnt been answered before. here goes...
    i'm using Tomcat 4.1 and this is my file structure where i put my servlets:<intstall dir>/webappps/ROOT/WEB-INF/classes/TestPackage.
    this is my code for the servlet
    package TestPackage;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    /** Example using servlet initialization. Here the message
      * to print and the number of times the message should be
      * repeated is taken from the init parameters.
    public class ShowMessage extends HttpServlet
         private String message;
         private String defaultMessage = "No message.";
         private int repeats = 1;
         public void init(ServletConfig config) throws ServletException
              //Always call super.init
              super.init(config);
              message = config.getInitParameter("message");
              if (message == null)
                   message = defaultMessage;
              try
                   String repeatString = config.getInitParameter("repeats");
                   repeats = Integer.parseInt(repeatString);
              catch(NumberFormatException nfe)
                   //do nothing
         public void doGet(HttpServletRequest request, HttpServletResponse response) throws
                                            ServletException, IOException
              response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              String title = "The ShowMessage Servlet";
              out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
                               "Transitional//EN\">\n" +
                               "<HTML>\n" +
                             "<body bgcolor=\"#FDF5E6\">\n" +
                             "<h1 align=center>" + title + "</h1>");
              for(int i=0; i<repeats; i++)
                   out.println(message + "<br>");
              out.println("</body></html>");
    }my web.xml file is in <intstall dir>/webappps/ROOT/WEB-INF. it looks like:
    <?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>
      <display-name>Welcome to Tomcat</display-name>
      <description>
         Welcome to Tomcat
      </description>
      <servlet>
          <servlet-name>
            ShowMsg
          </servlet-name>
          <servlet-class>
            TestPackage.ShowMessage
          </servlet-class>
          <init-param>
            <param-name>
              message
            </param-name>
            <param-value>
              Shibboleth
            </param-value>
          </init-param>
          <init-param>
            <param-name>
              repeats
            </param-name>
            <param-value>
              5
            </param-value>
          </init-param>
      </servlet>
    </web-app>when i access the servlet i get "No message" one time which is the default message. Any ideas as to why its not picking up the init parameters. I've restarted my laptop and started and stopped Tomcat a few times and i always get the default message...i also tried ShowMessage in replace of ShowMsg as the <servlet-name>, to no avail. I also tried removing the package name in the <servlet-class>, still nothing. Is there another web.xml file some where else that i need to update?
    Thanks! (sorry for the long code)
    BB

    The doGet method works if you are sending data from a form using get method. It is better to use service method.

  • Web.xml mapping not working

    I have a servlet located at com.conversion.web called leftNavReader.java
    I'm trying to access this servlet on my localhost with the following URL: http://localhost:8080/Conversion/start
    but I keep getting this error:
    HTTP Status 404 - /Conversion/start
    type Status report
    message /Conversion/start
    description The requested resource (/Conversion/start) is not available.
    Here is what my web.xml looks like:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app>
         <display-name>DataConversionWeb</display-name>
         <servlet>
              <servlet-name>start</servlet-name>
              <display-name>Start</display-name>
              <servlet-class>com.conversion.web.leftNavReader</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>start</servlet-name>
              <url-pattern>/start</url-pattern>
         </servlet-mapping>
    </web-app>
    Does anyone have any idea why I'm getting this error?

    Since the spaces may cause problems and I have
    everything in the My Projects directory, I decide to
    just start from scratch. Very good.
    But... someone else
    installed eclipse for me and set that up, so I may
    need some help with that, not sure if you can help.As far as I know Eclipse can also be Unzipped to any folder, and
    theres a file called eclipse.exe , one would simply double click on that to invoke eclipse. I don't think you would have to re-install Eclipse.
    You could create a new project, and set
    C:\dev\projects\Conversion\ as your Eclipse Workspace .
    But lets put Eclipse on hold for now, we can still configure this whole project manually without Eclipse, which will help you understand what's going on under the hood. Also, in the beginning it's simpler to configure independent of the IDE.
    So I recommend that you save your work, uninstall
    Tomcat 6.0.x and re-install it on a path thatdoesn't
    have any spaces in it.
    For example:
    C:\dev\tomcat\ So I've uninstalled tomcat and re-installed in
    c:\dev\tomcat as recommended...Good, I assume that immediately under C:\dev\tomcat\ folder you see folders like bin, conf, webapps etc
    Assuming that Tomcat was Unzipped to the above
    folder. and there isn't another main folder underthe
    above folder, set you system envrionment variable
    CATALINA_HOME to the above folder.How do I do this?On MS Windows, click Start ---> Settings ----> Control Panel
    Look for System , --> Doubl Click on System -----> Click on the Advanced tab ----> then under the "System Variables" panel ------> Click on New button -------->
    in the Variable Name: type CATALINA_HOME
    in the Variable Value: type C:\dev\tomcat
    Then click Ok , that will set CATALINA_HOME to C:\dev\tomcat
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    There's a RUNNING.txt file under Tomcat's folderthat
    explains configuring it. Tomcat expects JAVA_HOMEto
    be set to your JDK's root folder . Again if JDK is
    installed on a path that has spaces then Irecommend
    installing it on a path with no spaces forexample:
    C:\dev\jdk\
    Similarly , follow the above steps to set JAVA_HOME to C:\dev\jdk
    Also, under System Variables you may see a variable called Path
    If it doesn't exist , then create a new one, if it already exists then add the following to the Path variable. (notice how the semi colon is used as a separater)
    ;%JAVA_HOME%/bin;%CATALINA_HOME%/bin;
    By setting the above you will be able to call
    java , javac and Tomcat's startup.bat and shutdown.bat from anywhere on the DOS Command line.
    >>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~I've moved the jdk to the director as recommended,
    but not sure hot to set the JAVA_HOME.See above...
    I haven't even gotten through the rest of your post
    yet, as I need to work on getting Eclipse set up
    again too Leave Eclipse for later ---- it will just complicate things for now.
    Once you have the project runnun under Tomcat we can figure out Eclipse.
    and I figure I might as well set up my
    "new" project using Virtual Hosts from the beginningLeave Virtual Host for later ------ it is easy to understand , I will explain it later , once you have the above basic set up running.
    and do this right... This is quite the learning
    experience ;)First , second and third time it is... but if you do this often, it will get much easier.

  • JDev 10.1.3 compile error in servlet 2.4 web.xml

    I built a Servlet 2.4/JSP 2.0 application in JDev 10.1.3. When I try to make/compile/deploy it the compiler gives me errors like the following for every JSP file that has a JSTL 1.1 taglib:
    Error(2,9): Element "web-app' used but not declared
    Error(2,63): Attribute 'xmlns:xsi' used but not declared
    Error(3,103): Attribute 'xsi:schemaLocation' used but not declared
    Error(4,16): Attribute 'version' used but not declared
    Error(4,56): Attribute 'xmlns' used but not declared
    Error(4,57): Can not build schema 'http://java.sun.com/xml/ns/j2ee' located at 'http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd'
    Error(5,15): Element 'description used but not declared
    It is obviously havng problems with the web.xml file (which is in the servlet 2.4 format) and is probably not finding the web.xml DTD document. How do I fix it?
    Installation is on Solaris 9 using J2SDK 1.4.2_04-b05
    By the way, this system is on a disconnected network. How do I get JDeveloper updates for a system not connected to the Internet?

    Allen,
    A JSP with web.xml web-app element
    <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">
    runs in JDeveloper 10.1.3
    thanks,
    Deepak

  • Init-params in web.xml are not loaded (Tomcat 4)

    Hello all...
    I register a servlet in webapps/<my-servlet>/WEB-INF/web.xml file, and pass 1 <init-param> tag. The file gets parsed (I know because when I made errors tomcat complained during initialization). However, when in the init method of the servlet I try to access this parameter, its not there. In fact, the servlet has NO init params at all.
    =================================================
    I have the following web.xml file
    <?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>XServlet</servlet-name>
    <servlet-class>com.fxcm.xml.xengine.xdas.XServlet</servlet-class>
    <init-param>
    <param-name>xengine.configFile</param-name>
    <param-value>c:/projects/re/das.config/config.xng</param-value>
    </init-param>
    </servlet>
    <servlet-mapping>
         <servlet-name>XServlet</servlet-name>
         <url-pattern>/xservlet</url-pattern>
    </servlet-mapping>
    </web-app>
    =======================================================
    I have the following servlet
    * XServlet.java
    * Created on May 6, 2002, 1:17 PM
    package com.fxcm.xml.xengine.xdas;
    import javax.servlet.*;
    import javax.servlet.http.HttpServlet;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.ServletConfig;
    import java.util.Enumeration;
    import com.fxcm.xml.xengine.XEngine;
    public class XServlet extends HttpServlet{
    /** Initiates new XServlet */
    public void init(ServletConfig config)
    throws ServletException
              for (Enumeration e = config.getInitParameterNames(); e.hasMoreElements();){
    //This statement never gets printed because the loop never enters here since there are no init parameters
                   System.out.println(e.nextElement());
    super.init(config);
    String str = config.getInitParameter("xengine.configFile");
    System.out.println(str);
    XEngine.init(str.trim()); //This line throws NullPointer, because str is null since there are no initParameters.
    public void doPost(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException{
    // res.setContentType( );
              System.out.println("Got post request in XServlet");
    PrintWriter out = res.getWriter();
    out.println(XEngine.process(req.getInputStream()));
    out.flush();
    out.close();
    ================================================================
    I get the follwoing error in the browser:
    type Exception report
    message Internal Server Error
    description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
    exception
    java.lang.NullPointerException
         at com.fxcm.xml.xengine.xdas.XServlet.init(Unknown Source)
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:918)
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:655)
         at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:400)
    Please help.
    Thank you,
    Elana

    I know what the problem is. If you call servlet with the default URL (http://host/app/servlet/package.Servlet) than Servlet DOES NOT read init parameters. I don't know why it was designed this way.
    To make servlet read init parameters, you have to assign it a name and then call it with that name, like this:
    <servlet>
    <servlet-name>ServletName</servlet-name>
    <servlet-class>package.ServletClass</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ServletName</servlet-name>
    <url-pattern>/app/path/ServletName</url-pattern>
    </servlet-mapping>
    You can then call servlet using path specified in url-pattern and read init parameters in the normal way.

  • Adding servlet entry in web.xml of j2ee engine

    Hi ,
    I want a servlet to be loaded on startup of the j2ee engine SAP WAS which is basically flex based (MessageBrokerServlet). 
    The init param for the servlet is not accessible or cannot be initialized in init method of the servlet using the servletconfig object.
    This is when the servlet is used as a portal component of type servlet.
    So as to load the servlet and the servlet being able to access the init param i would be changing the web.xml of the sap j2ee engine (NW CE 7.1). are there any other effects of the same or is it fine if i just add this param in the web.xml
        <servlet>
            <servlet-name>MessageBrokerServlet</servlet-name>
            <display-name>MessageBrokerServlet</display-name>
            <servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
            <init-param>
                <param-name>services.configuration.file</param-name>
                <param-value>/WEB-INF/flex/services-config.xml</param-value>
           </init-param>
            <load-on-startup>1</load-on-startup>
        </servlet>

    Hi ,
    Vivek in case my servlet is part of the Portal Application as PortalComponent how do i define init parameters  that can be accessed in the servlet.
    The config file would be accessed in the init method of the servlet how do i do that when the servlet is added as PortalComponent in PortalApplication. The servlet config file needs to accessed in t he init method.
    The load on startup thing would be taken care of by setting parameter startup = true of application properties.
    Regards
    Srikumar V

  • Servlet registration in web.xml with weblogic 5.1 sp10

    I've been developing this site using one "dispatch"
              servlet as my traffic cop for my framework. i now
              have to do this charting thing and i plan to
              stream in an image from a servlet. this means adding
              another servlet to the application. i've edited the
              web.xml according to the standerd and WL still pukes
              on startup saying
              "Error parsing descriptor in Web application
              'c:/workspace/com/somthing/'
              org.xml.sax.SAXParseException: Element "web-app" does
              not allow "servlet" here."
              below is my web.xml file...
              <?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>
              <description>
              blah blah
              </description>
              <servlet>
              <servlet-name>
              WebDispatcher
              </servlet-name>
              <servlet-class>
              com.somthing.somthin.WebDispatcher
              </servlet-class>
              </servlet>
              <servlet-mapping>
              <servlet-name>
              WebDispatcher
              </servlet-name>
              <url-pattern>
              /dispatch
              </url-pattern>
              </servlet-mapping>
              <servlet>
              <servlet-name>
              AssetChartServlet
              </servlet-name>
              <servlet-class>
              com.something.somthn.charts.ChartServlet
              </servlet-class>
              </servlet>
              <servlet-mapping>
              <servlet-name>
              ChartServlet
              </servlet-name>
              <url-pattern>
              /Chart
              </url-pattern>
              </servlet-mapping>
              some jsp tags
              </web-app>
              What am I doing wrong? Do I have to register the
              servlet in the weblogic.properties file? If so do I add the line
              weblogic.httpd.register.chart=com.somthing.somthin.charts.ChartServlet
              And the the (local)url would be http://localhost:7001/Chart ? And if
              this is the case where/how do I do the url mapping bit for this?
              Any help would be greatly appreciated.
              thanks,
              -Gabe
              

    To answer Mike's follow-up question, yes. From the DTD for the web.xml
              file:
              <!ELEMENT web-app (icon?, display-name?, description?, distributable?,
              context-param*, servlet*, servlet-mapping*, session-config?,
              mime-mapping*, welcome-file-list?, error-page*, taglib*,
              resource-ref*, security-constraint*, login-config?, security-role*,
              env-entry*, ejb-ref*)>
              The ordering of elements must be followed if they are specified in the DTD.
              Move your first <servlet-mapping> element to after the second <servlet>
              element and it should work just fine.
              -chris
              "Mike Reiche" <[email protected]> wrote in message
              news:[email protected]...
              >
              >
              >
              > Hmmm... do all the <servlet> </servlet> need to come before all the
              <servlet-mapping>
              > ?
              >
              > Mike
              >
              >
              > [email protected] (gabe) wrote:
              > >I've been developing this site using one "dispatch"
              > >servlet as my traffic cop for my framework. i now
              > >have to do this charting thing and i plan to
              > >stream in an image from a servlet. this means adding
              > >another servlet to the application. i've edited the
              > >web.xml according to the standerd and WL still pukes
              > >on startup saying
              > >
              > >"Error parsing descriptor in Web application
              > >'c:/workspace/com/somthing/'
              > >org.xml.sax.SAXParseException: Element "web-app" does
              > >not allow "servlet" here."
              > >
              > >below is my web.xml file...
              > >------------------------------
              > >
              > ><?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>
              > >
              > > <description>
              > > blah blah
              > > </description>
              > >
              > > <servlet>
              > > <servlet-name>
              > > WebDispatcher
              > > </servlet-name>
              > > <servlet-class>
              > > com.somthing.somthin.WebDispatcher
              > > </servlet-class>
              > > </servlet>
              > > <servlet-mapping>
              > > <servlet-name>
              > > WebDispatcher
              > > </servlet-name>
              > > <url-pattern>
              > > /dispatch
              > > </url-pattern>
              > > </servlet-mapping>
              > >
              > > <servlet>
              > > <servlet-name>
              > > AssetChartServlet
              > > </servlet-name>
              > > <servlet-class>
              > > com.something.somthn.charts.ChartServlet
              > > </servlet-class>
              > > </servlet>
              > > <servlet-mapping>
              > > <servlet-name>
              > > ChartServlet
              > > </servlet-name>
              > > <url-pattern>
              > > /Chart
              > > </url-pattern>
              > > </servlet-mapping>
              > >
              > > ...
              > > some jsp tags
              > > ...
              > >
              > ></web-app>
              > >---------------------------------
              > >What am I doing wrong? Do I have to register the
              > >servlet in the weblogic.properties file? If so do I add the line
              > >
              > >weblogic.httpd.register.chart=com.somthing.somthin.charts.ChartServlet
              > >
              > >And the the (local)url would be http://localhost:7001/Chart ? And if
              > >this is the case where/how do I do the url mapping bit for this?
              > >
              > >Any help would be greatly appreciated.
              > >
              > >thanks,
              > >
              > >-Gabe
              >
              

  • 404 file not found ,for servlets in a web app but not for html files

              Hi everybody ,I have this web app on weblogic 7 .The application
              works file with Tomcat 4.0 but on WebLogic server 7,I am getting
              404 not found for all the servlets ,although weblogic is serving
              the html files without any problems
              

    Create a subdirectory called 'classes' and copy your servlet class file
              to the 'classes' dir.
              mydomain/applications/
              DefaultWebApp/
              WEB-INF/classes.
              Modify the web.xml file located in the mydomain/applications/
              DefaultWebApp/
              WEB-INF/ directory
              <web-app>
              <servlet>
              <servlet-name>
              myServlet
              </servlet-name>
              <servlet-class>
              package.name.myServlet
              </servlet-class>
              </servlet>
              <servlet-mapping>
              <servlet-name>
              myServlet
              </servlet-name>
              <url-pattern>
              servlet-url-pattern
              </url-pattern>
              </servlet-mapping>
              </web-app>
              Start the default WebLogic Server.
              Call your servlet from a Web browser with the following URL:
              http://localhost:port/servlet-url-pattern
              servlet-url-pattern is the value of the <url-pattern> element that you
              defined in the web.xml file.
              prakash wrote:
              > Hi everybody ,I have this web app on weblogic 7 .The application
              > works file with Tomcat 4.0 but on WebLogic server 7,I am getting
              > 404 not found for all the servlets ,although weblogic is serving
              > the html files without any problems
              

Maybe you are looking for