Debugging servlet in Tomcat

Where can I see the System.out.println in Servlet on tomcat?
Where does it go?
Please tell anybody if you know.

Just go into catalina.sh
and comment with an #
like below
(org.apache.catalina.startup.Bootstrap "$@" start &#\
#>> "$CATALINA_BASE"/logs/catalina.out 2>&1 &)
that's it .. took me a day to find out
touch "$CATALINA_BASE"/logs/catalina.out
if [ "$1" = "-security" ] ; then
echo "Using Security Manager"
shift
"$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
-Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
-Djava.security.manager \
-Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \
-Dcatalina.base="$CATALINA_BASE" \
-Dcatalina.home="$CATALINA_HOME" \
-Djava.io.tmpdir="$CATALINA_TMPDIR" \
org.apache.catalina.startup.Bootstrap "$@" start \
>> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
if [ ! -z "$CATALINA_PID" ]; then
echo $! > $CATALINA_PID
fi
else
"$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
-Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
-Dcatalina.base="$CATALINA_BASE" \
-Dcatalina.home="$CATALINA_HOME" \
-Djava.io.tmpdir="$CATALINA_TMPDIR" \
org.apache.catalina.startup.Bootstrap "$@" start &#\
#>> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
if [ ! -z "$CATALINA_PID" ]; then
echo $! > $CATALINA_PID
fi

Similar Messages

  • Debugging Servlets on Tomcat server on Eclipse IDE?

    Hi,
    I am new to servlets. I want to debug my servlet. It consists of doPost() and doGet methods. Is it possible to debug it ? If yes, how?
    Regards,
    ap.

    too many cooks may spoil the broth dear APs..
    any ways..sop is System.out.println(), which is the easiest way to debug.:) not a sophisticated way tho..
    U can configure a logger using logger utilities like log4j.
    shanu

  • Getting error 404 when iam running a simple login servlet in tomcat

    hi
    this is my Login.java
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class Login extends HttpServlet
         public void doPost(HttpServletRequest rq, HttpServletResponse rs)
              String username =rq.getParameter("username");
              String password =rq.getParameter("password");
    try{
              rs.setContentType("text/html");
              PrintWriter out=rs.getWriter();
              out.println("<html><body>");
              out.println("thank u, " + username + "you r logged sucessfully");
              out.println("</body></html>");
              out.close();
              }catch(Exception e){
                   e.printStackTrace();
    i have saved in the form ofC:\Program Files\apache-tomcat-4.1\webapps\sravan\WEB-INF\classes\Login.class
    where sravan is my folder
    step 2: Login.html
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>login page</title></head>
    <body>
    <h1> WELCOME TO THE SERVLET HOME PAGE</h1>
    ENTER UR USERNAME AND PASSWORD
    <form action="/sravan/Login" method="Post">
         username<input type="text" name="username" >
         password<input type="password" name="password" >
         <input type="submit" value="submit"></form>
         </body>
    </html>
    i have saved in the form C:\Program Files\apache-tomcat-4.1\webapps\sravan\Login.html
    step3:
    my 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>
    <display-name>beginning j2ee</display-name>
    <servlet>
    <servlet-name>Login</servlet-name>
    <servlet-class>Login</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Login</servlet-name>
    <url-pattern>Login</url-pattern>
    </servlet-mapping>
    </web-app>
    i have saved in C:\Program Files\apache-tomcat-4.1\webapps\sravan\WEB-INF\web.xml
    step4:
    here is my server.xml
    <Context path="/sravan" docBase="sravan" debug="0" reloadable="true" privileged="true"/>
    saved in C:\Program Files\apache-tomcat-4.1\webapps\sravan\WEB-INF\server.xml
    everything is fine....program is compiled ...but when iam running the servlet in tomcat iam getting error 404 Login.html not found....
    so plz kindly help me this my first servlet .....

    There seems not to be any '.html' in your url-pattern
    <url-pattern>Login</url-pattern>- so i presume you should use
    http://yourhost/Logininstead.

  • Debugging servlets using jdb

    Hello friends, can anyone please help me in debugging servlets using jdb. I am using tomcat as the web server. Thanks

    http://developer.java.sun.com/developer/onlineTraining/Programming/JDCBook/servlet.html

  • To Deploy a Servlet using Tomcat

    I am trying to deploy an example servlet in tomcat.
    my example servlet code is
    import javax.servlet.http.*;
    import javax.servlet.*;
    import java.io.*;
    public class HitServlet extends HttpServlet {
    private int mCount;
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String message = "Hits: " + ++mCount;
    response.setContentType("text/plain");
    response.setContentLength(message.length());
    PrintWriter out = response.getWriter();
    out.println(message); } }
    i 've placed my servlet in the directory
    webapps/midp/WEB-INF/classes/HitServlet.java
    i've successfully compiled the code. Then started the tomcat server & thro' IE tried to open the url to http://localhost:8080/midp/hits.
    but i 'm receiving the error the servlet bob is missing. i've placed the web.xml & server.xml in the folders specified in the tutorial. in server.xml i've added the code
    <Context path="/midp" docBase="midp" debug="0" reloadable="true" privileged="true"/>
    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> <servlet-name>bob</servlet-name> <servlet-class>HitServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>bob</servlet-name> <url-pattern>/hits</url-pattern> </servlet-mapping> </web-app>
    If u can guide me to deploy the servlet it'll be very helpfull.
    With Best Regards
    Ramkumar

    one idea that I have is the CATALINA_HOME and CATALINA_BASE.
    We use CATALINA_BASE to install our stuff in another directory than that of the tomcat installation.
    in the tomcat-engine.log you should se sth similar to:
    2003-06-18 09:19:04 StandardHost[localhost]: Installing web application at context path /hits from URL file:<xxx/webapps/midp>
    2003-06-18 09:19:04 WebappLoader[/gtfn]: Deploying class repositories to work directory $CATALINA_BASE/work/Apache/localhost/gtfn
    ...

  • Debug - servlet

    Colud someone help me to how debug a servlet with tomcat and netbeans 3.5.1 ?
    Thanks

    If you're running on the Tomkat server, dropping debug statements in won't work. It does if you're running from the S!S ide that's a different question.
    However, if you're running on the actual server, about the only thing you can do is to sprinkle Systm.out.println(String) commands through the code and watche the log to see what's going on.
    If however you are running from the ide and you launch the server in debug mode. (You'll have to check the ide docs for specifics because I don't have them here with me) then you can drop debug markers in the code and it will stop and let you step through the code.
    Regards,

  • How to run a servlet in tomcat 5.0.

    Hi all,
    how to run a servlet in tomcat 5.0
    please tell me the entire procedure....(directory structure)
    step by step....

    hi :-)
    http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets.html
    or
    http://www.google.com.ph/search?hl=en&q=java+servlet+tutorial&btnG=Google+Search&meta=
    regards,

  • Servlet on tomcat 4.1.18

    I am facing a problem of running servlets on Tomcat 4.1.18. The problem seems to be in the configuration. In the webapps folder, I created a folder greeting. In that, the WEB-Inf\classes folder has GreetingServlet.class.
    webapp\greeting has index.html that has to FORM ACTION set to /greeting/servlet/GreetingServlet.
    On clicking the submit button the message I get is that the resource /greeting/servlet/GreetingServlet is not found.
    Can anybody help in configuring the server so that the above mentioned servlet gets recognized?
    Thanks.
    Amitabh.
    [email protected]

    My application is located at %TOMCAT_HOME%\webapps.
    %TOMCAT_HOME%\webapps\greeting\WEB-INF\web.xml has the following:
    <web-app>
    <servlet>
    <servlet-name>greeting</servlet-name>
    <servlet-class>GreetingServlet</servlet-class>
    </servlet>
    </web-app>
    %TOMCAT_HOME%\webapps\greeting\index.html has the following:
    <FORM ACTION="/greeting/servlet/GreetingServlet" METHOD="POST">
    <P> Your name <INPUT TYPE="text" SIZE="40" NAME="name"></P>
    </FORM>
    Yet the problem persists.
    Have I missed some point?
    Help/assistance will be appreciated.
    Thanks.
    Amitabh.
    [email protected]

  • Servlets in Tomcat

    I am trying to run servlets using Tomcat. I have them working and displaying but as soon as I make a change to a servelt and re-compile and refresh the browser the change do not take effect. I have to shutdown and restart tocat. Surely this can't be right. can anyone help with correcting this problem?

    Lesta,
    For convenience there's a Tomcat admin console. The admin console runs through a web browser and allows you to restart an application, restart a context ect. I think you can also install or reinstall entire ears through it now.
    There's some setup to do before you can use the admin console. I seem to remember there being an XML user/password file somewhere...
    In a production environment you don't want to shutdown and restart the daemon like you are doing. It will just annoy the heck out of your users.
    Hope this helps.
    -Bryan

  • Need to enable autoreload feature for servlet in Tomcat

    Hello
    I wants to enable autoreload feature for servlet in tomcat so that i need not to stop tomcat 4.0 web server again and again
    Thanks

    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/context.html
    It is amazing what reading the manual might do for ya.

  • How to run Servlet in TOMCAT

    I am new to Java Servlets. I am trying to run a servlet on TOMCAT but I don't know where to place my Servlet class file. TOMCAT works ok with sample jar file. Please guide.
    -- HTML code
    <HTML>
    <HEAD>
    <TITLE> Request Object </TITLE>
    </HEAD>
    <BODY>
    <FORM METHOD="POST" ACTION="/servlet/WelcomeServlet">
    Enter your Name: <INPUT TYPE=TEXT NAME="myName">
    <INPUT TYPE="SUBMIT" VALUE="Send Name">
    </FORM>
    </BODY>
    </HTML>
    -- Servlet Code
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class WelcomeServlet extends HttpServlet {
    public void doPost(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    String Name = request.getParameter("myName");
    PrintWriter out = response.getWriter();
    String mName = "test";
    try {
    mName = gName("AAA","VVV");
    catch (SQLException ex)
    out.println("SQLException");
    out.println("Welcome 1.1 " + Name + " !" + " mName " + mName);
    public String gName(String inputUserid, String inputPwd)
    throws SQLException{
    String vname = "Test";
    return vname;
    thanks
    Vineet

    I have Tomcat version 4.0 installed on my machine. If you look at the directory where you have Tomcat installed, you should find the directory structure:
    tomcat-folder/webapps/root/web-inf/classes
    Try placing your class files in the classes folder.

  • How to Run servlet in Tomcat 5.5.9

    hi
    How to run servlet in tomcat 5.5.9?how to set context path in server.xml of conf folder in tomcat since there is no context tag in server.xml.
    Jiten

    Hi ! I have a similar problem, well, it's along the same line ...
    I'm using NetBeans 4.1, and i've coded a servlet. Using NetBeans to launch my servlet (with the bundled Tomcat 5.5.7) works fine, however i need to deploy my application unto a Tomcat 5.5.9 server.
    Thus, i copied the WAR file generated by NetBeans into the Tomcat 5.5.9 webapps directory, and Tomcat expands it.
    Problem is when i run my JSP pages with the form tags, they do not work on the Tomcat 5.5.9 environment. Anyone knows why?
    (These work on the NetBeans Tomcat bundle 5.5.7)
    My form action :
    <form name="index" method="get" action="PageServlet">
    My web.xml :
    <servlet>
    <servlet-name>PageServlet</servlet-name>
    <servlet-class>application.PageServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>PageServlet</servlet-name>
    <url-pattern>/PageServlet</url-pattern>
    </servlet-mapping>
    I'm really stumbed on why it doesn't work in Tomcat 5.5.9, any help is greatly appreciated, thanks in advance ^_^

  • How to run Servlet in Tomcat 5.5.7 Server

    Hi,
    How to run Servlet in Tomcat 5.5.7 Server. I mean where I should copy my *.class file.
    Thanks in Advance.
    bbye.

    In order to complile the servlet you need to tell java where to find the servlet libary (as stated above by setting the class path). or (much easier IMO)
    copy the servlet-api.jar to
    JavaInstallDirectory\jre\lib\ext

  • Running servlet in tomcat 4.1.18

    Hi,
    I am new to servlet and am having trouble running a simple servlet on tomcat 4.1.18. I keep getting an Error 404 resource not found. will someone show me how to run servlet on tomcat?Please.
    Thanks

    To start, make sure you have specified the servlet and mapping in your application's WEB-INF/web.xml file.
    <!-- for example -->
    <servlet>
        <servlet-name>yourServletName</servlet-name>
        <servlet-class>path.to.Servlet</servlet-class>
    </sevlet>
    <servlet-mapping>
        <servlet-name>yourServletName</servlet-name>
        <url-pattern>/servlet/yourServletName</url-pattern>
    </servlet-mapping>

  • How Can I Run Servlet in tomcat

    Hi My Friends
    Please can any one tell me how can I Run Servlet in tomcat using my own Virtual Directory � my ask about , what is the structure it must be make it in the hierarchy of the sub folder of Virtual Directory , and in watch folder it must be put the servlet files and there is any change it must be make it in any file of the tomcat files and so on
    Please give my full details about this thing
    And thanks

    What version of Tomcat are u using?

Maybe you are looking for

  • Stuck in single user mode and can not get past it

    I am experiencing a problem I recently had lent me a Mac g4 tower. I decided to upgrade to tiger and accidentally set the start-up preference to the disc, every time I boot up it goes into single user mode, if I boot up holding the option key it brin

  • How to put widget full time on desktop?  I found it is possible on display.

    I noticed in a CompUSA store display, one of the widgets (calendar and clock) was ful time on the desktop. They did not know how it was or who did, anyone know how to without clicking dashboard?

  • Failed to get IP address for Local Host (2) , OPMNCTL: opmn start failed

    HI, Hi, I have installed on Oracle 10g on Redhat Enterprise Linux V.2.1 . I was able to start OEM without any issues. Recently I had changed the static IP address and I couldn't able to start OPMNCTL and getting the following error while starting opm

  • Pre-generation and linking of a graph

    Our application is based on an oracle data which gets uploaded periodically (e.g. every week). Since online generation and rendering of SVG graphs takes time we are thinking of generating graphs ahead of time (i.e. after the upload). Is it possible t

  • Contact picture problem

    I want it so everytime someone rings, I get a little thumbnail with the persons conact picture in the corner instead of a horrible pixaled version taking up the whole scren. It used to be that way but ever since I merged to iCloud/iOS5 it's changed.