2

我在 web.xml 中启用了 CGI 模块,并在 context.xml 中添加了 previleged=true。将 cgi 文件放在我的应用程序的 WEB-INF/cgi/ 文件夹中。尝试访问以下 URL 时,我收到“error=13,Permission denied”错误。(http://localhost:8080/cute/cgi-bin/cutecgi.cgi)

 致命的: サーブレット cgi のServlet.service()が例外を投げました
    java.io.IOException: Cannot run program "/var/lib/tomcat6/webapps/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/cute/WEB-INF/cgi/cutecgi.cgi" (in directory "/var/lib/tomcat6/webapps/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/cute/WEB-INF/cgi"): java.io.IOException: error=13, Permission denied
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
    at java.lang.Runtime.exec(Runtime.java:593)
    at java.lang.Runtime.exec(Runtime.java:431)
    at org.apache.catalina.servlets.CGIServlet$CGIRunner.run(CGIServlet.java:1649)
    at org.apache.catalina.servlets.CGIServlet.doGet(CGIServlet.java:592)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:865)
    at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
    at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: java.io.IOException: java.io.IOException: error=13, Permission denied
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
    at java.lang.ProcessImpl.start(ProcessImpl.java:65)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
    ... 21 more
.
4

1 回答 1

3

这看起来像是 CGI 脚本的文件权限问题。运行 Tomcat 服务器的用户无法访问该文件,或者该文件本身没有该用户的执行权限。

尝试运行此命令以查看文件权限:

ls -l /var/lib/tomcat6/webapps/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/cute/WEB-INF/cgi/cutecgi.cgi
于 2012-09-06T08:00:08.570 回答