You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mike McDonald <ke...@kelek.com> on 2001/04/10 07:24:57 UTC

Reloading configuration?

Is there a way to let Tomcat reload its configuration (server.xml and web.xml
files) and perform a 'soft restart' (i.e. sessions are preserved; servlets are
restarted; connections are not broken)?  Apache JServ has the ability to do
this, but I haven't found an equivalent option in Tomcat yet.
-- 




-- Mike McDonald <ke...@kelek.com>
   http://www.kelek.com
     Web Samurai
     Freelance Programmer/Consultant
     Developer, http://www.Worldisround.com

Re: Am I crazy???

Posted by "Felix A. Milovanov" <fe...@terasystems.com>.
  Hello Hasan,

  thanx for your reply, but it looks like you really missed the point ( sorry
for my english - i live just 4 month in the U.S. ) :) I do not have a problem
with my class - it works fine. But if I use your definition - it will not work.
When I inherit my servlet from base class, doGet() and/or doPost() methods 
will be overriden by inherited class, and I loose all functionality :(

  My problem is - i cannot handle 404 error in Tomcat! I said how I've defined
404 error handler, but /404.jsp does not run! It looks like Tomcat invokes
service() method of my baseServlet class while it cannot create an instance
of this class and method is not defined as static. Why does THIS happened? Why
Tomcat invokes my code instead of make redirection to /404.jsp?

  That is my question :))))

  Sincerely yours,
								Felix.

Hasan Bramwell wrote:
> 
> Felix
> 
> No yr not crazy, just a littl masochistic maybe  :-)
> (either that or I've missed the point)
> 
> instead of ...
> 
> >    public void service(HttpServletRequest Req, HttpServletResponse Res)
> >           throws ServletException, IOException
> >    {
> 
> why don't you try ...
> 
>  public void doGet(HttpServletRequest Req, HttpServletResponse Res)
>            throws ServletException, IOException
>  {
>    theRestOfIt(Req, Res);
>  }
> 
>  public void doPost(HttpServletRequest Req, HttpServletResponse Res)
>            throws ServletException, IOException
>  {
>    theRestOfIt(Req, Res);
>  }
> 
>  private void theRestOfIt(Req, Res)
>            throws ServletException, IOException
>  {
>      what you really need to do here...
>  }
> 
> the documentation says pretty clearly not to use 'service' -- "This
> method is rarely overridden."
> 
> Hasan
> 
> > From: "Felix A. Milovanov"
> >  Subject:  Am I crazy???
> >  Date:  Mon, 09 Apr 2001 17:48:14 -0700
> >    Hello all,
> >
> >    now I start using Tomcat and servlet/JSP programming. I was need
> >  to make some
> >  activity BEFORE invoking any servlet/JSP. I've created a very simple
> >  class :
> >
> >  import java.io.*;
> >  import java.sql.*;
> >  import java.lang.*;
> >  import java.util.*;
> >  import javax.servlet.*;
> >  import javax.servlet.http.*;
> >  import javax.servlet.jsp.*;
> >
> >  public abstract class baseServlet extends HttpServlet implements
> >  HttpJspPage
> >  {
> >
> >    public void _jspService(HttpServletRequest Req,
> >  HttpServletResponse Res)
> >           throws ServletException, IOException {}
> >
> >    public void jspInit() {}
> >    public void jspDestroy() {}
> >
> >    public void service(HttpServletRequest Req, HttpServletResponse
> >  Res)
> >           throws ServletException, IOException
> >    {
> >      String Path = Req.getServletPath();
> >
> >      System.out.println("URL called : " + Path);
> >
> >      /* Invoke original handler */
> >      if (Path.endsWith(".jsp")) _jspService(Req, Res);
> >                           else  super.service(Req, Res);
> >    }
> >
> >
> >  }
> >
> >    I can inherit any servlet/JSP from this class, and now I just
> >  print to
> >  console the URI of requested WEB resource.
> >
> >    Ok, everything works. Then I tried to handle error 404 with Tomcat
> >  - I've
> >  already described 404 handler for apache :
> >
> >  ErrorDocument 404 /404.jsp
> >
> >    /404.jsp works excellent, but when I tried to run something non-
> >  existed
> >  URI like "/servelt/bla-bla-bla", I got an error from Tomcat instead
> >  of
> >  /404.jsp. Ok, I read the documentation and found how it should be
> >  done:
> >
> >  <web-app>
> >   <error-page>
> >    <error-code>404</error-code>
> >    <location>/404.jsp</location>
> >   </error-page>
> >  </web-app>
> >
> >    For now these lines are all in my web.xml. I've restarted tomcat,
> >  tried
> >  to access /servlet/hmm and got the following message ( insted of my
> >  own /404.jsp ) :
> >
> >  Error: 400
> >  Location: /servlet/hmm
> >  HTTP method GET is not supported by this URL
> >
> >    The most strange issue is... I'VE GOT MESSAGE "URI called :
> >  /servlet/hmm"
> >  ON THE CONSOLE!!!
> >
> >    I do not understand anything... WHY MY CODE IS INVOKED???
> >
> >    Sincerely,
> >                                                          Felix.
> >

Re: mod_jserv compilation problem (AIX)

Posted by Olivier Hislaire <O....@msg-i.com>.
Just in case, for the archives: I found it in the newsgroup.

The first think to do was to add -bexpall to the LDFLAGS, then compile and 
link with "apxs -c mod_jserv.c jserv*.c". Using "axps ... *.c" instead of 
"jserv*.c" makes one more (useless here) source to compile, a source with a 
"main()" in it, which share objects don't like too much - at least on AIX.

Olivier.

At 03:14 PM 4/10/01 +0100, you wrote:

>Hi there,
>
>I am trying to build the mod_jserv.so shared object in IX 4.3.1.0, using 
>gcc 2.7.2, apxs from apache 1.3.19 (binary distribution for aix4.3) and 
>tomcat 3.2.1. And I *almost* made it :-(
>
>Since, there is just one stupid problem in linking the share object (see 
>below); could anybody help me with this, or tell me where to find a 
>suitable mod_jserv.so for my aix box ?
>
>Thanks,
>
>Olivier
>
>------------- start of inclusion
>
>(...)
>
>gcc -DAIX=43 -DUSE_PTHREAD_SERIALIZED_ACCEPT -U__STR__ 
>-DAIX_BIND_PROCESSOR -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite -fpic 
>-DSHARED_MODULE -I/usr/local/apache/include -c mod_jserv.c
>
>ld -H512 -T512 -bhalt:4 -bM:SRE -bnoentry 
>-bI:/usr/local/apache/libexec/httpd.exp -lc -o mod_jserv.so mod_jserv.o 
>jserv_wrapper_win.o jserv_wrapper_unix.o jserv_wrapper.o jserv_watchdog.o 
>jserv_utils.o jserv_status.o jserv_protocols.o jserv_mmap.o jserv_image.o 
>jserv_balance.o jserv_ajpv12.o jserv_ajpv11.o autochange.o
>
>ld: 0711-244 ERROR: No csects or exported symbols have been saved.
>apxs:Break: Command failed with rc=8
>
>------------- end
>------------------------------------------------------------------------------------------------
>Olivier Hislaire
>
>MSG International                   Email:   O.Hislaire@msg-i.com
>97 Avenue de Tervuren             Phone: +32 (0)2 735.91.59 Ext. 55
>1040 Brussels                         Fax:     +32 (0)2 732.12.19
>Belgium                                  http://www.msg-i.com
>------------------------------------------------------------------------------------------------
>
>
>

------------------------------------------------------------------------------------------------
Olivier Hislaire

MSG International                   Email:   O.Hislaire@msg-i.com
97 Avenue de Tervuren             Phone: +32 (0)2 735.91.59 Ext. 55
1040 Brussels                         Fax:     +32 (0)2 732.12.19
Belgium                                  http://www.msg-i.com
------------------------------------------------------------------------------------------------




Re: mod_jserv compilation problem (AIX)

Posted by Olivier Hislaire <O....@msg-i.com>.
At 09:33 AM 4/10/01 -0500, you wrote:


>Compiling libraries on AIX is mostly voodoo and luck. Does the file
>/usr/local/apache/libexec/httpd.exp exist?

Yes, and it is not empty.


>You might try the newsgroup comp.unix.aix, there are some IBM people
>there that may be able to help.

I'll try.

Olivier.
------------------------------------------------------------------------------------------------
Olivier Hislaire

MSG International                   Email:   O.Hislaire@msg-i.com
97 Avenue de Tervuren             Phone: +32 (0)2 735.91.59 Ext. 55
1040 Brussels                         Fax:     +32 (0)2 732.12.19
Belgium                                  http://www.msg-i.com
------------------------------------------------------------------------------------------------




Re: mod_jserv compilation problem (AIX)

Posted by Dave Weis <dj...@businessolver.com>.
Compiling libraries on AIX is mostly voodoo and luck. Does the file
/usr/local/apache/libexec/httpd.exp exist?

You might try the newsgroup comp.unix.aix, there are some IBM people
there that may be able to help.

dave

Olivier Hislaire wrote:
> 
> Hi there,
> 
> I am trying to build the mod_jserv.so shared object in IX 4.3.1.0, using
> gcc 2.7.2, apxs from apache 1.3.19 (binary distribution for aix4.3) and
> tomcat 3.2.1. And I *almost* made it :-(
> 
> Since, there is just one stupid problem in linking the share object (see
> below); could anybody help me with this, or tell me where to find a
> suitable mod_jserv.so for my aix box ?
> 
> Thanks,
> 
> Olivier
> 
> ------------- start of inclusion
> 
> (...)
> 
> gcc -DAIX=43 -DUSE_PTHREAD_SERIALIZED_ACCEPT -U__STR__ -DAIX_BIND_PROCESSOR
> -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite -fpic -DSHARED_MODULE
> -I/usr/local/apache/include -c mod_jserv.c
> 
> ld -H512 -T512 -bhalt:4 -bM:SRE -bnoentry
> -bI:/usr/local/apache/libexec/httpd.exp -lc -o mod_jserv.so mod_jserv.o
> jserv_wrapper_win.o jserv_wrapper_unix.o jserv_wrapper.o jserv_watchdog.o
> jserv_utils.o jserv_status.o jserv_protocols.o jserv_mmap.o jserv_image.o
> jserv_balance.o jserv_ajpv12.o jserv_ajpv11.o autochange.o
> 
> ld: 0711-244 ERROR: No csects or exported symbols have been saved.
> apxs:Break: Command failed with rc=8
> 
> ------------- end
> ------------------------------------------------------------------------------------------------
> Olivier Hislaire
> 
> MSG International                   Email:   O.Hislaire@msg-i.com
> 97 Avenue de Tervuren             Phone: +32 (0)2 735.91.59 Ext. 55
> 1040 Brussels                         Fax:     +32 (0)2 732.12.19
> Belgium                                  http://www.msg-i.com
> ------------------------------------------------------------------------------------------------

-- 
Dave Weis
businessolver, Inc.
djweis@businessolver.com
http://www.businessolver.com/

mod_jserv compilation problem (AIX)

Posted by Olivier Hislaire <O....@msg-i.com>.
Hi there,

I am trying to build the mod_jserv.so shared object in IX 4.3.1.0, using 
gcc 2.7.2, apxs from apache 1.3.19 (binary distribution for aix4.3) and 
tomcat 3.2.1. And I *almost* made it :-(

Since, there is just one stupid problem in linking the share object (see 
below); could anybody help me with this, or tell me where to find a 
suitable mod_jserv.so for my aix box ?

Thanks,

Olivier

------------- start of inclusion

(...)

gcc -DAIX=43 -DUSE_PTHREAD_SERIALIZED_ACCEPT -U__STR__ -DAIX_BIND_PROCESSOR 
-DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite -fpic -DSHARED_MODULE 
-I/usr/local/apache/include -c mod_jserv.c

ld -H512 -T512 -bhalt:4 -bM:SRE -bnoentry 
-bI:/usr/local/apache/libexec/httpd.exp -lc -o mod_jserv.so mod_jserv.o 
jserv_wrapper_win.o jserv_wrapper_unix.o jserv_wrapper.o jserv_watchdog.o 
jserv_utils.o jserv_status.o jserv_protocols.o jserv_mmap.o jserv_image.o 
jserv_balance.o jserv_ajpv12.o jserv_ajpv11.o autochange.o

ld: 0711-244 ERROR: No csects or exported symbols have been saved.
apxs:Break: Command failed with rc=8

------------- end
------------------------------------------------------------------------------------------------
Olivier Hislaire

MSG International                   Email:   O.Hislaire@msg-i.com
97 Avenue de Tervuren             Phone: +32 (0)2 735.91.59 Ext. 55
1040 Brussels                         Fax:     +32 (0)2 732.12.19
Belgium                                  http://www.msg-i.com
------------------------------------------------------------------------------------------------




Re: Am I crazy???

Posted by Hasan Bramwell <ha...@ECNET.EC>.
Felix

No yr not crazy, just a littl masochistic maybe  :-)
(either that or I've missed the point)

instead of ...

>    public void service(HttpServletRequest Req, HttpServletResponse Res)
>           throws ServletException, IOException
>    {

why don't you try ...

 public void doGet(HttpServletRequest Req, HttpServletResponse Res)
           throws ServletException, IOException
 {
   theRestOfIt(Req, Res);
 }

 public void doPost(HttpServletRequest Req, HttpServletResponse Res)
           throws ServletException, IOException
 {
   theRestOfIt(Req, Res);
 }

 private void theRestOfIt(Req, Res)
           throws ServletException, IOException
 {
     what you really need to do here...
 }

the documentation says pretty clearly not to use 'service' -- "This
method is rarely overridden."


Hasan


> From: "Felix A. Milovanov" 
>  Subject:  Am I crazy???
>  Date:  Mon, 09 Apr 2001 17:48:14 -0700
>    Hello all,
> 
>    now I start using Tomcat and servlet/JSP programming. I was need
>  to make some
>  activity BEFORE invoking any servlet/JSP. I've created a very simple
>  class :
> 
>  import java.io.*;
>  import java.sql.*;
>  import java.lang.*;
>  import java.util.*;
>  import javax.servlet.*;
>  import javax.servlet.http.*;
>  import javax.servlet.jsp.*;
> 
>  public abstract class baseServlet extends HttpServlet implements
>  HttpJspPage
>  {
> 
>    public void _jspService(HttpServletRequest Req,
>  HttpServletResponse Res)
>           throws ServletException, IOException {}
> 
>    public void jspInit() {}
>    public void jspDestroy() {}
> 
>    public void service(HttpServletRequest Req, HttpServletResponse
>  Res)
>           throws ServletException, IOException
>    {
>      String Path = Req.getServletPath();
> 
>      System.out.println("URL called : " + Path);
> 
>      /* Invoke original handler */
>      if (Path.endsWith(".jsp")) _jspService(Req, Res);
>                           else  super.service(Req, Res);
>    }
> 
> 
>  }
> 
>    I can inherit any servlet/JSP from this class, and now I just
>  print to
>  console the URI of requested WEB resource.
> 
>    Ok, everything works. Then I tried to handle error 404 with Tomcat
>  - I've
>  already described 404 handler for apache :
> 
>  ErrorDocument 404 /404.jsp
> 
>    /404.jsp works excellent, but when I tried to run something non-
>  existed
>  URI like "/servelt/bla-bla-bla", I got an error from Tomcat instead
>  of
>  /404.jsp. Ok, I read the documentation and found how it should be
>  done:
> 
>  <web-app>
>   <error-page>
>    <error-code>404</error-code>
>    <location>/404.jsp</location>
>   </error-page>
>  </web-app>
> 
>    For now these lines are all in my web.xml. I've restarted tomcat,
>  tried
>  to access /servlet/hmm and got the following message ( insted of my
>  own /404.jsp ) :
> 
>  Error: 400
>  Location: /servlet/hmm
>  HTTP method GET is not supported by this URL
> 
>    The most strange issue is... I'VE GOT MESSAGE "URI called :
>  /servlet/hmm"
>  ON THE CONSOLE!!!
> 
>    I do not understand anything... WHY MY CODE IS INVOKED???
> 
>    Sincerely,
>                                                          Felix.
>

Can AJP13 & mod_jk do a multi-machine configuration??

Posted by Hasan Bramwell <ha...@ECNET.EC>.
Hi.

Can AJP13 & mod_jk do a multi-machine configuration, or do I have to use
mod_jserv??

I can't get a working configuration of Apache with mod_jk to talk ajp13
to TomCat on a different physical server.

Is this supposed to be possible?

Could someone please post a working set of config files that show that
in action?

The documentation has such a mix of mod_jserv and mod_jk configuration
file examples, with little guidance as to what is current and what is
obsolete, that it is really hard to tell which alternatives to follow.

I've been using Apache JServ with great success since late 1998.  I'm
now trying to convert a big project to TomCat.  I have the whole project
setup and working in a single machine.  To go into production I need to
have several physical servers running TomCat behind my Apache server,
but I can't get anything to work.

I'm assuming that what I currently do with mod_jserv configurations ...

  jserv.conf:
                         :
                         :
     ApJServMount /search ajpv12://200.31.10.52:8007/SRI_Zone
                         :
                         :

is accomplished under mod_jk like this ...

  worker.properties
                         :
                         :
    worker.list=ajp13, SRI
    
    worker.SRI.port=8007
    worker.SRI.host=200.31.10.52
    worker.SRI.type=ajp13
                         :
                         :

  mod_jk.conf
                         :
                         :
    JkMount /search SRI
                         :
                         :

... but, (among many other doubts),  I don't get how to create the
equivalent of SRI_Zone on the remote machine.

I think I'm not the only one who would appreciate a good set of examples
of this.

TIA

Hasan