• 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

CGI client cannot contact web

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a PERL routine I've used for some time on Windows systems to retrieve and save a backup copy of a URL using the LWP::Simple head and getstore methods. For a project, I just set up a new server with J2EE and Tomcat. The same methods that work fine for me on Windows will not work when served through Tomcat. It appears that the routine is not being allowed to make an HTTP connection. I know the code and PERL setup are correct, as the routine will work through the command prompt on this same machine.

I suspect that this is an issue with the server setup, but I can't figure out what parameters need to be reset. I'd appreciate any suggestions that others might have.
 
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
Exactly how are you executing the PERL program? Are you using the CGI servlet? Your PERL program may depend on environment variables that are not getting set.
Does the PERL program execute completely or hang?
Which Tomcat version?
Bill
 
Deb Thompson
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For testing purposes, I'm calling the script as a URL from the browser. I modified the web.xml file to map cgi as a servelet. Does it matter that I'm using .pl as my file extension, but this isn't defined anywhere in the mapping?

The PERL routine does execute. It checks for the URL header, and doesn't find anything.

I'm using Tomcat version 5.0.
 
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
If this was my problem I would try executing a PERL script that just dumps all the environment variables. Here is one that came with my Perl dist.



Bill
 
Deb Thompson
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got the environment variables, but I don't think I see anything that tells me what's going wrong:

AUTH_TYPE=
CONTENT_LENGTH=
CONTENT_TYPE=
GATEWAY_INTERFACE=CGI/1.1
HTTP_ACCEPT=image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/pdf, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
HTTP_ACCEPT_ENCODING=gzip, deflate
HTTP_ACCEPT_LANGUAGE=en-us
HTTP_CONNECTION=Keep-Alive
HTTP_COOKIE=afm_user_id_per_computer=afm; JSESSIONID=14AD0D44927B3B6A0071B70D52F5547F
HTTP_HOST=svr-arch.cecinc.com
HTTP_USER_AGENT=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
PATH_INFO=
QUERY_STRING=
REMOTE_ADDR=10.100.8.70
REMOTE_HOST=DTHOMPSON
REMOTE_IDENT=
REMOTE_USER=
REQUEST_METHOD=GET
SCRIPT_NAME=/arch/cgi-bin\env2.pl
SERVER_NAME=svr-arch.cecinc.com
SERVER_PORT=80
SERVER_PROTOCOL=HTTP/1.1
SERVER_SOFTWARE=TOMCAT
X_TOMCAT_SCRIPT_PATH=C:\Program Files\Afm14\Tomcat 5.0\webapps\arch\cgi-bin\env2.pl
 
Deb Thompson
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For anyone else who has this problem, adding the line

$ENV{"SYSTEMROOT"} = "C:\\windows";

to the code fixed the problem.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you, I was having similar problems using Net::FTP. The script worked fine until I started trying to execute it as a CGI under tomcat.

from cmd prompt:
echo %SYSTEMROOT%

for me I needed to add this line to get Net::FTP to work:
$ENV{"SYSTEMROOT"} = "C:\\WINNT";

How did you know this would be the fix?
 
Deb Thompson
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It was a strange journey. I searched the web for 2 weeks without much success. Then I got the idea to search on the error message text, and found one obscure posting that had that line of code in it. I was ready to try anything at that point, and it worked. Sometimes tenacity wins over skill!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic