This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Tomcat and the fly likes problem running cgi script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "problem running cgi script" Watch "problem running cgi script" New topic
Author

problem running cgi script

Michael Eddie
Greenhorn

Joined: Jul 12, 2005
Posts: 3
I've installed and configured tomcat to run cgi scripts according to the steps provided by jakarta/tomcat's website, and can successfully run simple scripts.

My problem is when I run a script that makes a call to execute a file on my local machine within the script:
@exist=`ldapsearch.exe -1 -p $port -h $ho...`

I also am unable to write to a file within my script.

I've searched for days trying to find a solution to no avail. The files I'm working with all have the correct read/write priveleges on the windows OS, and I've even tried with no luck to edit the catalina.policy file in tomcat in order to grant priveleges to the cgi servlet and the files i'm working with.

anyone have any clue how I can resolve this?

[ July 12, 2005: Message edited by: Michael Eddie ]
[ July 12, 2005: Message edited by: Michael Eddie ]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24168
    
  30

Is your script making invalid assumptions about what the current directory is? It will likely be the directory from where you launched Tomcat.


[Jess in Action][AskingGoodQuestions]
Michael Eddie
Greenhorn

Joined: Jul 12, 2005
Posts: 3
the actual code in the example above when i make the call to execute the ldapsearch.exe file contains the full path to that file:
@exist=`c:\\pathtofile\\ldapsearch.exe`;

when i try to write to a file I also supply the full path in the call.

I should also add that the script I am using works correctly from the command line.

[ July 12, 2005: Message edited by: Michael Eddie ]
[ July 12, 2005: Message edited by: Michael Eddie ]
Michael Eddie
Greenhorn

Joined: Jul 12, 2005
Posts: 3
I finally found the fix by adding this line to the script:

$ENV{"SYSTEMROOT"} = "C:\\windows";
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem running cgi script
 
Similar Threads
tomcat integration with dynasight
Where to put jdbc jar files
How to get environment variable ?
setting Tomcat 6 up to run CGI scripts (Perl)
Enabling cgi scripts on Tomcat