problem using a WAR file with Weblogic 5.1 server - jsp call to

Discussions

Web tier: servlets, JSP, Web frameworks: problem using a WAR file with Weblogic 5.1 server - jsp call to


  1. hi,

    I am getting a 404 error when a jsp (inside the war) calls a servlet. I am using WL5.1 running on Windows. The application context is "ast" and the url called from the servlet is "http://localhost:7001/ast/SrvQuery"

    The Major point to be noted is that this servlet does get loaded by the server (a SOP in its init() is visible on the console) on startup. So the problem has to be in the url of the jsp, right? I've tried using "../ast/servlets/SrvQuery" and "../ast/packagename.SrvQuery" and ""http://localhost:7001/SrvQuery" but keep getting 404.
     
    I've checked and rechecked the classname given in web.xml and it is ok. (the servlets init() does get called, anyway, so it isnt as if weblogic cant find the class)
    I am not using <servlet-mapping> element of web.xml, and my war doesnt contain weblogic.xml at all (no ejbs/other resources present, so we dont need weblogic.xml, right?) The servlet contains only doPost, and POST is set for the jsp form as well..

    any ideas??
     
  2. Unless you want to call your servlet through the ServletSservlet, I think you need to add a <servlet-mapping> tag for your servlet, otherwise, the container doesn't know what URL maps to that servlet. Something like:
    <servlet-mapping>
      <servlet-name>[name given to your servlet when you registered it earlier]</servlet-name>
      <url-pattern>/SrvQuery</url-pattern>
    </servlet-mapping>

    You can then access the servlet via href="SrvQuery" from a .jsp in the same web application or with http://localhost:7001/ast/SrvQuery from outside.

    If what you're after is to invoke the servlet via its fully qualified name, i.e. packagname.SrvQuery, then you need to make sure that you've registered WebLogic's ServletServlet. Make sure this line appears in the weblogic.properties file uncommented out:

    weblogic.httpd.register.servlets=weblogic.servlet.ServletServlet

    HTH,

    Andy
  3. thnx Andy,

    but mapping does not make a difference, i tried it..
  4. hey,

    mapping "SrvQuery" url to "SrvQuery" servlet worked!!! (although Why its so is another question by itself!)

    please ignore earlier mail about it not working.

    thnx a lot Andy !_:)