You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sc...@aol.com on 2002/05/10 07:19:55 UTC

test servlet in "examples" dir to run - solaris...

tomcat-user@jakarta.apache.org

using java 1.3.1

loaded 3.2.4 tomcat on solaris 8. intro screen port 8080 & examples work.  A simple "tester.java" servlet (which
works on NT tomcat) does not work on solaris (code is below).

created tester.java servlet & compiled into SAME dir
as other example class files (helloworld, etc).  Error:

      ------------------------------
# 2002-05-09 20:57:11 - Ctx( /examples ): 405 R( /examples + /servlet/tester + null) HTTP method GET is not supported by this URL
     ----------------------------
1.)
Have not changed any config params but simply untarred
code,  then unjarred all *.war files,  & ran startup.sh.
Must something more be configured ?

2.)
Possible problem:   had to unjar "servlet.jar" file into
the ../examples/WEB-INF/classes directory before could
compile tester.java servlet without errors even though
"servlet.jar" was in classpath. Compile only saw classes
once they were unjarred into directory where compiling
tester.java with other standard examples.

--  compile error before unjaring servlet.jar into dir --- 

tester.java:8: cannot resolve symbol
symbol  : class HttpServletResponse  
location: class tester
       public void doPost(HttpServletRequest req, HttpServletResponse res)

-----  startup output & classpath below ---------

Using classpath: /usr/local/jakarta-tomcat-3.2.4/lib/ant.jar:/usr/local/jakarta-tomcat-3.2.4/lib/crimson.jar:/usr/local/jakarta-tomcat-3.2.4/lib/jasper.jar:/usr/local/jakarta-tomcat-3.2.4/lib/jaxp.jar:/usr/local/jakarta-tomcat-3.2.4/lib/servlet.jar:/usr/local/jakarta-tomcat-3.2.4/lib/test:/usr/local/jakarta-tomcat-3.2.4/lib/webserver.jar:/usr/j2se/lib/tools.jar
greenlantern.us.schp.com# 2002-05-09 21:36:59 - ContextManager: Adding context Ctx( /examples )
Starting tomcat. Check logs/tomcat.log for error messages 
2002-05-09 21:36:59 - ContextManager: Adding context Ctx( /admin )
2002-05-09 21:36:59 - ContextManager: Adding context Ctx(  )
2002-05-09 21:36:59 - ContextManager: Adding context Ctx( /test )
2002-05-09 21:36:59 - ContextManager: Adding context Ctx( /META-INF )
2002-05-09 21:36:59 - ContextManager: Adding context Ctx( /docs )
2002-05-09 21:36:59 - ContextManager: Adding context Ctx( /WEB-INF )
2002-05-09 21:36:59 - ContextManager: Adding context Ctx( /javadoc )
2002-05-09 21:36:59 - ContextManager: Adding context Ctx( /tomcat.gif )
2002-05-09 21:36:59 - ContextManager: Adding context Ctx( /index.html )
2002-05-09 21:36:59 - ContextManager: Adding context Ctx( /tomcat-power.gif )
2002-05-09 21:36:59 - ContextManager: Adding context Ctx( /contextAdmin )
2002-05-09 21:36:59 - ContextManager: Adding context Ctx( /jsp )
2002-05-09 21:36:59 - ContextManager: Adding context Ctx( /servlets )
2002-05-09 21:36:59 - ContextManager: Adding context Ctx( /images )
2002-05-09 21:36:59 - ContextManager: Adding context Ctx( /binaries )
2002-05-09 21:36:59 - ContextManager: Adding context Ctx( /welcome )
2002-05-09 21:36:59 - ContextManager: Adding context Ctx( /dispatch )
2002-05-09 21:36:59 - ContextManager: Adding context Ctx( /realPath.jsp )

--------------------simple tester servlet ---------

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

   public class tester extends HttpServlet
   {
       public void doPost(HttpServletRequest req, HttpServletResponse res)
                   throws IOException
       {
           res.setContentType("text/html");
           PrintWriter pw = new PrintWriter(res.getOutputStream());

           pw.println("<HTML>");
           pw.println("<HEAD>");
           pw.println("<TITLE>Tester Servlet #3</TITLE>");
           pw.println("</HEAD>");
           pw.println("<BODY>");
           pw.println("<H1>Sample Servlet #3<HR></H1>");

           pw.println("<P>Hi, " + req.getParameter("name") + "!");
           pw.println("<BR>Nice to meet you!");

           pw.println("</BODY>");
           pw.println("</HTML>");

           pw.flush();
           pw.close();
       }
   }






--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>