You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jared Nedzel <ne...@mpi.com> on 2002/02/22 17:58:15 UTC

TC4 and cgi

Folks:

I'm running Tomcat 4.0.2 on Solaris.  I'm trying to
configure Tomcat to support perl cgis, but I'm getting
404.  I've done the following so far:

I've copied $CATALINA_HOME/server/lib/servlets-ssi.renametojar
to $CATALINE_HOME/server/lib/servlets-ssi.jar

I've copied $CATALINA_HOME/server/lib/servlets-cgi.renametojar
to $CATALINE_HOME/server/lib/servlets-cgi.jar

I've edited $CATALINA_HOME/conf/web.xml as follows:

  - commented in servlet ssi
  - commented in servlet cgi
  - commented in servlet mapping for ssi
  - commented in servlet mapping for cgi

I've created an app directory $CATALINA_HOME/webapps/websub.
Inside that directory, I've created a WEB-INF directory.
Inside that, I've created a cgi directory.  I've put my perl
cgi's inside the cgi directory.

Do I need a web.xml inside the WEB-INF directory?  And if
so, what should it contain?

I'd really appreciate it if someone could point me towards a
perl cgi "hello world" configuration for Tomcat 4.

Thanks,

Jared Nedzel
nedzel@mpi.com


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: TC4 and cgi

Posted by Jared Nedzel <ne...@mpi.com>.
Bill:

Thanks for getting me started down the right path.
Your web.xml stuff worked great.

Unfortunately, it appears that the CGI servlet has
problems with cgi form variables.  Our perl cgi
code works perfectly under apache.  Under TC 4.0.2,
the form variables are not passed to the cgi.

Has anyone else experienced this?

Jared


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


RE: TC4 and cgi

Posted by Bill Boland <bo...@mediaone.net>.
Jared,

Ironically, I also was trying to get the CGIServlet to work on Friday
with great difficulty. I believe I got it to work (although I am not a
Perl person). I am using tomcat on Windows 2000 and I just wanted to
invoke an test executable batch file (test.bat) just to see if I could
get the ting to work. I assume you can replace what I did with your perl
scripts and be on your way.

One flaw I noticed in the documentation for the CGIServlet is that the
example does not work in TC 4.0.2 unless you specify a cgiPathPrefix of
"WEB-INF/cgi". The default is actually a null value and so no path is
added to the base of the web application. For example, if the web
application is at path "/foo" and you do not specify a cgiPathPrefix,
then when you enter http://localhost/foo/cgi-bin/test.bat it looks at
the "/foo" directory. At least the source code and testing proved
otherwise. I hope some contributor will read this and verify and correct
this. I'm new to this list so I don't know the ropes too well.

I am using TC as a web server and have not attempted to integrate it
with Apache HTTP Server. Of course, the Apache Server can handle the CGI
requests for you too.

Anyway, here's some snippets from the web.xml file for a web application
in TC 4.0.2. My web application has a path of "/foo" for the web.xml
file is at "/foo/WEB-INF/web.xml" and I create the directory named "cgi"
in the "/foo/WEB-INF" directory. I renamed just the
servlets-cgi.renametojar since I only needed the CGI capability. Now I
just need to hook into the CGI I want to use (Crystal Reports CGI
interface).


  <servlet>
    <servlet-name>cgi</servlet-name>
 
<servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
    <init-param>
      <param-name>cgiPathPrefix</param-name>
      <param-value>WEB-INF/cgi</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>99</param-value>
    </init-param>
  </servlet>

  <servlet-mapping>
    <servlet-name>cgi</servlet-name>
    <url-pattern>/cgi-bin/*</url-pattern>
  </servlet-mapping>


Hope this helps,

bill


-----Original Message-----
From: Jared Nedzel [mailto:nedzel@mpi.com] 
Sent: Friday, February 22, 2002 12:17 PM
To: Tomcat Users List
Subject: Re: TC4 and cgi

Paul:

That doesn't appear to me to be the case, given that TC 4
has a bunch of stuff in web.xml concerning CGIs.  For example
there are entries in web.xml like:

<!-- IMPORTANT: To use the CGI servlet, you also need to rename the
<!--            $CATALINA_HOME/server/lib/servlets-ssi.renametojar file
<!--            to $CATALINA_HOME/server/lib/servlets-ssi.jar

and:

<!-- Common Gateway Includes (CGI) processing servlet, which supports
<!-- execution of external applications that conform to the CGI spec
<!-- requirements.  Typically, this servlet is mapped to the URL pattern
<!-- "/cgi-bin/*", which means that any CGI applications that are
<!-- executed must be present within the web application.  This servlet
<!-- supports the following initialization parameters (default values
<!-- are in square brackets):
<!--
<!--   cgiPathPrefix       The CGI search path will start at
<!--                       webAppRootDir + File.separator + this prefix.
<!--                       [WEB-INF/cgi]
<!--
<!--   clientInputTimeout  The time (in milliseconds) to wait for input
<!--                       from the browser before assuming that there
<!--                       is none.  [100]
<!--
<!--   debug               Debugging detail level for messages logged
<!--                       by this servlet.  [0]
<!-- IMPORTANT: To use the CGI servlet, you also need to rename the
<!--            $CATALINA_HOME/server/lib/servlets-cgi.renametojar file
<!--            to $CATALINA_HOME/server/lib/servlets-cgi.jar


But if that is the case, then can someone point me to
doc about how I can integrate TC 4 with Apache?  The
previous versions of TC document this pretty well:

http://jakarta.apache.org/tomcat/tomcat-3.3-doc/tomcat-apache-howto.html

Where's the equivalent for TC 4?  I've seen doc for TC 4
that discusses proxy servers, but I don't know enough to know
whether that's the same thing, or something different.

Someone help out a flailing newbie here...

Jared

Paul D. Bain wrote:
> At Friday 2/22/02 11:58 AM, you wrote:
>         I am not an expert on Tomcat 4, but am 90% sure that it cannot

> begin execution of any executable program/script other than a 
> servlet/JSP. My understanding (which may be flawed) of this issue is 
> that, if you want to run both Perl and servlets, you must put an
Apache 
> web server in front of Tomcat and have it process requests according
to 
> whether they invoke Perl files (e.g., the request is for a file whose 
> suffix is ".pl") or a servlet (which typically has a different suffix,

> to wit, ".jsp" or ".java"). Apache would process requests for the
former 
> via CGI and send requests for the latter to Tomcat.


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>




--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: TC4 and cgi

Posted by Jared Nedzel <ne...@mpi.com>.
Paul:

That doesn't appear to me to be the case, given that TC 4
has a bunch of stuff in web.xml concerning CGIs.  For example
there are entries in web.xml like:

<!-- IMPORTANT: To use the CGI servlet, you also need to rename the
<!--            $CATALINA_HOME/server/lib/servlets-ssi.renametojar file
<!--            to $CATALINA_HOME/server/lib/servlets-ssi.jar

and:

<!-- Common Gateway Includes (CGI) processing servlet, which supports
<!-- execution of external applications that conform to the CGI spec
<!-- requirements.  Typically, this servlet is mapped to the URL pattern
<!-- "/cgi-bin/*", which means that any CGI applications that are
<!-- executed must be present within the web application.  This servlet
<!-- supports the following initialization parameters (default values
<!-- are in square brackets):
<!--
<!--   cgiPathPrefix       The CGI search path will start at
<!--                       webAppRootDir + File.separator + this prefix.
<!--                       [WEB-INF/cgi]
<!--
<!--   clientInputTimeout  The time (in milliseconds) to wait for input
<!--                       from the browser before assuming that there
<!--                       is none.  [100]
<!--
<!--   debug               Debugging detail level for messages logged
<!--                       by this servlet.  [0]
<!-- IMPORTANT: To use the CGI servlet, you also need to rename the
<!--            $CATALINA_HOME/server/lib/servlets-cgi.renametojar file
<!--            to $CATALINA_HOME/server/lib/servlets-cgi.jar


But if that is the case, then can someone point me to
doc about how I can integrate TC 4 with Apache?  The
previous versions of TC document this pretty well:

http://jakarta.apache.org/tomcat/tomcat-3.3-doc/tomcat-apache-howto.html

Where's the equivalent for TC 4?  I've seen doc for TC 4
that discusses proxy servers, but I don't know enough to know
whether that's the same thing, or something different.

Someone help out a flailing newbie here...

Jared

Paul D. Bain wrote:
> At Friday 2/22/02 11:58 AM, you wrote:
>         I am not an expert on Tomcat 4, but am 90% sure that it cannot 
> begin execution of any executable program/script other than a 
> servlet/JSP. My understanding (which may be flawed) of this issue is 
> that, if you want to run both Perl and servlets, you must put an Apache 
> web server in front of Tomcat and have it process requests according to 
> whether they invoke Perl files (e.g., the request is for a file whose 
> suffix is ".pl") or a servlet (which typically has a different suffix, 
> to wit, ".jsp" or ".java"). Apache would process requests for the former 
> via CGI and send requests for the latter to Tomcat.


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: TC4 and cgi

Posted by "Paul D. Bain" <pa...@bigfoot.com>.
At Friday 2/22/02 11:58 AM, you wrote:
>Folks:
>
>I'm running Tomcat 4.0.2 on Solaris.  I'm trying to
>configure Tomcat to support perl cgis, but I'm getting
>404.

         I am not an expert on Tomcat 4, but am 90% sure that it cannot 
begin execution of any executable program/script other than a servlet/JSP. 
My understanding (which may be flawed) of this issue is that, if you want 
to run both Perl and servlets, you must put an Apache web server in front 
of Tomcat and have it process requests according to whether they invoke 
Perl files (e.g., the request is for a file whose suffix is ".pl") or a 
servlet (which typically has a different suffix, to wit, ".jsp" or 
".java"). Apache would process requests for the former via CGI and send 
requests for the latter to Tomcat.


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>