6 Replies Latest reply on Mar 4, 2003 5:31 PM by Julian Gosnell

    Deploying Servlet and JSP in Jboss/Jetty 3.0.4

    Rik Dunphy Newbie

      Hi,

      Am having problems deploying my test servlet and jsp in the jetty version of jboss. All works ok with the tomcat version - but i need to get it working with jetty...

      Anyway...

      BAsically I have a doPost in my servel as
      public void doPost(HttpServletRequest request,
      HttpServletResponse response) throws ServletException {
      RequestDispatcher dispatch;
      ServletContext context;

      try {
      HttpSession session = request.getSession(true);
      Greeting greet = (Greeting) GreetingFactory.getGreetingFactory().getGreeting();
      session.setAttribute("greeting",greet);

      context = getServletContext();
      dispatch = context.getRequestDispatcher("/HelloWorldJSP");
      dispatch.forward(request,response);

      } catch (Exception e) {
      throw new ServletException(e);
      }
      }

      This should call me JSP which is mapped as follows in the web.xml


      <servlet-name>HelloWorldJSP</servlet-name>
      <jsp-file>HelloWorld.jsp</jsp-file>


      <servlet-mapping>
      <servlet-name>HelloWorldJSP</servlet-name>
      <url-pattern>/HelloWorldJSP</url-pattern>
      </servlet-mapping>

      I put all this in my hello.war and deploy which works ok..

      But as soon as I point my browser to http://localhost:8080/hello/HelloWorldServlet I get the following exception trace...
      2002-11-28 23:05:54,432 WARN [org.jboss.jbossweb] WARNING: Exception for /hello/HelloWorldServlet
      org.apache.jasper.JasperException: No output directory: String index out of range: -1
      at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:536)
      at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:176)
      at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:188)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:366)
      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:293)
      at org.mortbay.jetty.servlet.Dispatcher.dispatch(Dispatcher.java:216)
      at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:151)
      at xptoolkit.web.HelloWorldServlet.doGet(Unknown Source)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:366)
      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:293)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:581)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1687)
      at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:544)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1637)
      at org.mortbay.http.HttpServer.service(HttpServer.java:875)
      at org.jboss.jetty.Jetty.service(Jetty.java:543)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:806)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:956)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:823)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:203)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:290)
      at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:743)
      at java.lang.Thread.run(Thread.java:536)


      Any ideas would be greatly apprecited
      TIA
      RikD