You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ed Hillmann <ed...@yahoo.com> on 2005/07/19 06:18:48 UTC

Unable to use Python/CGI from Tomcat....

I'm attempting to set up our Tomcat server to run
ViewCVS, which is a Python application.  I've set up
Python on my Solaris 8 box.  I've noticed that to
start python, I need to include a library
(libgdbm.so.3) in my LD_LIBRARY_PATH.  Which I do, and
Python starts up fine.

I've copied the cgi script into the appropriate
directory in my Tomcat server.  CGI is enabled,
because we have other scripts being executed from
within Tomcat.  But whenever I attempt to call the new
Python script, I get the error...

2005-07-19 14:14:32 cgi: runCGI (stderr):ld.so.1:
/ct/ctapp/python241/bin/python: fatal: libgdbm.so.3:
open failed: No such file or directory

Which looks a lot like the error I get if that library
is not in my LD_LIBRARY_PATH.

I've mucked around with startup.sh to displayed that
the processes starting the Tomcat JVM does have this
library in it's environment.  But whatever is
executing the CGI script from within the JVM is not
passing along the environment variables.

The servlet definition in my web.xml looks like...

    <servlet>
        <servlet-name>cgi</servlet-name>
       
<servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
        <init-param>
          <param-name>clientInputTimeout</param-name>
          <param-value>100</param-value>
        </init-param>
        <init-param>
          <param-name>debug</param-name>
          <param-value>6</param-value>
        </init-param>
        <init-param>
          <param-name>cgiPathPrefix</param-name>
          <param-value>cgi-bin</param-value>
        </init-param>
        <init-param>
          <param-name>executable</param-name>
          <param-value>/usr/bin/ksh</param-value>
        </init-param>
        <init-param>
         
<param-name>passShellEnvironment</param-name>
          <param-value>true</param-value>
        </init-param>
        <load-on-startup>5</load-on-startup>
    </servlet>

So, because passShellEnvironment is true, I expected
the shell environment to be passed along to the cgi
script.  It doesn't seem to be.

Am I missing something else?  Surely I can't be the
first one to come up against this?

Thanks for any help,
Ed


		
____________________________________________________ 
Do you Yahoo!? 
Messenger 7.0 beta: Free worldwide PC to PC calls
http://au.beta.messenger.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Unable to use Python/CGI from Tomcat....

Posted by Ed Hillmann <ed...@yahoo.com>.
Well, my first attempt was to get Python built so that
it doesn't need the LD_LIBRARY_PATH set.  I'm still
working on that.

As far as the CGIServlet definition, I was under the
impression that Tomcat only allowed one CGIServlet?  I
got this from the doco...

"Tomcat's CGI support is largely compatible with
Apache httpd's, but there are some limitations (e.g.,
only one cgi-bin directory)."

Now, have I misinterpreted "only one cgi-bin
directory"?  Yu can only have one directory, but
multiple servlets configured differently to execute
different files in the single directory?  If I havem
then I'm quite happy to try to set up a servlet for my
Python script which knows it's Python.


--- Tim Diggins <su...@red56.co.uk> wrote:

> Is it worth writing a quick ksh script to validate
> your hypothesis that 
> the environment (and specifically LD_LIBRARY_PATH)
> isn't being passed 
> through?
> 
> additionally (as a crap workaround) you could create
> a quick script 
> which would set the LD_LIBRARY_PATH path and then
> invoke python, and use 
> that in your shebang line...
> 
> also, might it not be an idea to a have a specific
> instance of 
> CGIServlet that has executable=python, rather than
> piping to ksh and 
> then to python? (ie why bother with the shebang
> line, if you don't 
> really need it...)
> 
> just a few ideas, FWIW...
> 
> Tim
> 
> 
> Ed Hillmann wrote:
> > I'm attempting to set up our Tomcat server to run
> > ViewCVS, which is a Python application.  I've set
> up
> > Python on my Solaris 8 box.  I've noticed that to
> > start python, I need to include a library
> > (libgdbm.so.3) in my LD_LIBRARY_PATH.  Which I do,
> and
> > Python starts up fine.
> > 
> > I've copied the cgi script into the appropriate
> > directory in my Tomcat server.  CGI is enabled,
> > because we have other scripts being executed from
> > within Tomcat.  But whenever I attempt to call the
> new
> > Python script, I get the error...
> > 
> > 2005-07-19 14:14:32 cgi: runCGI (stderr):ld.so.1:
> > /ct/ctapp/python241/bin/python: fatal:
> libgdbm.so.3:
> > open failed: No such file or directory
> > 
> > Which looks a lot like the error I get if that
> library
> > is not in my LD_LIBRARY_PATH.
> > 
> > I've mucked around with startup.sh to displayed
> that
> > the processes starting the Tomcat JVM does have
> this
> > library in it's environment.  But whatever is
> > executing the CGI script from within the JVM is
> not
> > passing along the environment variables.
> > 
> > The servlet definition in my web.xml looks like...
> > 
> >     <servlet>
> >         <servlet-name>cgi</servlet-name>
> >        
> >
>
<servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
> >         <init-param>
> >          
> <param-name>clientInputTimeout</param-name>
> >           <param-value>100</param-value>
> >         </init-param>
> >         <init-param>
> >           <param-name>debug</param-name>
> >           <param-value>6</param-value>
> >         </init-param>
> >         <init-param>
> >           <param-name>cgiPathPrefix</param-name>
> >           <param-value>cgi-bin</param-value>
> >         </init-param>
> >         <init-param>
> >           <param-name>executable</param-name>
> >           <param-value>/usr/bin/ksh</param-value>
> >         </init-param>
> >         <init-param>
> >          
> > <param-name>passShellEnvironment</param-name>
> >           <param-value>true</param-value>
> >         </init-param>
> >         <load-on-startup>5</load-on-startup>
> >     </servlet>
> > 
> > So, because passShellEnvironment is true, I
> expected
> > the shell environment to be passed along to the
> cgi
> > script.  It doesn't seem to be.
> > 
> > Am I missing something else?  Surely I can't be
> the
> > first one to come up against this?
> > 
> > Thanks for any help,
> > Ed
> > 
> > 
> > 		
> >
> ____________________________________________________
> 
> > Do you Yahoo!? 
> > Messenger 7.0 beta: Free worldwide PC to PC calls
> > http://au.beta.messenger.yahoo.com
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> > 
> > 
> > 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 
> 


Send instant messages to your online friends http://au.messenger.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Unable to use Python/CGI from Tomcat....

Posted by Tim Diggins <su...@red56.co.uk>.
Is it worth writing a quick ksh script to validate your hypothesis that 
the environment (and specifically LD_LIBRARY_PATH) isn't being passed 
through?

additionally (as a crap workaround) you could create a quick script 
which would set the LD_LIBRARY_PATH path and then invoke python, and use 
that in your shebang line...

also, might it not be an idea to a have a specific instance of 
CGIServlet that has executable=python, rather than piping to ksh and 
then to python? (ie why bother with the shebang line, if you don't 
really need it...)

just a few ideas, FWIW...

Tim


Ed Hillmann wrote:
> I'm attempting to set up our Tomcat server to run
> ViewCVS, which is a Python application.  I've set up
> Python on my Solaris 8 box.  I've noticed that to
> start python, I need to include a library
> (libgdbm.so.3) in my LD_LIBRARY_PATH.  Which I do, and
> Python starts up fine.
> 
> I've copied the cgi script into the appropriate
> directory in my Tomcat server.  CGI is enabled,
> because we have other scripts being executed from
> within Tomcat.  But whenever I attempt to call the new
> Python script, I get the error...
> 
> 2005-07-19 14:14:32 cgi: runCGI (stderr):ld.so.1:
> /ct/ctapp/python241/bin/python: fatal: libgdbm.so.3:
> open failed: No such file or directory
> 
> Which looks a lot like the error I get if that library
> is not in my LD_LIBRARY_PATH.
> 
> I've mucked around with startup.sh to displayed that
> the processes starting the Tomcat JVM does have this
> library in it's environment.  But whatever is
> executing the CGI script from within the JVM is not
> passing along the environment variables.
> 
> The servlet definition in my web.xml looks like...
> 
>     <servlet>
>         <servlet-name>cgi</servlet-name>
>        
> <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
>         <init-param>
>           <param-name>clientInputTimeout</param-name>
>           <param-value>100</param-value>
>         </init-param>
>         <init-param>
>           <param-name>debug</param-name>
>           <param-value>6</param-value>
>         </init-param>
>         <init-param>
>           <param-name>cgiPathPrefix</param-name>
>           <param-value>cgi-bin</param-value>
>         </init-param>
>         <init-param>
>           <param-name>executable</param-name>
>           <param-value>/usr/bin/ksh</param-value>
>         </init-param>
>         <init-param>
>          
> <param-name>passShellEnvironment</param-name>
>           <param-value>true</param-value>
>         </init-param>
>         <load-on-startup>5</load-on-startup>
>     </servlet>
> 
> So, because passShellEnvironment is true, I expected
> the shell environment to be passed along to the cgi
> script.  It doesn't seem to be.
> 
> Am I missing something else?  Surely I can't be the
> first one to come up against this?
> 
> Thanks for any help,
> Ed
> 
> 
> 		
> ____________________________________________________ 
> Do you Yahoo!? 
> Messenger 7.0 beta: Free worldwide PC to PC calls
> http://au.beta.messenger.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org