cgi和tomcat [英] cgi and tomcat
本文介绍了cgi和tomcat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
im试图使用tomcat运行cgi脚本(.cgi)。我收到以下错误,无法找出问题所在。我知道我真的应该使用apache和mod代理,但这确实不是我的专业领域,所以我采取了简单的方法!
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!
感谢您的帮助。
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)
推荐答案
这是一个猜测,但您可能需要将以下内容添加到您的 web.xml
文件中,以便Tomcat可以找到perl可执行文件。 Tomcat不会在您的 PATH
中查找可执行文件,显然:
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.
这篇关于cgi和tomcat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文