Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 74673 invoked from network); 1 Aug 2010 13:27:21 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 Aug 2010 13:27:21 -0000 Received: (qmail 64419 invoked by uid 500); 1 Aug 2010 13:27:18 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 64133 invoked by uid 500); 1 Aug 2010 13:27:15 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 64124 invoked by uid 99); 1 Aug 2010 13:27:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Aug 2010 13:27:14 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of TroyLParrish@aol.com designates 64.12.78.142 as permitted sender) Received: from [64.12.78.142] (HELO imr-ma06.mx.aol.com) (64.12.78.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Aug 2010 13:27:07 +0000 Received: from imo-ma02.mx.aol.com (imo-ma02.mx.aol.com [64.12.78.137]) by imr-ma06.mx.aol.com (8.14.1/8.14.1) with ESMTP id o71DQU5x015151 for ; Sun, 1 Aug 2010 09:26:30 -0400 Received: from TroyLParrish@aol.com by imo-ma02.mx.aol.com (mail_out_v42.9.) id w.cfc.7a759035 (45500) for ; Sun, 1 Aug 2010 09:26:25 -0400 (EDT) Received: from smtprly-me03.mx.aol.com (smtprly-me03.mx.aol.com [64.12.95.104]) by cia-mc08.mx.aol.com (v129.4) with ESMTP id MAILCIAMC087-b3104c5575ffed; Sun, 01 Aug 2010 09:26:25 -0400 Received: from webmail-m051 (webmail-m051.sim.aol.com [64.12.140.161]) by smtprly-me03.mx.aol.com (v129.4) with ESMTP id MAILSMTPRLYME038-b3104c5575ffed; Sun, 01 Aug 2010 09:26:23 -0400 References: <4C553963.5040909@apache.org> <8CCFF8ADCA0FBC9-1F40-1818A@Webmail-m104.sysops.aol.com> <0BAC55F2410344A39ACF506A1527C150@phoenix> To: users@tomcat.apache.org Subject: Re: Calling a CGI script from Servlet Date: Sun, 01 Aug 2010 09:26:23 -0400 X-AOL-IP: 98.204.131.120 In-Reply-To: <0BAC55F2410344A39ACF506A1527C150@phoenix> X-MB-Message-Source: WebUI MIME-Version: 1.0 From: troylparrish@aol.com X-MB-Message-Type: User Content-Type: multipart/alternative; boundary="--------MB_8CCFF9445532480_10D4_36ED2_webmail-m051.sysops.aol.com" X-Mailer: AOL Webmail 32360-STANDARD Received: from 98.204.131.120 by webmail-m051.sysops.aol.com (64.12.140.161) with HTTP (WebMailUI); Sun, 01 Aug 2010 09:26:23 -0400 Message-Id: <8CCFF94454E61C0-10D4-2612E@webmail-m051.sysops.aol.com> X-AOL-SENDER: TroyLParrish@aol.com X-Old-Spam-Flag: NO ----------MB_8CCFF9445532480_10D4_36ED2_webmail-m051.sysops.aol.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" Yes, I mean /home/troy . . . =20 =20 =20 =20 -----Original Message----- From: Jason Pyeron To: 'Tomcat Users List' Sent: Sun, Aug 1, 2010 9:19 am Subject: RE: Calling a CGI script from Servlet =20 > -----Original Message----- > From: troylparrish@aol.com [mailto:troylparrish@aol.com]=20 > Sent: Sunday, August 01, 2010 8:19 > To: users@tomcat.apache.org > Subject: Re: Calling a CGI script from Servlet >=20 >=20 >=20 >=20 > Mark, >=20 > Thanks for the reply. I am using Tomcat 6.0.20. The script=20 > is located in WEB-INF/cgi and in the call I am using an absolute path: >=20 > //System Call > String[cmd] =3D {"python",=20 > 'home/troy/NetBeansProjects/GSMFilter/web/WEB-INF/cgi/helloWor Do you mean /home? > ld.py", "-c"}; Runtime rt =3D Runtime.getRuntime(); Process proc =3D > rt.exec(cmd); int exitVal =3D proc.waitFor(); >=20 > //Write exit value to file - Get value of zero=20 > toFile.write("" + exitVal); >=20 > MY ORIGINAL POST:=20 >=20 > I am new to configuring tomcat (I have run it for a few years=20 > as it is packaged with Netbeans) and new to linux and I am=20 > stuck on a particular problem. >=20 > I have a project in which I am trying to call a python code=20 > from a servlet. I am using tomcat6 on Ubuntu 10.04. I have=20 > used both Runtime.exec() as well as ProcessBuilder to make=20 > the call. I have completely copied the code from the=20 > JavaWorld article When Runtime.exec() won't=20 > (http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.h tml). ; I have granted full permissions on all the files (read, > write an= d execute). When I get an exit value on the=20 > execution of the script I get a value of 0 (zero). I am able=20 > to execute the script from a simple java program in this=20 > environment (tomcat and Ubuntu) using the same syntax but not=20 > in the servlet. I am able to execute the script from the=20 > servlet in Ubuntu 10.04 from glassfish and I am able to=20 > execute the script from the servlet in tomcat6 in a windows=20 > environment. However, when I try to execute the script from=20 > the servlet in tomcat6 and Ubuntu 10.04 - nothing - even=20 > though I get the exit value of zero, I get the zero value=20 > returned but no action from the script (all it does is open=20 > the default browser). >=20 > I have made the following changes in my tomcat installation: >=20 > Uncommented the following in the web.xml: >=20 > > cgi > =20 > org.apache.catalina.servlets.CGIServlet > > debug > 0 > > > cgiPathPrefix > WEB-INF/cgi > > 5 > >=20 > > cgi > /cgi-bin/* > >=20 > My tomcat-users: >=20 > >=20 > > > > > > > =20 >=20 > >=20 > Change made in context.xml: > >=20 > Added to system.policy: > // Grant WebApps All Permission > grant codeBase "file:/var/lib/tomcat6/webapps/-" { > permission java.security.AllPermission; }; >=20 > Added to catalina.policy: > grant codeBase "file:${catalina.home}/webapps/GSMFilter/-" { > java.io.FilePermission=20 > "/var/libs/tomcat6/webapps/GSMFilter/WEB-INF/storage/< FILES>>", "read,write,execute,delete"; }; >=20 > grant codeBase "file:${catalina.home}/webapps/GSMFilter/-"{ > permission java.security.AllPermission; }; >=20 > grant codeBase "file:${catalina.home}/webapps/GSMFilter/-"{ > permission java.lang.RuntimePermission=20 > "/home/troy/NetBeansProjects/GSMFilter/web/WEB-INF/storage/<>", "read,write,execute,delete"; >=20 > =20 -- -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- - - - Jason Pyeron PD Inc. http://www.pdinc.us - - Principal Consultant 10 West 24th Street #100 - - +1 (443) 269-1555 x333 Baltimore, Maryland 21218 - - - -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- This message is copyright PD Inc, subject to license 20080407P00. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org =20 ----------MB_8CCFF9445532480_10D4_36ED2_webmail-m051.sysops.aol.com--