• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can't upload a file

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Michael
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. did this configuration EVER work?

2. how does the PERL script get executed?

Bill
 
Michael Sumption
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Michael Sumption
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is not at all clear to me why you don't just use one of the Java servlet 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?

Bill
 
Michael Sumption
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic