You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by "Peter L. Berghold" <pe...@berghold.net> on 2008/07/11 23:14:15 UTC

CGI and Geronimo/Tomcat

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey folks,

I've been doing web searches looking for the answer to this and I can't
find my Geronimo book wherever I put it last.  I am trying enable the
processing of CGI scripts on Geronimo.

Can someone point me in the right direction?


- --

Peter L. Berghold     http://www.berghold.net   peter@berghold.net
Unix Professional     Dog Agility Fan   Crazed Cook
"Those who fail to learn from history are condemned to repeat it."

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFId80nUM9/01RIhaARAmQ/AKDDA3rYXtkJX1qMRqYBvCMrS5iPuwCaAg7D
ldm9U52gLTuLIXybTCLckKI=
=rIgh
-----END PGP SIGNATURE-----

Re: CGI and Geronimo/Tomcat

Posted by Lin Sun <li...@gmail.com>.
Yes this error means that the context-root "cgi" is already taken in
your server.  You'll have to change to a different context-root in the
web.xml or undeploy the other app that uses this context-root.

Lin

On Mon, Jul 14, 2008 at 11:33 AM, Peter L. Berghold <pe...@berghold.net> wrote:

> This seems significant (at least to me)
>
> 11:30:22,125 ERROR [ContextConfig] Parse error in application web.xml
> file at jndi:/0.0.0.0/cgi-bin/WEB-INF/web.xml
> java.lang.IllegalArgumentException: addChild:  Child name 'cgi' is not
> unique
>        at
> org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2726)
>        at
> org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2752)
>        at
> org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1061)
>        at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
>
>
>
> I'm tempted to tweak it, but I'll leave it alone till I hear back from
> you folks...

Re: CGI and Geronimo/Tomcat

Posted by "Peter L. Berghold" <pe...@berghold.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kevan Miller wrote:

> Which version of Geronimo are you using?
> 

Geronimo/Tomcat 6  version 2.0.2

> Are you deploying on a fresh install of Geronimo? If not, can you? Just
> trying to pin down the source of your problem...
> 

At this point to do a fresh install means taking three "production"
websites down to do so.

> Is there any additional info in your log file?
> 

This seems significant (at least to me)

11:30:22,125 ERROR [ContextConfig] Parse error in application web.xml
file at jndi:/0.0.0.0/cgi-bin/WEB-INF/web.xml
java.lang.IllegalArgumentException: addChild:  Child name 'cgi' is not
unique
        at
org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2726)
        at
org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2752)
        at
org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1061)
        at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)



I'm tempted to tweak it, but I'll leave it alone till I hear back from
you folks...



- --

Peter L. Berghold     http://www.berghold.net   peter@berghold.net
Unix Professional     Dog Agility Fan   Crazed Cook
"Those who fail to learn from history are condemned to repeat it."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIe3HAUM9/01RIhaARAm/tAJ9/6wBOUBLB4KONX7fwh/xE1E0aywCfeubh
qalnGru/hbtXp6dj7HUhEAk=
=NfK7
-----END PGP SIGNATURE-----

Re: CGI and Geronimo/Tomcat

Posted by Kevan Miller <ke...@gmail.com>.
On Jul 14, 2008, at 11:00 AM, Peter L. Berghold wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Lin Sun wrote:
>> Ok, could it be caused by the following line?
>>
>> <!-- Gave it it's own group-id !>
>
> That actually doesn't exist at all in the real file.  I put that there
> in my email to highlight what I did.

Peter,
Which version of Geronimo are you using?

Are you deploying on a fresh install of Geronimo? If not, can you?  
Just trying to pin down the source of your problem...

Is there any additional info in your log file?

--kevan




Re: CGI and Geronimo/Tomcat

Posted by Lin Sun <li...@gmail.com>.
Could you supply the war file that you are using to deploy and the
exact command you used?

Thx, Lin

On Mon, Jul 14, 2008 at 11:00 AM, Peter L. Berghold <pe...@berghold.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Lin Sun wrote:
>> Ok, could it be caused by the following line?
>>
>> <!-- Gave it it's own group-id !>
>
> That actually doesn't exist at all in the real file.  I put that there
> in my email to highlight what I did.
>
>
>
> - --
>
> Peter L. Berghold     http://www.berghold.net   peter@berghold.net
> Unix Professional     Dog Agility Fan   Crazed Cook
> "Those who fail to learn from history are condemned to repeat it."
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFIe2okUM9/01RIhaARAgWTAJ94/zWfxAstNLclLpsWKrm+g8y1EwCgvtgR
> dcOk8yWVq8Ul2PIkNXld2no=
> =KUVu
> -----END PGP SIGNATURE-----
>

Re: CGI and Geronimo/Tomcat

Posted by "Peter L. Berghold" <pe...@berghold.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lin Sun wrote:
> Ok, could it be caused by the following line?
> 
> <!-- Gave it it's own group-id !>

That actually doesn't exist at all in the real file.  I put that there
in my email to highlight what I did.



- --

Peter L. Berghold     http://www.berghold.net   peter@berghold.net
Unix Professional     Dog Agility Fan   Crazed Cook
"Those who fail to learn from history are condemned to repeat it."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIe2okUM9/01RIhaARAgWTAJ94/zWfxAstNLclLpsWKrm+g8y1EwCgvtgR
dcOk8yWVq8Ul2PIkNXld2no=
=KUVu
-----END PGP SIGNATURE-----

Re: CGI and Geronimo/Tomcat

Posted by Lin Sun <li...@gmail.com>.
Ok, could it be caused by the following line?

<!-- Gave it it's own group-id !>

What if you change it to

<!-- Gave it it's own group-id --> or remove it?

HTH,

Lin

On Mon, Jul 14, 2008 at 10:28 AM, Peter L. Berghold <pe...@berghold.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Lin Sun wrote:
>> I think the server is complaining about the following configuration in
>> geronimo-web.xml -
>>
>>   <host>www.bayshoredogclub.org</host>
>>
>>
>
> Thought of that.... tried eliminating it and got the same result.
>
>
>
> - --
>
> Peter L. Berghold     http://www.berghold.net   peter@berghold.net
> Unix Professional     Dog Agility Fan   Crazed Cook
> "Those who fail to learn from history are condemned to repeat it."
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFIe2KYUM9/01RIhaARAsF/AKCdrtkHjLQK8E10WZKJDNlukh66twCfSDWH
> 0FVFimHA1MHMo7wHeRA4x8U=
> =7zcK
> -----END PGP SIGNATURE-----
>

Re: CGI and Geronimo/Tomcat

Posted by "Peter L. Berghold" <pe...@berghold.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lin Sun wrote:
> I think the server is complaining about the following configuration in
> geronimo-web.xml -
> 
>   <host>www.bayshoredogclub.org</host>
> 
>

Thought of that.... tried eliminating it and got the same result.



- --

Peter L. Berghold     http://www.berghold.net   peter@berghold.net
Unix Professional     Dog Agility Fan   Crazed Cook
"Those who fail to learn from history are condemned to repeat it."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIe2KYUM9/01RIhaARAsF/AKCdrtkHjLQK8E10WZKJDNlukh66twCfSDWH
0FVFimHA1MHMo7wHeRA4x8U=
=7zcK
-----END PGP SIGNATURE-----

Re: CGI and Geronimo/Tomcat

Posted by Lin Sun <li...@gmail.com>.
I think the server is complaining about the following configuration in
geronimo-web.xml -

  <host>www.bayshoredogclub.org</host>

If you look at the http://geronimo.apache.org/xml/ns/j2ee/web-1.1
schema, host element is not defined there.

HTH, Lin

On Mon, Jul 14, 2008 at 10:03 AM, Peter L. Berghold <pe...@berghold.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Kevan Miller wrote:
>>
>>
>> In the jira I posted a war and some instructions on enabling cgi-bin
>> support on Tomcat.
>
>
> OK.. gave it a whirl.
>
> I made a couple of changes to the geronimo-web.xml file that (I thought)
> whouldn't affect much, but here is what I got:
>
>
> First the changes:
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1">
>  <environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
>    <moduleId>
>      <groupId>bcdc</groupId>
>             <!-- Gave it it's own group-id !>
>      <artifactId>cgi-bin</artifactId>
>      <version>1.0</version>
>      <type>car</type>
>    </moduleId>
>  </environment>
>
>  <context-root>/cgi-bin</context-root>
>  <host>www.bayshoredogclub.org</host>
>  <!--- Different cgi-bin for each host. -->
>
> </web-app>
>
>
>
> Here's the spew....
>
>
> org.apache.geronimo.kernel.config.LifecycleException: start of
> bcdc/cgi-bin/1.0/car failed
>        at
> org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:547)
>        at
> org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:511)
>        at
> org.apache.geronimo.kernel.config.SimpleConfigurationManager$$FastClassByCGLIB$$ce77a924.invoke(<generated>)
>        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
>        at
> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
>        at
> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
>        at
> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:865)
>        at
> org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
>        at
> org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:342)
>        at
> org.apache.geronimo.kernel.KernelGBean$$FastClassByCGLIB$$1cccefc9.invoke(<generated>)
>        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
>        at
> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
>        at
> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
>        at
> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:865)
>        at
> org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
>        at
> org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java:168)
>        at
> com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
>        at
> com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
>        at
> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
>        at
> com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
>        at
> javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1408)
>        at
> javax.management.remote.rmi.RMIConnectionImpl.access$100(RMIConnectionImpl.java:81)
>        at
> javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1245)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at
> javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1348)
>        at
> javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:782)
>        at sun.reflect.GeneratedMethodAccessor413.invoke(Unknown Source)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
>        at sun.rmi.transport.Transport$1.run(Transport.java:153)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
>        at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
>        at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
>        at java.lang.Thread.run(Thread.java:595)
> Caused by: org.apache.geronimo.kernel.config.InvalidConfigException:
> Unknown start exception
>        at
> org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:514)
>        at
> org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:187)
>        at
> org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:530)
>        ... 35 more
> Caused by: org.apache.geronimo.gbean.InvalidConfigurationException:
> Configuration bcdc/cgi-bin/1.0/car failed to start due to the following
> reasons:
>  The service
> J2EEApplication=null,j2eeType=WebModule,name=bcdc/cgi-bin/1.0/car did
> not start because ContainerBase.addChild: start: LifecycleException:
> java.io.IOException: Context did not start for an unknown reason
>
>        at
> org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:477)
>        ... 37 more
>    Error: Operation failed: start of bcdc/cgi-bin/1.0/car failed
>
>        Unknown start exception
>
>        Configuration bcdc/cgi-bin/1.0/car failed to start due to the
>    following reasons:
>
>      The service
>    J2EEApplication=null,j2eeType=WebModule,name=bcdc/cgi-bin/1.0/car
>    did not start because ContainerBase.addChild: start:
>    LifecycleException:  java.io.IOException: Context did not start for
>    an unknown reason
>
>
>
> - --
>
> Peter L. Berghold     http://www.berghold.net   peter@berghold.net
> Unix Professional     Dog Agility Fan   Crazed Cook
> "Those who fail to learn from history are condemned to repeat it."
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFIe1zCUM9/01RIhaARAl3IAJ9ExTxmT15Zu+EOYb5PtiWDmxrDuQCghIr7
> 7oR00UdggZIJiujL3scJHtE=
> =6xK4
> -----END PGP SIGNATURE-----
>

Re: CGI and Geronimo/Tomcat

Posted by "Peter L. Berghold" <pe...@berghold.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kevan Miller wrote:
> 
> 
> In the jira I posted a war and some instructions on enabling cgi-bin
> support on Tomcat. 


OK.. gave it a whirl.

I made a couple of changes to the geronimo-web.xml file that (I thought)
whouldn't affect much, but here is what I got:


First the changes:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1">
  <environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
    <moduleId>
      <groupId>bcdc</groupId>
             <!-- Gave it it's own group-id !>
      <artifactId>cgi-bin</artifactId>
      <version>1.0</version>
      <type>car</type>
    </moduleId>
  </environment>

  <context-root>/cgi-bin</context-root>
  <host>www.bayshoredogclub.org</host>
  <!--- Different cgi-bin for each host. -->

</web-app>



Here's the spew....


org.apache.geronimo.kernel.config.LifecycleException: start of
bcdc/cgi-bin/1.0/car failed
        at
org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:547)
        at
org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:511)
        at
org.apache.geronimo.kernel.config.SimpleConfigurationManager$$FastClassByCGLIB$$ce77a924.invoke(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
        at
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
        at
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
        at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:865)
        at
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
        at
org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:342)
        at
org.apache.geronimo.kernel.KernelGBean$$FastClassByCGLIB$$1cccefc9.invoke(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
        at
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
        at
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
        at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:865)
        at
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
        at
org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java:168)
        at
com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
        at
com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
        at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
        at
com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
        at
javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1408)
        at
javax.management.remote.rmi.RMIConnectionImpl.access$100(RMIConnectionImpl.java:81)
        at
javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1245)
        at java.security.AccessController.doPrivileged(Native Method)
        at
javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1348)
        at
javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:782)
        at sun.reflect.GeneratedMethodAccessor413.invoke(Unknown Source)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
        at sun.rmi.transport.Transport$1.run(Transport.java:153)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
        at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
        at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
        at java.lang.Thread.run(Thread.java:595)
Caused by: org.apache.geronimo.kernel.config.InvalidConfigException:
Unknown start exception
        at
org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:514)
        at
org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:187)
        at
org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:530)
        ... 35 more
Caused by: org.apache.geronimo.gbean.InvalidConfigurationException:
Configuration bcdc/cgi-bin/1.0/car failed to start due to the following
reasons:
  The service
J2EEApplication=null,j2eeType=WebModule,name=bcdc/cgi-bin/1.0/car did
not start because ContainerBase.addChild: start: LifecycleException:
java.io.IOException: Context did not start for an unknown reason

        at
org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:477)
        ... 37 more
    Error: Operation failed: start of bcdc/cgi-bin/1.0/car failed

        Unknown start exception

        Configuration bcdc/cgi-bin/1.0/car failed to start due to the
    following reasons:

      The service
    J2EEApplication=null,j2eeType=WebModule,name=bcdc/cgi-bin/1.0/car
    did not start because ContainerBase.addChild: start:
    LifecycleException:  java.io.IOException: Context did not start for
    an unknown reason



- --

Peter L. Berghold     http://www.berghold.net   peter@berghold.net
Unix Professional     Dog Agility Fan   Crazed Cook
"Those who fail to learn from history are condemned to repeat it."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIe1zCUM9/01RIhaARAl3IAJ9ExTxmT15Zu+EOYb5PtiWDmxrDuQCghIr7
7oR00UdggZIJiujL3scJHtE=
=6xK4
-----END PGP SIGNATURE-----

Re: CGI and Geronimo/Tomcat

Posted by Kevan Miller <ke...@gmail.com>.
On Jul 13, 2008, at 1:22 PM, Peter L. Berghold wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Kevan Miller wrote:
>
>> Here's general info for Tomcat --
>> http://tomcat.apache.org/tomcat-6.0-doc/cgi-howto.html
>
> Read this two or three times (as well as the comments in the web.xml
> file) before I posted. Did what I thought it was telling me to do  
> and so
> far NG.
>
>
>> Place your scripts in WEB-INF/cgi/
>>
>
> Did that after trying to be "stubborn" and leave them in "cgi-bin"  
> where
> they were located while the website was hosted at the previous
> provider's server.  Now I am running in a VPS and have to re-invent  
> things.
>
>> Borrowing from the tomcat instructions use this as your WEB-INF/ 
>> web.xml:
>>
>
>
> Snip.  The CGI script in question (written in Perl) doesn't seem to be
> getting executed still. In fact the purpose of the script is to  
> generate
> "on the fly" javascript and what is coming back instead is the Perl  
> code
> itself instead of the javascript the Perl script should be generating.
>
> I tried setting the value for "executable" first to /usr/bin/perl and
> then to just perl and this resulted in tomcat generating an exception
> and not being able to start and complaints from my club members that
> they couldn't get to the site while all that was going on. (Figures..
> when I'm working on the site, they try to access it just then.)
>
> What disturbs me slightly is I did a search for the
> servlets-ssi.rename-to-jar or even servlets-ssi.jar file from the top
> level in Geronimo and did not find it.  Should I be worried about that
> or is that deprecated?

Tomcat 5 required you to rename servlets-cgi.renametojar to servlets- 
cgi.jar. It's not necessary in Tomcat 6 (Geronimo 2.0/2.1). The  
comments in Tomcat's web.xml configuration file are not correct.

I've created a Jira to make it simpler to enable cgi support in  
Geronimo. Would be nice if this were a plugin and that the servlet  
would permit absolute file addressing (rather than relative addressing).

In the jira I posted a war and some instructions on enabling cgi-bin  
support on Tomcat. I've included instructions (a bit of a hack) to  
allow scripts to be placed in a <geronimo-home>/cgi-bin directory.

I've tested with a simple HelloWorld perl script and it worked for me...

--kevan

Re: CGI and Geronimo/Tomcat

Posted by "Peter L. Berghold" <pe...@berghold.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kevan Miller wrote:

> Here's general info for Tomcat --
> http://tomcat.apache.org/tomcat-6.0-doc/cgi-howto.html

Read this two or three times (as well as the comments in the web.xml
file) before I posted. Did what I thought it was telling me to do and so
far NG.


> Place your scripts in WEB-INF/cgi/
> 

Did that after trying to be "stubborn" and leave them in "cgi-bin" where
they were located while the website was hosted at the previous
provider's server.  Now I am running in a VPS and have to re-invent things.

> Borrowing from the tomcat instructions use this as your WEB-INF/web.xml:
> 


Snip.  The CGI script in question (written in Perl) doesn't seem to be
getting executed still. In fact the purpose of the script is to generate
"on the fly" javascript and what is coming back instead is the Perl code
itself instead of the javascript the Perl script should be generating.

I tried setting the value for "executable" first to /usr/bin/perl and
then to just perl and this resulted in tomcat generating an exception
and not being able to start and complaints from my club members that
they couldn't get to the site while all that was going on. (Figures..
when I'm working on the site, they try to access it just then.)

What disturbs me slightly is I did a search for the
servlets-ssi.rename-to-jar or even servlets-ssi.jar file from the top
level in Geronimo and did not find it.  Should I be worried about that
or is that deprecated?



- --

Peter L. Berghold     http://www.berghold.net   peter@berghold.net
Unix Professional     Dog Agility Fan   Crazed Cook
"Those who fail to learn from history are condemned to repeat it."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIejnsUM9/01RIhaARAnuEAJ47iE+uiVFuxpdU5VZNmTiPZC3lUgCfW45w
99rago/vefnBwZ3Zypf4ZDs=
=Xtna
-----END PGP SIGNATURE-----

Re: CGI and Geronimo/Tomcat

Posted by Kevan Miller <ke...@gmail.com>.
On Jul 11, 2008, at 5:14 PM, Peter L. Berghold wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hey folks,
>
> I've been doing web searches looking for the answer to this and I  
> can't
> find my Geronimo book wherever I put it last.  I am trying enable the
> processing of CGI scripts on Geronimo.
>
> Can someone point me in the right direction?

Should be doable. I don't recall hearing about anyone who's set this  
up on Geronimo, however. If you're willing to run some experiments, I  
expect that we can help get it running...

Are you using Tomcat or Jetty as your web container?

Here's general info for Tomcat -- http://tomcat.apache.org/tomcat-6.0-doc/cgi-howto.html
Here's general info for Jetty -- http://jetty.mortbay.org/jetty5/faq/faq_s_900-Content_t_CGI.html

Now a matter of getting this running in Geronimo. Assuming you're  
using Tomcat as a web container, I'd deploy this as a web-app:

Place your scripts in WEB-INF/cgi/

Borrowing from the tomcat instructions use this as your WEB-INF/web.xml:

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd 
"
    version="2.5" >

   <!-- Common Gateway Includes (CGI) processing servlet, which  
supports     -->
   <!-- execution of external applications that conform to the CGI  
spec      -->
   <!-- requirements.  Typically, this servlet is mapped to the URL  
pattern  -->
   <!-- "/cgi-bin/*", which means that any CGI applications that  
are         -->
   <!-- executed must be present within the web application.  This  
servlet   -->
   <!-- supports the following initialization parameters (default  
values     -->
   <!-- are in square  
brackets):                                             -->
    
< 
!--                                                                      -->
   <!--   cgiPathPrefix        The CGI search path will start  
at             -->
   <!--                        webAppRootDir + File.separator + this  
prefix. -->
   <!--                        [WEB-INF/ 
cgi]                                 -->
    
< 
!--                                                                      -->
   <!--   debug                Debugging detail level for messages  
logged    -->
   <!--                        by this servlet.   
[0]                         -->
    
< 
!--                                                                      -->
   <!--   executable           Name of the exectuable used to run  
the        -->
   <!--                        script.  
[perl]                                -->
    
< 
!--                                                                      -->
   <!--   parameterEncoding    Name of parameter encoding to be used  
with    -->
   <!--                        CGI  
servlet.                                  -->
   <!--                         
[System.getProperty("file.encoding","UTF-8")] -->
    
< 
!--                                                                      -->
   <!--   passShellEnvironment Should the shell environment variables  
(if    -->
   <!--                        any) be passed to the CGI script?  
[false]     -->
    
< 
!--                                                                      -->
   <!-- IMPORTANT: To use the CGI servlet, you also need to rename  
the       -->
   <!--            $CATALINA_HOME/server/lib/servlets-cgi.renametojar  
file   -->
   <!--            to $CATALINA_HOME/server/lib/servlets- 
cgi.jar             -->

     <servlet>
         <servlet-name>cgi</servlet-name>
         <servlet-class>org.apache.catalina.servlets.CGIServlet</ 
servlet-class>
         <init-param>
           <param-name>debug</param-name>
           <param-value>0</param-value>
         </init-param>
         <init-param>
           <param-name>cgiPathPrefix</param-name>
           <param-value>WEB-INF/cgi</param-value>
         </init-param>
          <load-on-startup>5</load-on-startup>
     </servlet>

     <!-- The mapping for the CGI Gateway servlet -->

     <servlet-mapping>
         <servlet-name>cgi</servlet-name>
         <url-pattern>/cgi-bin/*</url-pattern>
     </servlet-mapping>

</web-app>

Deploy the app and test... Let us know your results.

--kevan