im trying to run a cgi script (.cgi) with tomcat. I am getting the below error and cant find out whats wrong. I know i should really use apache and mod proxy but this really isnt my area of expertise so im taking the easy way out!
Thanks for any help.
java.io.IOException: Cannot run program "perl" (in directory "C:\Java\tomcat\webapps\my_app_name\WEB-INF\cgi"): CreateProcess error=2, The system cannot find the file specified
java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
java.lang.Runtime.exec(Runtime.java:593)
java.lang.Runtime.exec(Runtime.java:431)
org.apache.catalina.servlets.CGIServlet$CGIRunner.run(CGIServlet.java:1705)
org.apache.catalina.servlets.CGIServlet.doGet(CGIServlet.java:597)
javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:416)
This is something of a guess, but you might need to add the following to your web.xml
file so that Tomcat can find the perl executable. Tomcat doesn't look in your PATH
to find executables, apparently:
executable
C:\perl\bin\perl
Use the actual path to perl on your system, of course.
You need to specify the "executable" parameter in the servlet element. According to the documentation, the default is "perl", which is probably what is triggering your error. Maybe changing it to something like cmd.exe will work.
The error is indicating that the executable named perl
cannot be found. Is perl installed on your system? Is it in the path?
Thanks everyone, i didnt find out what was the correct syntax to run C++ cgi scripts, but if you leave the param blank it will run any script type.
<init-param>
<param-name>executable</param-name>
<param-value></param-value>
</init-param>
No perl is not installed. The CGI script is actually c++. I haven't installed anything other than the default tomcat installation.