• 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

Compiled CGI on Tomcat

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all.

Does anyone have any experience running CGI's on Tomcat (version 4.1.30 on Solaris 8)?

We are trying to run Tomcat standalone, but we are also running the mapquest connect cgi on our site. I am trying to use the org.apache.catalina.servlets.CGIServlet but it is dying on this cgi.

I wrote a simple "Hello World!" perl script that runs okay from the same spot, but the mapquest cgi fails with the following error:

2004-06-17 15:12:44 cgi: runCGI (stderr):Unrecognized character \177 at ${CATALINA_HOME}/webapps/mapquest/WEB-INF/cgi-bin/mqinterconnect line 1.

The biggest difference I can think of between the 2 cgi's is that one is a script and the other is compiled. Does this make any difference?

If I can't get this to work, we'll just have to run an apache httpd instance as well, but I want to avoid that right now if at all possible.

If you need any other configuration information, I can provide it.

Thanks.
[ June 17, 2004: Message edited by: Jason St Louis ]
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like you get that error when you try to run a compiled "C" cgi as if it was a perl script.

http://mail.python.org/pipermail/mailman-users/1999-January/000245.html

I'm thinking the cgiservlet only does perl. It probably invokes the perl interpreter through java.lang.Runtime and java.lang.Process .

One way to confirm is to check the source of org.apache.catalina.servlets.CGIServlet

You might be able to tell more (and perhaps skip the source) if you up the debug value.


I'm thiking perhaps Tomcat will grace you with more info in catalina.out (maybe even the string it send to the unix command line)
[ June 17, 2004: Message edited by: Mike Curwen ]
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hmm... I did have better things to do tonight, but I'm avoiding them.


I've looked at the source, and it looks like there's an undocumented parameter? Maybe the version included in 4.1.30 is not the same as that available in HEAD..

but...

http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/CGIServlet.java?rev=1.24&only_with_tag=MAIN&view=markup

search on that page cgiExecutable
The first occurence sets it to "perl"
the second occurence sets it to whatever is passed in through the executable servlet init parameter.
and the third starts to build a command line, which is eventually passed to Runtime.getRuntime().exec()
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
one last one:

I don't know enough about CVS, so I'm might be completely wrong. But I checked the source code for the cgiservlet that was "tagged" as TOMCAT4-1-30. Does this mean that *THIS* is the version of cgiservlet that is in the tomcat 4.1.30 release? (Perhaps).

If so, the code that enables you to specify something other than 'perl' is *in* this version, but not documented.

fyi: it *IS* in the docs for Tomcat 5.x
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/cgi-howto.html (bottom of page)
 
Jason St Louis
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So maybe if I'm running this on Solaris I can just pass a blank value to the executable init parameter since the cgi itself is executable.

I'll give it a try tommorrow and let you know how it turns out.

Thanks for the help.
 
Jason St Louis
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It worked! Thanks again, Mike.
 
Jason St Louis
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just thought I'd make a note of this for anyone else who might be interested.

The test "Hello World!" perl script that I wrote continues to work after I changed the executable init paramater to blank. That doesn't suprise me since the script itself defines which interpreter to use (#!/usr/bin/perl).

So blanking out the executable parameter causes the CGIServlet to work with script CGI programs and compiled CGI programs (at least on Solaris).
[ June 18, 2004: Message edited by: Jason St Louis ]
 
this is supposed to be a surprise, but it smells like a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic