3 Replies Latest reply on Nov 26, 2002 7:49 AM by trishah

    serlvet deploy pass/servlet call failed

    seedling

      servlet code:

      import javax.servlet.*;
      import javax.servlet.http.*;
      import java.io.*;
      import java.util.*;

      public class TestingServlet extends HttpServlet {

      public void doGet(HttpServletRequest request,
      HttpServletResponse response)
      throws ServletException, IOException {

      PrintWriter out = response.getWriter();
      out.println("");
      out.println("");
      out.println("Servlet Testing");
      out.println("");
      out.println("");
      out.println("Welcome to the Servlet Testing Center");
      out.println("");
      out.println("");
      }
      }

      WEB-INF/web-xml:

      <?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-name>Testing</servlet-name>
      <servlet-class>TestingServlet</servlet-class>

      </web-app>


      WEB-INF/classes/TestingServlet.class

      META-INF/application.xml:

      <?xml version="1.0" encoding="ISO-8859-1"?>


      <display-name>Root</display-name>



      <web-uri>myapp.war</web-uri>
      <context-root>/myapp</context-root>




      I war this up:

      WEB-INF/classes/TestingServlet.class
      WEB-INF/web.xml

      then in an ear:

      myapp.war
      META-INF/application.ear

      Am I totally off here? When I hit http://localhost:8080/myapp/servlet/Testing or TestingServlet I get a no context error. Any help would be appreciated.

      -Christian

        • 1. Re: serlvet deploy pass/servlet call failed
          seedling

          I had to add servlet-mapping to it.

          <?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-name>Testing</servlet-name>
          <servlet-class>TestingServlet</servlet-class>

          <servlet-mapping>
          <servlet-name>invoker</servlet-name>
          <url-pattern>/servlet/*</url-pattern>
          </servlet-mapping>
          </web-app>

          • 2. Re: serlvet deploy pass/servlet call failed
            trishah

            Hello,
            thanks to everyone for all previous help. Can anybody tell me if there is any documentation out there on deploying servlets in Jetty? I tried Seedlings sourcecode (thank you) and my web.xml file keeps on being overwritten.

            I keep on getting:
            <?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>

            <!--
            To use non XDoclet filters, create a filters.xml file that
            contains the additional filters (eg Sitemesh) and place it in your
            projects merge dir. Don't include filter-mappings in this file,
            include them in a file called filter-mappings.xml and put that in
            the same directory.
            -->

            <!--
            To use non XDoclet servlets, create a servlets.xml file that
            contains the additional servlets (eg Struts) and place it in your
            projects merge dir. Don't include servlet-mappings in this file,
            include them in a file called servlet-mappings.xml and put that in
            the same directory.
            -->

            <session-config>
            <session-timeout>5</session-timeout>
            </session-config>

            <!--
            To specify mime mappings, create a file named mime-mappings.xml, put it in your project's mergedir.
            Organize mime-mappings.xml following this DTD slice:

            <!ELEMENT mime-mapping (extension, mime-type)>
            -->

            <!--
            To specify error pages, create a file named error-pages.xml, put it in your project's mergedir.
            Organize error-pages.xml following this DTD slice:

            <!ELEMENT error-page ((error-code | exception-type), location)>
            -->

            <!--
            To add taglibs by xml, create a file called taglibs.xml and place it
            in your merge dir.
            -->

            <!--
            To set up security settings for your web app, create a file named web-security.xml, put it in your project's mergedir.
            Organize web-security.xml following this DTD slice:

            <!ELEMENT security-constraint (display-name?, web-resource-collection+, auth-constraint?, user-data-constraint?)>
            <!ELEMENT web-resource-collection (web-resource-name, description?, url-pattern*, http-method*)>
            <!ELEMENT web-resource-name (#PCDATA)>
            <!ELEMENT url-pattern (#PCDATA)>
            <!ELEMENT http-method (#PCDATA)>
            <!ELEMENT user-data-constraint (description?, transport-guarantee)>
            <!ELEMENT transport-guarantee (#PCDATA)>

            <!ELEMENT login-config (auth-method?, realm-name?, form-login-config?)>
            <!ELEMENT auth-method (#PCDATA)>
            <!ELEMENT realm-name (#PCDATA)>
            <!ELEMENT form-login-config (form-login-page, form-error-page)>
            <!ELEMENT form-login-page (#PCDATA)>
            <!ELEMENT form-error-page (#PCDATA)>
            -->

            </web-app>


            whenever I run ant.

            Could anybody suggest ***ANYTHING*** please ?

            Thanks,
            Trish.

            • 3. Re: serlvet deploy pass/servlet call failed
              trishah

              Hello,
              thanks to everyone for all previous help. Can anybody tell me if there is any documentation out there on deploying servlets in Jetty? I tried Seedlings sourcecode (thank you) and my web.xml file keeps on being overwritten.

              I keep on getting:
              <?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>

              <!--
              To use non XDoclet filters, create a filters.xml file that
              contains the additional filters (eg Sitemesh) and place it in your
              projects merge dir. Don't include filter-mappings in this file,
              include them in a file called filter-mappings.xml and put that in
              the same directory.
              -->

              <!--
              To use non XDoclet servlets, create a servlets.xml file that
              contains the additional servlets (eg Struts) and place it in your
              projects merge dir. Don't include servlet-mappings in this file,
              include them in a file called servlet-mappings.xml and put that in
              the same directory.
              -->

              <session-config>
              <session-timeout>5</session-timeout>
              </session-config>

              <!--
              To specify mime mappings, create a file named mime-mappings.xml, put it in your project's mergedir.
              Organize mime-mappings.xml following this DTD slice:

              <!ELEMENT mime-mapping (extension, mime-type)>
              -->

              <!--
              To specify error pages, create a file named error-pages.xml, put it in your project's mergedir.
              Organize error-pages.xml following this DTD slice:

              <!ELEMENT error-page ((error-code | exception-type), location)>
              -->

              <!--
              To add taglibs by xml, create a file called taglibs.xml and place it
              in your merge dir.
              -->

              <!--
              To set up security settings for your web app, create a file named web-security.xml, put it in your project's mergedir.
              Organize web-security.xml following this DTD slice:

              <!ELEMENT security-constraint (display-name?, web-resource-collection+, auth-constraint?, user-data-constraint?)>
              <!ELEMENT web-resource-collection (web-resource-name, description?, url-pattern*, http-method*)>
              <!ELEMENT web-resource-name (#PCDATA)>
              <!ELEMENT url-pattern (#PCDATA)>
              <!ELEMENT http-method (#PCDATA)>
              <!ELEMENT user-data-constraint (description?, transport-guarantee)>
              <!ELEMENT transport-guarantee (#PCDATA)>

              <!ELEMENT login-config (auth-method?, realm-name?, form-login-config?)>
              <!ELEMENT auth-method (#PCDATA)>
              <!ELEMENT realm-name (#PCDATA)>
              <!ELEMENT form-login-config (form-login-page, form-error-page)>
              <!ELEMENT form-login-page (#PCDATA)>
              <!ELEMENT form-error-page (#PCDATA)>
              -->

              </web-app>


              whenever I run ant.

              Could anybody suggest ***ANYTHING*** please ?

              Thanks,
              Trish.