Re: how do I enable CGI scripts in Tomcat 6?

2010-01-13 Thread Grossman, Robert B
Thanks for your reply, Chuck.

(1) We do indeed have Context privileged=true.  The lower-case C was my 
typo.  I'm not sure why my collaborator decided to set the value here rather in 
the web app, but we have only one web app running on this machine anyway.
(2) We only copied servlets-cgi.renametojar after the steps in 
http://tomcat.apache.org/tomcat-6.0-doc/cgi-howto.html failed to work.  Per 
your advice, I have now removed it.
(3) Here's what we currently have in $CATALINA_BASE/conf/web.xml:

servlet
servlet-namecgi/servlet-name
servlet-classorg.apache.catalina.servlets.CGIServlet/servlet-class
init-param
  param-namedebug/param-name
  param-value1/param-value
/init-param
init-param
  param-namecgiPathPrefix/param-name
  param-valueWEB-INF/cgi-bin/param-value
/init-param
 load-on-startup5/load-on-startup
/servlet

servlet-mapping
servlet-namecgi/servlet-name
url-pattern/cgi-bin/*/url-pattern
/servlet-mapping

(4) Our web app is in /home/aceorg/aceorg/DEV-2.2/.  It has two branches, 
epoch-plugin/ and courseware/.  epoch-plugin/web/WEB-INF/ now contains 
cgi-bin/, which contains many cgi scripts, including login.cgi.  Most of our 
web app requires a login, so we are unable to point our browser to 
WEB-INF/cgi-bin/login.cgi directly.  However, we do have a public access folder 
at epoch-plugin/web/public/, which a Web browser can access at 
http://domain/epoch-plugin/public/, so I made a symlink public/webmo/cgi-bin to 
point to WEB-INF/cgi-bin.  When we point a browser to 
http://domain/epoch-plugin/public/webmo/cgi-bin/login.cgi, we see the text for 
WEB-INF/cgi-bin/login.cgi.

I have tried various other arrangements and names of the files, to no avail.  I 
also tried putting the above XML in WEB-INF/web.xml instead of 
$CATALINA_BASE/conf/web.xml, again to no avail.  I am ready to try anything you 
suggest.


From: Caldarale, Charles R chuck.caldar...@unisys.com
Reply-To: Tomcat Users List users@tomcat.apache.org
Date: Tue, 12 Jan 2010 23:09:14 -0500
To: Tomcat Users List users@tomcat.apache.org
Conversation: how do I enable CGI scripts in Tomcat 6?
Subject: RE: how do I enable CGI scripts in Tomcat 6?

 From: Grossman, Robert B [mailto:robert.gross...@uky.edu]
 Subject: how do I enable CGI scripts in Tomcat 6?

 The descriptions of the CGI enabling process that we have found on
 the Web, e.g. http://tomcat.apache.org/tomcat-6.0-doc/cgi-howto.html

That's the right one.

 and 
 http://www.wellho.net/solutions/java-running-cgi-scripts-in-apache-tomcat.html

Sadly out of date and seriously broken.  Use the real doc.

 We already had set context privileged=true in Tomcat's context.xml.

That's wrong.  First, it's Context, not context - case matters.  Second, 
you shouldn't be setting this attribute globally, but rather in just the 
webapps that need it.

 We created a WEB-INF/cgi directory in our web app's hierarchy.  In
 $CATALINA_BASE/conf/web.xml, we uncommented the CGI servlet description
 and servlet matching, and we set the cgiPathPrefix to WEB-INF/cgi/ and
 the servlet matching pattern to /cgi/*.

Please post (via copy and paste) those sections of conf/web.xml so we can see 
what you actually did.  Too often people see what they expect, not what's there.

 We downloaded servlets-cgi.renametojar from a Tomcat 5 distribution,

Bad move.  Where in the Tomcat 6 doc does it say to do that?  You just broke 
your Tomcat 6 installation.

 Tomcat 6 did not come with this file.

Because it doesn't need it.

 Nor, for that matter, can we find a preexisting cgi-bin directory anywhere.

Nor should you.  That's simply a part of the URL that triggers the CGI servlet, 
not an actual directory.  The script path is specified by the cgiPathPrefix 
parameter.

 when we browse to a CGI script in WEB-INF/cgi/ (we actually access
 it through a symlink in a different, publicly accessible directory)

Don't muck with symlinks until you've got it working.  No point in introducing 
extra trouble spots until the basics are functional.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: how do I enable CGI scripts in Tomcat 6?

2010-01-13 Thread Grossman, Robert B
Well, butter my butt and call me a biscuit.  Accessing that URL works!

I think I can handle it from here.  Thanks again.

P.S.  Sorry for the nomenclature confusion, I'm really a chemist, not a 
computer programmer.



From: Christopher Schultz ch...@christopherschultz.net
Reply-To: Tomcat Users List users@tomcat.apache.org
Date: Wed, 13 Jan 2010 10:37:56 -0500
To: Tomcat Users List users@tomcat.apache.org
Conversation: how do I enable CGI scripts in Tomcat 6?
Subject: Re: how do I enable CGI scripts in Tomcat 6?

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Robert,

On 1/13/2010 9:25 AM, Grossman, Robert B wrote:
 servlet
 servlet-namecgi/servlet-name
 servlet-classorg.apache.catalina.servlets.CGIServlet/servlet-class
 init-param
   param-namedebug/param-name
   param-value1/param-value
 /init-param
 init-param
   param-namecgiPathPrefix/param-name
   param-valueWEB-INF/cgi-bin/param-value
 /init-param
  load-on-startup5/load-on-startup
 /servlet

 servlet-mapping
 servlet-namecgi/servlet-name
 url-pattern/cgi-bin/*/url-pattern
 /servlet-mapping

 (4) Our web app is in /home/aceorg/aceorg/DEV-2.2/. It has two
 branches, epoch-plugin/ and courseware/. epoch-plugin/web/WEB-INF/ now
 contains cgi-bin/, which contains many cgi scripts, including login.cgi.

Just to get some nomenclature straight: the term branch is meaningless
to the servlet specification. If that term has some internal meaning to
you, it does not to us. The directory /home/aceorg/DEV-2.2 is more
likely the appBase for a Host defined in Tomcat's conf/server.xml.
That means it's the directory used for auto-deployed WAR files and
directory-based webapps. The epoch-plugin and courseware branches, as
you call them, are really independent webapps. You can tell because each
one of them has a separate WEB-INF/web.xml file.

 Most of our web app requires a login, so we are unable to point our
 browser to WEB-INF/cgi-bin/login.cgi directly.

If you have an executable file in WEB-INF/cgi-bin/login.cgi, then you
should be accessing it using this URL:

http://host/epoch-plugin/cgi-bin/login.cgi
and not
http://host/epoch-plugin/WEB-INF/cgi-bin/login.cgi

Note that you configured this explicitly in the CGIServlet (see above)
using the url-pattern of /cgi-bin/*. There's no WEB-INF in that path.

 However, we do have a public access folder at
 epoch-plugin/web/public/, which a Web browser can access at
 http://domain/epoch-plugin/public/, so I made a symlink
 public/webmo/cgi-bin to point to WEB-INF/cgi-bin. When we point a
 browser to
 http://domain/epoch-plugin/public/webmo/cgi-bin/login.cgi, we see the
 text for WEB-INF/cgi-bin/login.cgi.

Your URL path for the CGIServlet is /cgi-bin/* not
/public/webmo/cgi-bin/*, so the CGIServlet isn't being invoked. By
adding that symlink, you have allowed the DefaultServlet to serve the
raw bytes of the .cgi file, so you see the source code of your perl
script (or whatever).

Try removing the symlink and hitting this URL:

http://host/epoch-plugin/cgi-bin/login.cgi

What happens?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktN6NQACgkQ9CaO5/Lv0PBv7wCgv16UkUZM2edmPV5i9jvFQ6aV
o5EAn144Hb9S+ccbTUz7wSfNYkhRnibh
=gcZp
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



how do I enable CGI scripts in Tomcat 6?

2010-01-12 Thread Grossman, Robert B
We have a web application running in Tomcat 6 on Ubuntu, and we want to run CGI 
scripts in Perl via the browser.  The descriptions of the CGI enabling process 
that we have found on the Web, e.g. 
http://tomcat.apache.org/tomcat-6.0-doc/cgi-howto.html and 
http://www.wellho.net/solutions/java-running-cgi-scripts-in-apache-tomcat.html 
, seem simple enough, but they have not worked for us.

We already had set context privileged=true in Tomcat's context.xml.  We 
created a WEB-INF/cgi directory in our web app's hierarchy.  In 
$CATALINA_BASE/conf/web.xml, we uncommented the CGI servlet description and 
servlet matching, and we set the cgiPathPrefix to WEB-INF/cgi/ and the servlet 
matching pattern to /cgi/*.  (We also tried cgi/* and cgi-bin/* , with no 
better results.)

We downloaded servlets-cgi.renametojar from a Tomcat 5 distribution, copied it 
into $CATALINA_BASE/lib/, renamed it to servlets-cgi.jar, and put a symlink to 
it in usr/share/tomcat6/lib/.  (Tomcat 6 did not come with this file.  Nor, for 
that matter, can we find a preexisting cgi-bin directory anywhere.)

After each step we restarted Tomcat, but when we browse to a CGI script in 
WEB-INF/cgi/ (we actually access it through a symlink in a different, publicly 
accessible directory), the browser displays it simply as text instead of 
running it as a Perl script.  The first line of the file says #!/usr/bin/perl, 
and we have confirmed that we have a working Perl installation at that 
location.  Shortly thereafter, the file tells us we haven't configured our Web 
server to run CGI scripts.

We also tried modifying our web app's WEB-INF/web.xml instead of the 
$CATALINA_BASE/conf/web.xml, but no joy.

I'm sure we're missing something obvious to those in the know, but it's not 
obvious to us.  Any suggestions would be welcome.

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org