neelesh86 has asked for the wisdom of the Perl Monks concerning the following question:

I have Tomcat 7.0.26 installed on one of the Linux boxes which has perl v5.8.8 installed on it. I followed the same steps except install perl as it was already done…but still the script did not run…getting “HTTP Status 404 – Servlet cgi is not available”. I have two files one is .html in which the form action runs the cgi script. Both are kept in same folder. URL: http://servername:8080/hotel/hotel_post.html Please help!! Thanks!

below is the web.xml on the server.
<servlet> <servlet-name>cgi</servlet-name> <servlet-class>org.apache.catalina.servlets.CGIServlet</servle +t-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> <servlet-mapping> <servlet-name>cgi</servlet-name> <url-pattern>*.cgi</url-pattern> </servlet-mapping>
Folks please check my scratchpad for the html and the cgi files. Thanks!

Replies are listed 'Best First'.
Re: Not able to run CGI scripts on Tomcat 7.0.26
by NetWallah (Canon) on Dec 24, 2013 at 03:23 UTC
    Look at $TOMCAT_HOME/logs/catalina.out and you will probably see some messages that better explain your predicament.

    Also (agreeing with ww): I dont think HTML and a cgi script belong in the same directory. See config instructions at http://karlsangabriel.com/2011/03/15/cgi-with-tomcat-7/.

                 When in doubt, mumble; when in trouble, delegate; when in charge, ponder. -- James H. Boren

      Hi , i have tried the info from the CGI 101 tutorials and have updated my scratchpad with latest script and configuration details. The HTML runs fine but the cgi script is not invoked. I have set 755 permissions on the scripts.Getting the below error message on the browser. HTTP Status 404 - Servlet cgi is not available
        That is the same error you started with ;;; the cause is the same, your tomcat doesn't have "servlet cgi" whatever that is (its not perl related, its tomcat related, specifically some kind of java program its looking for that it cannot find) ;;; meaning, you're still dealing with same issue, either install the missing java class, or update your java classpath to find it, or something else
Re: Not able to run CGI scripts on Tomcat 7.0.26
by ww (Archbishop) on Dec 24, 2013 at 02:31 UTC
    "Both are kept in same folder."

    Sounds like you need to read about how CGI works. Tutorials provides a start; but don't stop (or maybe, don't start) there: you need to understand how Apache should be configured ... and why.

    It's my suspicion (and only that, as I make no use of Tomcat) that the error message, "Servlet cgi is not available", is a red herring ...
        OR
    that your install procedure went awry.

    OTOH, your html is non-compliant; and your .cgi -- well, let's just say, it's -- um, almost, sorta' close but not quite right.

    If I've misconstrued your question or the logic needed to answer it, I offer my apologies to all those electrons which were inconvenienced by the creation of this post.