I am new to configuring tomcat (I have run it for a few years as it is 
packaged with Netbeans) and new to linux and I am stuck on a particular problem.

I have a project in which I am trying to call a python code from a servlet.  I 
am using tomcat6 on Ubuntu 10.04.  I have used both Runtime.exec() as well as 
ProcessBuilder to make the call.  I have completely copied the code from the 
JavaWorld article When Runtime.exec() won't 
(http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html).  I have 
granted full permissions on all the files (read, write and execute).  When I 
get an exit value on the execution of the script I get a value of 0 (zero).  I 
am able to execute the script from a simple java program in this environment 
(tomcat and Ubuntu) using the same syntax but not in the servlet.  I am able to 
execute the script from the servlet in Ubuntu 10.04 from glassfish and I am 
able to execute the script from the servlet in tomcat6 in a windows 
environment.  However, when I try to execute the script from the servlet in 
tomcat6 and Ubuntu 10.04 - nothing - even though I get the exit value of zero, 
I get the zero value returned but no action from the script (all it does is 
open the default browser).

I have made the following changes in my tomcat installation:

Uncommented the following in the web.xml:

 <servlet>
        <servlet-name>cgi</servlet-name>
        <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
        <init-param>
          <param-name>debug</param-name>
          <param-value>0</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>

My tomcat-users:

<tomcat-users>

  <role rolename="tomcat"/>
  <role rolename="role1"/>  
  <role rolename="manager"/> 
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
  <user username="tomcat" password="tomcat" roles="manager"/>  

</tomcat-users>

Change made in context.xml:
<Context reloadable="true" privileged="true">

Added to system.policy:
// Grant WebApps All Permission
grant codeBase "file:/var/lib/tomcat6/webapps/-" {
    permission java.security.AllPermission;
};

Added to catalina.policy:
grant codeBase "file:${catalina.home}/webapps/GSMFilter/-"  {
    java.io.FilePermission 
"/var/libs/tomcat6/webapps/GSMFilter/WEB-INF/storage/<<ALL FILES>>", 
"read,write,execute,delete";
};

grant codeBase "file:${catalina.home}/webapps/GSMFilter/-"{
    permission java.security.AllPermission;
};

grant codeBase "file:${catalina.home}/webapps/FilterSelection/-"{
         permission java.lang.RuntimePermission 
"/home/troy/NetBeansProjects/GSMFilter/web/WEB-INF/storage/<<ALL FILES>>", 
"read,write,execute,delete";

At this point I am at a loss.  Any help would be greatly appreciated.

Troy Parrish

Reply via email to