You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mark Muffett <ma...@muffett.net> on 2001/10/18 10:48:12 UTC

Tomcat 4 & CGI

I'm using Tomcat v4.0.1 on port 80 (ie without Apache)

Since I have a few legacy sites, I've had to enable the cgi facility.  I've
done this, and the .pl files get called, but it seems that no parameters are
being passed - any ideas?

Thanks for any help

Mark Muffett


Re: regd classloader

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 19 Oct 2001, simon wrote:

> Date: Fri, 19 Oct 2001 09:16:26 +0900
> From: simon <si...@lexues.co.jp>
> Reply-To: tomcat-user@jakarta.apache.org
> To: tomcat-user@jakarta.apache.org
> Subject: Re: regd classloader
>
> And would it be right to say:
>
> ----- Original Message -----
> From: "Craig R. McClanahan" <cr...@apache.org>
> To: <to...@jakarta.apache.org>
> Cc: <so...@xml.apache.org>
> Sent: Friday, October 19, 2001 12:08 AM
> Subject: Re: regd classloader
>
>
> >
> > Consider a simplified version of the hierarchy:
> >
> >     Common  (package C)
>
> ... are loaded from $TOMCAT_HOME/common/lib
>

Yes, plus unpacked classes from $TOMCAT_HOME/common/classes if it exists.

> >       |
> >     Shared  (package S)
>
> ... are loaded from $TOMCAT_HOME/lib

Yes, plus unpacked classes from $TOMCAT_HOME/classes if it exists.
>
> >       |
> >     Webapp  (package W)
>
> ... are loaded from WEB-INF

Yes, JAR files are loaded from WEB-INF/lib and unpacked classes are loaded
from WEB-INF/classes.
>
> ?
>
> >
> > Craig
>
> simon
>
>
>
Craig

PS:  Note that in Tomcat 4.1 (or if you are using the nightly builds from
the HEAD branch, the Shared class loader has been switched to load from
$TOMCAT_HOME/shared/lib and $TOMCAT_HOME/shared/classes insted of
$TOMCAT_HOME/lib and $TOMCAT_HOME/classes.  This is to improve the
consistency and make it even easier to remember which classloader gets
which classes.



Re: regd classloader

Posted by simon <si...@lexues.co.jp>.
And would it be right to say:

----- Original Message ----- 
From: "Craig R. McClanahan" <cr...@apache.org>
To: <to...@jakarta.apache.org>
Cc: <so...@xml.apache.org>
Sent: Friday, October 19, 2001 12:08 AM
Subject: Re: regd classloader


> 
> Consider a simplified version of the hierarchy:
> 
>     Common  (package C)

... are loaded from $TOMCAT_HOME/common/lib

>       |
>     Shared  (package S)

... are loaded from $TOMCAT_HOME/lib

>       |
>     Webapp  (package W)

... are loaded from WEB-INF

?

> 
> Craig

simon



Re: regd classloader

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 18 Oct 2001, E B wrote:

> Date: Thu, 18 Oct 2001 10:28:27 +0100 (BST)
> From: E B <he...@yahoo.co.uk>
> Reply-To: tomcat-user@jakarta.apache.org
> To: tomcat-user@jakarta.apache.org, soap-user@xml.apache.org
> Subject: regd classloader
>
> Hi
> In tc4, whats the difference between "shared"
> and "common" class loader ? From the docs, I
> understand
> that from the webapp's point of view they are same.
> ie., they both give classes to all the webapps.
> Am I correct ?
>

The "shared" class loader is visible to all webapps, but NOT to Tomcat's
internal classes.

The "common" class loader is visible to all webapps AND to Tomcat's
internal classes.  A common scenario is where you wanted to use the same
JDBC driver for both a JDBCRealm implementation (so Tomcat needs access to
it) and one or more webapps.

> I want my webapp's classes to be visible and shared
> by a soap service. When I put my app's classes in
> shared dir my apache-soap's service could not find the
>
> app's classes. But it worked when I moved them to
> common/classes. So there seems to be something I am
> missing. what is it ?
>

The most likely cause is that you're trying to load classes from a "lower"
class loader in the hierarchy, which won't work.

Consider a simplified version of the hierarchy:

    Common  (package C)
      |
    Shared  (package S)
      |
    Webapp  (package W)

Now, consider what is visible to classes from each place:

* Classes in the Webapp class loader can see packages W, S, and C

* Classes in the Shared class loader can see packages S and C

* Classes in the Common class loader can see package C only.

In your scenario, it's likely that you had some class in the common
package that was trying to load your app's classes.  That won't work
unless the app's classes are also in the Common loader, OR unless the
service classes take advantage of the Context Class Loader mechanism to
get access to the webapp class loader for the current request:

  ClassLoader cl = Thread.currentThread().getContextClassLoader();
  Class clazz = cl.loadClass("W.Foo");

Craig


regd classloader

Posted by E B <he...@yahoo.co.uk>.
Hi
In tc4, whats the difference between "shared" 
and "common" class loader ? From the docs, I
understand
that from the webapp's point of view they are same.
ie., they both give classes to all the webapps. 
Am I correct ?

I want my webapp's classes to be visible and shared
by a soap service. When I put my app's classes in 
shared dir my apache-soap's service could not find the

app's classes. But it worked when I moved them to 
common/classes. So there seems to be something I am 
missing. what is it ?



____________________________________________________________
Nokia Game is on again. 
Go to http://uk.yahoo.com/nokiagame/ and join the new
all media adventure before November 3rd.

regd classloader

Posted by E B <he...@yahoo.co.uk>.
Hi
In tc4, whats the difference between "shared" 
and "common" class loader ? From the docs, I
understand
that from the webapp's point of view they are same.
ie., they both give classes to all the webapps. 
Am I correct ?

I want my webapp's classes to be visible and shared
by a soap service. When I put my app's classes in 
shared dir my apache-soap's service could not find the

app's classes. But it worked when I moved them to 
common/classes. So there seems to be something I am 
missing. what is it ?



____________________________________________________________
Nokia Game is on again. 
Go to http://uk.yahoo.com/nokiagame/ and join the new
all media adventure before November 3rd.

regd classloader

Posted by E B <he...@yahoo.co.uk>.
Hi
In tc4, whats the difference between "shared" 
and "common" class loader ? From the docs, I
understand
that from the webapp's point of view they are same.
ie., they both give classes to all the webapps. 
Am I correct ?

I want my webapp's classes to be visible and shared
by a soap service. When I put my app's classes in 
shared dir my apache-soap's service could not find the

app's classes. But it worked when I moved them to 
common/classes. So there seems to be something I am 
missing. what is it ?



____________________________________________________________
Nokia Game is on again. 
Go to http://uk.yahoo.com/nokiagame/ and join the new
all media adventure before November 3rd.

Re: Tomcat 4 & CGI

Posted by Mark Muffett <ma...@muffett.net>.
I've just managed to it to work using GET, but still can't get any
parameters with POST - any ideas? - it must be something to do with the read
from stdin...

Mark

----- Original Message -----
From: "Mark Muffett" <ma...@muffett.net>
To: <to...@jakarta.apache.org>
Sent: Thursday, October 18, 2001 9:48 AM
Subject: Tomcat 4 & CGI


> I'm using Tomcat v4.0.1 on port 80 (ie without Apache)
>
> Since I have a few legacy sites, I've had to enable the cgi facility.
I've
> done this, and the .pl files get called, but it seems that no parameters
are
> being passed - any ideas?
>
> Thanks for any help
>
> Mark Muffett
>