tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: how tomcat not run .EXE as CGI
Date Tue, 06 Sep 2005 07:04:35 GMT
gjl wrote:
> Thanks very much to read my question.
> I have tomcat5.0 for Win32 installed locally on
>  Windows 2k, SP4. I'm trying to run a namazu.cgi.exe (a Full-Text Search
> Engine. that's not Perl scripts ,but a binary file) .
> the file is in Tomcat 5.0\webapps\XXX\WEB-INF\cgi ,and I set the web.xml
> file as follow    <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>cgi</servlet-name>
>         <url-pattern>/cgi-bin/*</url-pattern>
>     </servlet-mapping>
> 
>  However, any reference to one of the .EXE in the
> http://localhost:8080/jsp-examples/cgi-bin/namazu.cgi.exe directory results
> in the browser trying to download the EXE. and I got the message "2005-09-06
> 10:07:25 StandardContext[/jsp-examples]cgi: runCGI (stderr):Unrecognized
> character \x90 at \Tomcat
> 5.0\webapps\jsp-examples\WEB-INF\cgi\namazu.cgi.exe line 1." in logs.
> how can I set the tomcat to run the .exe?

With 5.0.x:
You can't use the CGI servlet. You would need to write your own
servlet that wraps the .exe using java.lang.Runtime.exec()
http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/CGIServlet.java?view=markup
should provide some pointers on how to wrap exec() (search the source
for "exec" and remember that most of the CGIServlet is unnecessary for
what you want to do.

With 5.5.x:
You *might* have some luck setting the new executable init parameter.
I would try "" or "cmd".


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message