We're using this software that "publishes" (uploads) a file to a directory on our Tomcat 6 server via http post and perl script, but it is failing, and the vendor hasn't been able to figure it out yet. The Windows 2008 R2 server is just running Tomcat, no IIS or Apache web server. The perl script is running from the c:\tomcat55\webapps\root\web-inf\cgi directory and attempting to upload a file from the client PC to the server's c:\tomcat55\webapps\root\web-inf\cgi\forms directory. It's strange because the script can create a sub-directory (under "forms"), but it can't upload/copy the files into the sub-directory. Naturally, we are all thinking it has something to do with permissions, but we have set permissions to no avail, and now we are stumped. Any clues, insights, or suggestions would be greatly appreciated. Thanks.
Bill, thanks for your reply. No, unfortunately, it hasn't worked yet - new installation of the vendor software. The tomcat server has been running for some time though (other software). Following is the explanation from the vendor about how it works. I did change the tomcat directory name to "tomcat55" in response to the vendor's concern, but we still get the software's upload failed errors.
The designer's interaction with the scripts is entirely based on HTTP web requests, some GET but mostly POST requests. This means it will be working under whatever ports are set up in the web server, most likely 8080. The perl runs under whatever credentials are set up in the web server, often I_WAM in IIS or apache in apache. The permissions seem to be alright in your case, because Perl can run, create directories, and also create the config files. The issue is during the actual process of sending a file for upload and writing it to the form directory. This request is a POST request that does a series of checks (like whether or not the user is authenticated and that auto publishing is turned on). The actual file is sent as a key to the POST request. The file is stored and copied over to the form directory using Perl's CGI.pm. It is most likely that either the request with the file is being blocked by the web server, or that there is an issue with CGI.pm writing the file to a temp directory and then copying it over.
We do have an idea of what could be the issue. We think it might be the fact that the scripts directory has both a space and a period in it (C:\Tomcat 5.5\webapps\ROOT\WEB-INF\cgi\), which we could see possibly causing problems. In the latest script we sent you, we are overwriting the CGI.pm temp directory to the script directory to address an issue we had been seeing in Windows machines running apache. We suspect rewriting it to a directory with both spaces and periods in it is likely causing the problems.
Joined: Oct 01, 2012
One other thing I haven't checked yet, but will do so when our other server admin returns, is to check if the Microsoft Forefront virus protection software is blocking anything as a potential virus threat.
I can give you one insight: Never upload files into a J2EE war directory. You will end up regretting it. In fact, in a strict J2EE implementation (unexploded WAR file), you physically won't be able to. Regardless, WARs can be wiped out anytime it becomes necessary to do a software update and so will the uploaded data.
Always upload your files to a directory that's external both to WARs and to Tomcat itself.
Customer surveys are for companies who didn't pay proper attention to begin with.
Author and all-around good cowpoke
Joined: Mar 22, 2000
It is not at all clear to me why you don't just use one of the Javaservlet based file upload toolkits. Surely any logic the PERL script performs could be done in Java.
Anyway, can you tell how far the PERL script runs? Does a temp file get created? Does the client side look like the file is being uploaded?
Joined: Oct 01, 2012
Thank you Tim and Bill for the replies. This particular software is just a few perl scripts to upload and post HTML fillable forms (designed in the client software), no java, so not sure how this works out since I'm more of .NET guy / Java-Tomcat newbie [sorry], but hopefully the vendor will be able utilize your wisdom that I'll pass along. Thanks again for your time, you guys are the best.