You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Nobert,Conrad" <cn...@nait.ab.ca> on 2003/09/10 19:58:48 UTC

tomcat won't reload my servlets

Hello,

I have the exact same issue that was posted about 20 days ago. I haven't seen a response yet. Any ideas?

This is my servlet:

##################################
import javax.servlet.http.*;
import javax.servlet.ServletException;
import java.io.PrintWriter;
import java.io.IOException;

public class Test extends HttpServlet
{

public void init() throws ServletException
{
System.out.println( "loading ");
}
/**
* Returns an HTML form to the client prompting for
their name
* and e-mail address.
*/
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException
{
//set MIME type for HTTP header
response.setContentType( "text/html ");

//get a handle to the output stream
PrintWriter out = response.getWriter();

out.println( " <HTML > <HEAD > ");
out.println( " <TITLE >Topic 3 Exercise 4 p. 14 Study
Guide </TITLE > ");
out.println( " </HEAD > ");
out.println( " <BODY > ");
out.println( " <H1 >Hello 2 changes </H1 > ");
out.println( " </BODY > </HTML > ");
out.close(); //always close the output stream
}
public void destroy()
{
System.out.println( "get rid of ");
}
}
#########################################
I compile it and place in ROOT/WEB-INF/classes

I run catalina.
it loads the servlet fine
I change some text in the servlet.... recompile

then in the console window I get:
#################################
WebappClassLoader: Resource
'/WEB-INF/classes/Test.class ' was modified; Date is now:
Wed Aug 20 13:24:30 CST 2003 Was: Wed Aug 20 13:21:45 CST
2003
get rid of
##################################
where 'get rid of ' the text in my destroy() method,
but no reloading.

in fact in the browser window when I do a reload I get:
HTTP Status 503 - Servlet
org.apache.catalina.INVOKER.Test is currently unavailable

and I can 't invoke any more servlets at all.

what am I doing wrong?

my servlet.xml file is as follows (relevant part):
######################################################
<!-- Define properties for each web application.
This is only needed
if you want to set non-default properties,
or have web application
document roots in places other than the
virtual host 's appBase
directory. -- >

<DefaultContext reloadable= "true "/ >

<!-- Tomcat Root Context -- >

<Context path= " " docBase= "ROOT " debug= "0 "
reloadable= "true " >
</Context >

########################################################

I really need to get tomcat to reload those servlets
otherwise it 's useless!


RE: tomcat won't reload my servlets

Posted by Mike Curwen <gb...@gb-im.com>.
I apologize if any of this is repeated from any responses to your
earlier post:

It can't hurt to package your servlet. It's good practice, it's what
most people do, and it's probably the most 'supported' in terms of
wanting help from people on this list. ;)
 
Your context declaration has a space in the path attribute.  
path=" " should be 
path=""

When you say:
"and I can 't invoke any more servlets at all."
Do you mean in ANY context, or just yours?  Is there further output in
any of the logs regarding the context failing ?  Have you tried to
reload the context through the manager app? (You shouldn't need to do
this, but have you tried?)

If it's Tomcat 4.1.27, there's a known class reloading issue. This
normally applies to restarting a context, but it *might* be related.
Have you applied the hotfix ?
 
Finally, are you sure the changes are 'valid'? Meaning, it doesn't
introduce an infinite loop that kills your server?

> -----Original Message-----
> From: Nobert,Conrad [mailto:cnobert@nait.ab.ca] 
> Sent: Wednesday, September 10, 2003 12:59 PM
> To: tomcat-user@jakarta.apache.org
> Subject: tomcat won't reload my servlets
> 
> 
> Hello,
> 
> I have the exact same issue that was posted about 20 days 
> ago. I haven't seen a response yet. Any ideas?
> 
> This is my servlet:
> 
> ##################################
> import javax.servlet.http.*;
> import javax.servlet.ServletException;
> import java.io.PrintWriter;
> import java.io.IOException;
> 
> public class Test extends HttpServlet
> {
> 
> public void init() throws ServletException
> {
> System.out.println( "loading ");
> }
> /**
> * Returns an HTML form to the client prompting for
> their name
> * and e-mail address.
> */
> public void doGet(HttpServletRequest request, 
> HttpServletResponse response) throws ServletException, 
> IOException { //set MIME type for HTTP header 
> response.setContentType( "text/html ");
> 
> //get a handle to the output stream
> PrintWriter out = response.getWriter();
> 
> out.println( " <HTML > <HEAD > ");
> out.println( " <TITLE >Topic 3 Exercise 4 p. 14 Study
> Guide </TITLE > ");
> out.println( " </HEAD > ");
> out.println( " <BODY > ");
> out.println( " <H1 >Hello 2 changes </H1 > ");
> out.println( " </BODY > </HTML > ");
> out.close(); //always close the output stream
> }
> public void destroy()
> {
> System.out.println( "get rid of ");
> }
> }
> #########################################
> I compile it and place in ROOT/WEB-INF/classes
> 
> I run catalina.
> it loads the servlet fine
> I change some text in the servlet.... recompile
> 
> then in the console window I get: #################################
> WebappClassLoader: Resource
> '/WEB-INF/classes/Test.class ' was modified; Date is now:
> Wed Aug 20 13:24:30 CST 2003 Was: Wed Aug 20 13:21:45 CST
> 2003
> get rid of
> ##################################
> where 'get rid of ' the text in my destroy() method,
> but no reloading.
> 
> in fact in the browser window when I do a reload I get:
> HTTP Status 503 - Servlet
> org.apache.catalina.INVOKER.Test is currently unavailable
> 
> and I can 't invoke any more servlets at all.
> 
> what am I doing wrong?
> 
> my servlet.xml file is as follows (relevant part): 
> ######################################################
> <!-- Define properties for each web application.
> This is only needed
> if you want to set non-default properties,
> or have web application
> document roots in places other than the
> virtual host 's appBase
> directory. -- >
> 
> <DefaultContext reloadable= "true "/ >
> 
> <!-- Tomcat Root Context -- >
> 
> <Context path= " " docBase= "ROOT " debug= "0 "
> reloadable= "true " >
> </Context >
> 
> ########################################################
> 
> I really need to get tomcat to reload those servlets
> otherwise it 's useless!
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>