LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Running CGI scripts in Tomcat 4...not happening!!! (https://www.linuxquestions.org/questions/linux-software-2/running-cgi-scripts-in-tomcat-4-not-happening-142169/)

vous 02-04-2004 08:35 AM

Running CGI scripts in Tomcat 4...not happening!!!
 
Hello all,

I have:

Mandrake 9.1
Apache2
Tomcat4

Installed and running.

I am now trying to run a cgi script, that has already been tested through Apache2 (so I'm sure it works), but Tomcat
is telling me something is wrong with my path. What I can't figure out is where must I modify this?!?!?!

I have already modified my web.xml where I need to uncomment the cgi servlets & mappings AND renamed the jar files:

servlets-cgi.jar
servlets-ssi.jar

Restarted Tomcat.

When I run the script via Tomcat, I get this error:

<HTML><HEAD><TITLE>$Name: $</TITLE></HEAD>
<BODY>$Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/CGIServlet.java,v 1.11 2002/12/04 21:09:07 amyroh Exp $<p>
<H3>
CGI script not found or not specified.
</H3>
<H4>
Check the <b>HttpServletRequest
<a href="#pathInfo">pathInfo</a></b>
property to see if it is what you meant
it to be. You must specify an existant
and executable file as part of the
path-info.
</H4>
<H4>
For a good discussion of how CGI scripts
work and what their environment variables
mean, please visit the <a
href="http://cgi-spec.golux.com">CGI
Specification page</a>.
</H4>
<h1>ServletRequest Properties</h1>
<ul>
<li><b>characterEncoding</b> = null
<li><b>contentLength</b> = 1415
<li><b>contentType</b> = multipart/form-data; boundary=---------------------------20244496831495207159375658259
<li><b>locale</b> = en_US
<li><b>locale</b> = en
<li><b>protocol</b> = HTTP/1.1
<li><b>remoteAddr</b> = 134.XXX.XXX.XXX
<li><b>remoteHost</b> = localhost
<li><b>scheme</b> = http
<li><b>secure</b> = false
<li><b>serverName</b> = localhost
<li><b>serverPort</b> = 8080
</ul>
<hr>
<h1>HttpServletRequest Properties</h1>
<ul>
<li><b>authType</b> = null
<li><b>contextPath</b> =
<li><b>cookie</b> JSESSIONID = EA89C147AC6D1E4B23E74CA6B270B4C2
<li><b>header</b> host = localhost:8080
<li><b>header</b> user-agent = Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3.1) Gecko/20030428
<li><b>header</b> accept = text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
<li><b>header</b> accept-language = en-us,en;q=0.5
<li><b>header</b> accept-encoding = gzip,deflate,compress;q=0.9
<li><b>header</b> accept-charset = ISO-8859-1,utf-8;q=0.7,*;q=0.7
<li><b>header</b> keep-alive = 300
<li><b>header</b> connection = keep-alive
<li><b>header</b> referer = http://localhost:8080/jetspeed/index.jsp
<li><b>header</b> cookie = JSESSIONID=EA89C147AC6D1E4B23E74CA6B270B4C2
<li><b>header</b> content-type = multipart/form-data; boundary=---------------------------20244496831495207159375658259
<li><b>header</b> content-length = 1415
<li><b>method</b> = POST
<li><a name="pathInfo"><b>pathInfo</b></a> = /upload.pl
<li><b>pathTranslated</b> = /usr/local/jakarta-tomcat-4.1.27/webapps/ROOT/upload.pl
<li><b>queryString</b> = null
<li><b>remoteUser</b> = null
<li><b>requestedSessionId</b> = EA89C147AC6D1E4B23E74CA6B270B4C2
<li><b>requestedSessionIdFromCookie</b> = true
<li><b>requestedSessionIdFromURL</b> = false
<li><b>requestedSessionIdValid</b> = true
<li><b>requestURI</b> = /cgi-bin/upload.pl
<li><b>servletPath</b> = /cgi-bin
<li><b>userPrincipal</b> = null
</ul>
<hr>
<h1>ServletRequest Attributes</h1>
<ul>
</ul>
<hr>
<h1>HttpSession Properties</h1>
<ul>
<li><b>id</b> = EA89C147AC6D1E4B23E74CA6B270B4C2
<li><b>creationTime</b> = Wed Feb 04 14:26:41 CET 2004
<li><b>lastAccessedTime</b> = Wed Feb 04 15:12:21 CET 2004
<li><b>maxInactiveInterval</b> = 1800
</ul>
<hr>
<h1>HttpSession Attributes</h1>
<ul>
</ul>
<hr>
<h1>ServletConfig Properties</h1>
<ul>
<li><b>servletName</b> = cgi
</ul>
<hr>
<h1>ServletConfig Initialization Parameters</h1>
<ul>
<li><b>debug</b> = 6
<li><b>cgiPathPrefix</b> = WEB-INF/cgi
<li><b>clientInputTimeout</b> = 100
</ul>
<hr>
<h1>ServletContext Properties</h1>
<ul>
<li><b>majorVersion</b> = 2
<li><b>minorVersion</b> = 3
<li><b>realPath('/')</b> = /usr/local/jakarta-tomcat-4.1.27/webapps/ROOT/
<li><b>serverInfo</b> = Apache Tomcat/4.1.27
</ul>
<hr>
<h1>ServletContext Initialization Parameters</h1>
<ul>
</ul>
<hr>
<h1>ServletContext Attributes</h1>
<ul>
<li><b>org.apache.catalina.jsp_classpath</b> = /usr/local/jakarta-tomcat-4.1.27/shared/classes/:/usr/local/jakarta-tomcat-4.1.27/common/classes/:/usr/local/jakarta-tomcat-4.1.27/common/endorsed/xmlParserAPIs.jar:/usr/local/jakarta-tomcat-4.1.27/common/endorsed/xercesImpl.jar:/usr/local/jakarta-tomcat-4.1.27/common/endorsed/xalan.jar:/usr/local/jakarta-tomcat-4.1.27/common/endorsed/xml-apis.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/activation.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/jasper-runtime.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/jasper-compiler.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/naming-resources.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/commons-collections.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/naming-common.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/commons-logging-api.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/ant.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/mail.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/commons-dbcp.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/servlet.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/jdbc2_0-stdext.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/commons-pool.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/jndi.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/naming-factory.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/jta.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/xalan.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/xercesImpl.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/xml-apis.jar
<li><b>javax.servlet.context.tempdir</b> = /usr/local/jakarta-tomcat-4.1.27/work/Standalone/localhost/_
<li><b>org.apache.catalina.resources</b> = org.apache.naming.resources.ProxyDirContext@1fa10da
<li><b>org.apache.catalina.WELCOME_FILES</b> = [Ljava.lang.String;@688e91
</ul>
<hr>
</BODY></HTML>

vous 02-04-2004 12:34 PM

By the way, the script that I run is a perl script, like I said, I already made sure it runs but I'm wondering if perhaps there is an "extra" config setting that I'm missing here?

Any thoughts?

vous 02-05-2004 03:52 AM

I try to run the cgi via this URL (8080 is where Tomcat is runnning)

http://MYHOST:8080/cgi-bin/upload.pl

The actual physical location of the file is:

/usr/local/jakarta-tomcat-4.1.27/webapps/cgi-bin

But then an error message came back saying it couldn't find the script, and that it was looking here:

/usr/local/jakarta-tomcat-4.1.27/webapps/ROOT

So I changed it to that location and I got the same error.


So what is wrong??? Please any thoughts or ideas on this issue will be greatly appreciated.

Here below is my system info:


My jar files have been renamed, and herer is a list of what I have:

drwxr-xr-x 2 root root 4096 Feb 4 14:44 ./
drwxr-xr-x 5 root root 4096 Jul 31 2003 ../
-rw-r--r-- 1 root root 14804 Jul 31 2003 catalina-ant.jar
-rw-r--r-- 1 root root 750767 Jul 31 2003 catalina.jar
-rw-r--r-- 1 root root 118726 Jul 31 2003 commons-beanutils.jar
-rw-r--r-- 1 root root 109096 Jul 31 2003 commons-digester.jar
-rw-r--r-- 1 root root 22379 Jul 31 2003 commons-fileupload-1.0.jar
-rw-r--r-- 1 root root 31605 Jul 31 2003 commons-logging.jar
-rw-r--r-- 1 root root 32290 Jul 31 2003 commons-modeler.jar
-rw-r--r-- 1 root root 104195 Jul 31 2003 jaas.jar
-rw-r--r-- 1 root root 29871 Jul 31 2003 jakarta-regexp-1.2.jar
-rw-r--r-- 1 root root 343900 Jul 31 2003 mx4j-jmx.jar
-rw-r--r-- 1 root root 2537 Jul 31 2003 mx4j.license
-rw-r--r-- 1 root root 16863 Jul 31 2003 servlets-cgi.jar
-rw-r--r-- 1 root root 7031 Jul 31 2003 servlets-common.jar
-rw-r--r-- 1 root root 19278 Jul 31 2003 servlets-default.jar
-rw-r--r-- 1 root root 5964 Jul 31 2003 servlets-invoker.jar
-rw-r--r-- 1 root root 18929 Jul 31 2003 servlets-manager.jar
-rw-r--r-- 1 root root 46740 Jul 31 2003 servlets-ssi.jar
-rw-r--r-- 1 root root 21433 Jul 31 2003 servlets-webdav.jar
-rw-r--r-- 1 root root 64031 Jul 31 2003 tomcat-coyote.jar
-rw-r--r-- 1 root root 40274 Jul 31 2003 tomcat-http11.jar
-rw-r--r-- 1 root root 81292 Jul 31 2003 tomcat-jk2.jar
-rw-r--r-- 1 root root 65086 Jul 31 2003 tomcat-jk.jar
-rw-r--r-- 1 root root 164252 Jul 31 2003 tomcat-util.jar
-rw-r--r-- 1 root root 23336 Jul 31 2003 tomcat-warp.jar


And here my web.xml file:


<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>



<servlet>
<servlet-name>default</servlet-name>
<servlet-class>
org.apache.catalina.servlets.DefaultServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>



<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>
org.apache.catalina.servlets.InvokerServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>



<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>logVerbosityLevel</param-name>
<param-value>WARNING</param-value>
</init-param>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>




<servlet>
<servlet-name>cgi</servlet-name>
<servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
<init-param>
<param-name>clientInputTimeout</param-name>
<param-value>100</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>6</param-value>
</init-param>
<init-param>
<param-name>cgiPathPrefix</param-name>
<param-value>WEB-INF/cgi</param-value>
</init-param>
<load-on-startup>5</load-on-startup>
</servlet>



<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>


<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>

<!--
<servlet-mapping>
<servlet-name>ssi</servlet-name>
<url-pattern>*.shtml</url-pattern>
</servlet-mapping>
-->


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



<session-config>
<session-timeout>30</session-timeout>
</session-config>




<mime-mapping>
.
.
.
</mime-mapping>




<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

</web-app>


All times are GMT -5. The time now is 05:58 PM.