You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Shabu Khan <hi...@gmail.com> on 2008/04/11 20:45:17 UTC

Perl CGI setup

Hi there,
I am having trouble executing a perl script through tomcat by hitting a URL.

THis is what I've done so far:
1. Followed all the necessary instructions to setup CGI via
${CATALINA_HOME}/conf/web.xml
    Did the following:
     >Renamed $CATALINA_HOME/server/lib/servlets-cgi.renametojar file
to $CATALINA_HOME/server/lib/servlets-cgi.jar
     >I've the following cgi config:
    <servlet>
        <servlet-name>cgi</servlet-name>
        <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
        <init-param>
          <param-name>debug</param-name>
          <param-value>0</param-value>
        </init-param>
        <init-param>
          <param-name>cgiPathPrefix</param-name>
          <param-value>WEB-INF/cgi</param-value>
        </init-param>
        <init-param>
          <param-name>passShellenvironment</param-name>
          <param-value>true</param-value>
        </init-param>
        <load-on-startup>5</load-on-startup>
    </servlet>
<!-- The mapping for the CGI Gateway servlet -->
    <servlet-mapping>
        <servlet-name>cgi</servlet-name>
        <url-pattern>/cgi/*</url-pattern>
    </servlet-mapping>
     >I left the web.xml in ${CATALINA_HOME}/webapps/ROOT/WEB-INF as it is.
2. cd ${CATALINA_HOME}/webapps/ROOT/WEB-INF
3. mkdir cgi
4. cd cgi; web_xml_mon.pl and the configs are in this directory
5. ${CATALINA_HOME}/bin/shutdown.sh; ${CATALINA_HOME}/bin/startup.sh
6. Trying to hit the URL like this -
http://myhostname.FQDN:8080/WEB-INF/cgi/web_xml_mon.pl?qa-1

I get:
--------------------------
HTTP Status 404 - /WEB-INF/cgi/web_xml_mon.pl
type Status report
message /WEB-INF/cgi/web_xml_mon.pl
description The requested resource (/WEB-INF/cgi/web_xml_mon.pl) is
not available.

Apache Tomcat/4.1.37-LE-jdk1.4
--------------------------

Any thoughts?

Thanks,

-- 
Shabu Khan | Mentis Systems Inc | W: (425) 649-1130 | C: (425)
301-1948 | F: (425) 256-2819

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Perl CGI setup

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Shabu Khan [mailto:hishabu@gmail.com] 
> Subject: Re: Perl CGI setup
> 
> What should that url pattern value be in my scenario?

What part of /WEB-INF/cgi doesn't match your declared <url-pattern>?
(Hint: it's all caps.)

 - 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Perl CGI setup

Posted by Shabu Khan <hi...@gmail.com>.
What should that url pattern value be in my scenario?

On Fri, Apr 11, 2008 at 12:06 PM, Hassan Schroeder
<ha...@gmail.com> wrote:
> On Fri, Apr 11, 2008 at 11:45 AM, Shabu Khan <hi...@gmail.com> wrote:
>
>  >  <!-- The mapping for the CGI Gateway servlet -->
>  >     <servlet-mapping>
>  >         <servlet-name>cgi</servlet-name>
>  >         <url-pattern>/cgi/*</url-pattern>
>  >     </servlet-mapping>
>
>
> >  http://myhostname.FQDN:8080/WEB-INF/cgi/web_xml_mon.pl?qa-1
>
>
> >  HTTP Status 404 - /WEB-INF/cgi/web_xml_mon.pl
>
>  Yeah, you've specified a url-pattern of /cgi/* and then tried to access
>  something different -- that's a good reason to not work :-)
>
>  --
>  Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
>
>  ---------------------------------------------------------------------
>  To start a new topic, e-mail: users@tomcat.apache.org
>  To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>  For additional commands, e-mail: users-help@tomcat.apache.org
>
>



-- 
Shabu Khan | Mentis Systems Inc | W: (425) 649-1130 | C: (425)
301-1948 | F: (425) 256-2819

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Perl CGI setup

Posted by David Smith <dn...@cornell.edu>.
I know at least Chuck has already responded, but it may need to be 
emphasized even more.  Tomcat will not allow clients to directly request 
_ANYTHING_ from the WEB-INF directory.  This is per the servlet spec.

--David

Shabu Khan wrote:
> Thanks Charles.
> I put it back:
> <servlet-mapping>
>         <servlet-name>cgi</servlet-name>
>         <url-pattern>/cgi/*</url-pattern>
>     </servlet-mapping>
>
> and restarted tomcat, we are still back to the same problem.
> http://myhost:8080/WEB-INF/cgi/web_xml_mon.pl?qa-1
>
> returns
> -----------------
> HTTP Status 404 - /WEB-INF/cgi/web_xml_mon.pl
> type Status report
> message /WEB-INF/cgi/web_xml_mon.pl
> description The requested resource (/WEB-INF/cgi/web_xml_mon.pl) is
> not available.
> Apache Tomcat/4.1.37-LE-jdk1.4
> -----------------
>
>
> On Fri, Apr 11, 2008 at 12:39 PM, Caldarale, Charles R
> <Ch...@unisys.com> wrote:
>   
>>> From: Shabu Khan [mailto:hishabu@gmail.com]
>>>       
>>  > Subject: Re: Perl CGI setup
>>  >
>>
>>     
>>> if my scripts/configs are in $CATALINA_HOME/webapps/ROOT/WEB-INF/cgi
>>>       
>>  > directory, what should the url-pattern be?
>>  >
>>
>>     
>>>  http://myhostname.FQDN:8080/WEB-INF/cgi/web_xml_mon.pl?qa-1
>>>       
>>  Your <url-pattern> is fine - all that does is select the servlet to pass
>>  the request to.  It's the URL you're using that's broken.  Just take out
>>  the /WEB-INF and leave the rest as is.
>>
>>  TGIF
>>
>>
>>   - 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 start a new topic, e-mail: users@tomcat.apache.org
>>  To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>  For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>     
>
>
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Perl CGI setup

Posted by Shabu Khan <hi...@gmail.com>.
sorry got it.
Thanks for your assistance.

Thanks,

On Fri, Apr 11, 2008 at 1:11 PM, Caldarale, Charles R
<Ch...@unisys.com> wrote:
> > From: Shabu Khan [mailto:hishabu@gmail.com]
>  > Subject: Re: Perl CGI setup
>  >
>
> > http://myhost:8080/WEB-INF/cgi/web_xml_mon.pl?qa-1
>  > returns
>  > -----------------
>  > HTTP Status 404 - /WEB-INF/cgi/web_xml_mon.pl
>
>  You're not reading or following the advice Hassan and I have been giving
>  you.  Read it again:
>
>
>  > > It's the URL you're using that's broken.  Just take out
>  > > the /WEB-INF and leave the rest as is.
>
>  If you take the /WEB-INF out of the URL you're trying to submit, it
>  should work.
>
>
>
>   - 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 start a new topic, e-mail: users@tomcat.apache.org
>  To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>  For additional commands, e-mail: users-help@tomcat.apache.org
>
>



-- 
Shabu Khan | Mentis Systems Inc | W: (425) 649-1130 | C: (425)
301-1948 | F: (425) 256-2819

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Perl CGI setup

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Shabu Khan [mailto:hishabu@gmail.com] 
> Subject: Re: Perl CGI setup
> 
> http://myhost:8080/WEB-INF/cgi/web_xml_mon.pl?qa-1
> returns
> -----------------
> HTTP Status 404 - /WEB-INF/cgi/web_xml_mon.pl

You're not reading or following the advice Hassan and I have been giving
you.  Read it again:

> > It's the URL you're using that's broken.  Just take out
> > the /WEB-INF and leave the rest as is.

If you take the /WEB-INF out of the URL you're trying to submit, it
should work.

 - 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Perl CGI setup

Posted by Shabu Khan <hi...@gmail.com>.
Thanks Charles.
I put it back:
<servlet-mapping>
        <servlet-name>cgi</servlet-name>
        <url-pattern>/cgi/*</url-pattern>
    </servlet-mapping>

and restarted tomcat, we are still back to the same problem.
http://myhost:8080/WEB-INF/cgi/web_xml_mon.pl?qa-1

returns
-----------------
HTTP Status 404 - /WEB-INF/cgi/web_xml_mon.pl
type Status report
message /WEB-INF/cgi/web_xml_mon.pl
description The requested resource (/WEB-INF/cgi/web_xml_mon.pl) is
not available.
Apache Tomcat/4.1.37-LE-jdk1.4
-----------------


On Fri, Apr 11, 2008 at 12:39 PM, Caldarale, Charles R
<Ch...@unisys.com> wrote:
> > From: Shabu Khan [mailto:hishabu@gmail.com]
>  > Subject: Re: Perl CGI setup
>  >
>
> > if my scripts/configs are in $CATALINA_HOME/webapps/ROOT/WEB-INF/cgi
>  > directory, what should the url-pattern be?
>  >
>
> >  http://myhostname.FQDN:8080/WEB-INF/cgi/web_xml_mon.pl?qa-1
>
>  Your <url-pattern> is fine - all that does is select the servlet to pass
>  the request to.  It's the URL you're using that's broken.  Just take out
>  the /WEB-INF and leave the rest as is.
>
>  TGIF
>
>
>   - 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 start a new topic, e-mail: users@tomcat.apache.org
>  To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>  For additional commands, e-mail: users-help@tomcat.apache.org
>
>



-- 
Shabu Khan | Mentis Systems Inc | W: (425) 649-1130 | C: (425)
301-1948 | F: (425) 256-2819

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Perl CGI setup

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Shabu Khan [mailto:hishabu@gmail.com] 
> Subject: Re: Perl CGI setup
> 
> if my scripts/configs are in $CATALINA_HOME/webapps/ROOT/WEB-INF/cgi
> directory, what should the url-pattern be?
>
>  http://myhostname.FQDN:8080/WEB-INF/cgi/web_xml_mon.pl?qa-1

Your <url-pattern> is fine - all that does is select the servlet to pass
the request to.  It's the URL you're using that's broken.  Just take out
the /WEB-INF and leave the rest as is.

TGIF

 - 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Perl CGI setup

Posted by Shabu Khan <hi...@gmail.com>.
Let me rephrase my question.

if my scripts/configs are in $CATALINA_HOME/webapps/ROOT/WEB-INF/cgi
directory, what should the url-pattern be?

I tried:
/WEB-INF/cgi/*.pl

but I get the same error ...

On Fri, Apr 11, 2008 at 12:06 PM, Hassan Schroeder
<ha...@gmail.com> wrote:
> On Fri, Apr 11, 2008 at 11:45 AM, Shabu Khan <hi...@gmail.com> wrote:
>
>  >  <!-- The mapping for the CGI Gateway servlet -->
>  >     <servlet-mapping>
>  >         <servlet-name>cgi</servlet-name>
>  >         <url-pattern>/cgi/*</url-pattern>
>  >     </servlet-mapping>
>
>
> >  http://myhostname.FQDN:8080/WEB-INF/cgi/web_xml_mon.pl?qa-1
>
>
> >  HTTP Status 404 - /WEB-INF/cgi/web_xml_mon.pl
>
>  Yeah, you've specified a url-pattern of /cgi/* and then tried to access
>  something different -- that's a good reason to not work :-)
>
>  --
>  Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
>
>  ---------------------------------------------------------------------
>  To start a new topic, e-mail: users@tomcat.apache.org
>  To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>  For additional commands, e-mail: users-help@tomcat.apache.org
>
>



-- 
Shabu Khan | Mentis Systems Inc | W: (425) 649-1130 | C: (425)
301-1948 | F: (425) 256-2819

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Perl CGI setup

Posted by Hassan Schroeder <ha...@gmail.com>.
On Fri, Apr 11, 2008 at 11:45 AM, Shabu Khan <hi...@gmail.com> wrote:

>  <!-- The mapping for the CGI Gateway servlet -->
>     <servlet-mapping>
>         <servlet-name>cgi</servlet-name>
>         <url-pattern>/cgi/*</url-pattern>
>     </servlet-mapping>

>  http://myhostname.FQDN:8080/WEB-INF/cgi/web_xml_mon.pl?qa-1

>  HTTP Status 404 - /WEB-INF/cgi/web_xml_mon.pl

Yeah, you've specified a url-pattern of /cgi/* and then tried to access
something different -- that's a good reason to not work :-)

-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org