Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
May 23, 2012, 10:35:36 PM

Pages: [1]   Go Down
  Print  
Author Topic: Problem seeing test servlet  (Read 1214 times)
drakkos
Newbie
*
Offline Offline

Posts: 2


« on: April 11, 2008, 10:06:16 AM »

Hi there.

I'm having some problems getting a test servlet to be recognised on my account - JSP is definitely working (tech support uploaded a test file that shows that), and resin is compiling the .class files from the .java files, but for the life of me I can't actually get the servlet to be recognised.  This is my web.xml file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
       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">

<!--   This is the test servlet -->
       
    <servlet>
        <servlet-name>myServlet</servlet-name>
        <servlet-class>TestClass</servlet-class>
    </servlet>

   <servlet-mapping>
        <servlet-name>myServlet</servlet-name>
        <url-pattern>/servlet/*.do</url-pattern>
    </servlet-mapping>
   
<!-- New servlets after this -->

</web-app>

And the Java file I'm using is a modified version of one I found elsewhere on the forum:


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

public class TestClass extends HttpServlet {
  public void doGet (HttpServletRequest req,
                     HttpServletResponse res)
    throws ServletException, IOException
  {
    PrintWriter out = res.getWriter();

    out.println("Hello, world!");
    out.close();
  }
}

I've tried accessing the servlet at a dozen addresses, but the one that I understand should work is:  http://www.monkeys-at-keyboards/servlet/myServlet.do... but nothing except a 'page not found' message.

I know I'm probably missing something frustratingly simple, but I just can't see what my problem is - any help would be hugely appreciated.

Thanks,
Drakkos
Logged
drakkos
Newbie
*
Offline Offline

Posts: 2


« Reply #1 on: April 14, 2008, 12:50:53 AM »

Hrm!

And I check the URL again after the weekend (after having done nothing on it all weekend), and quite bizarrely the servlet is working...

Curiouser and curiouser.  If anyone can explain that mystery then instead of the first one, I will be equally grateful.  Very Happy

Drakkos.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: