You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Szymon Stasik <sz...@3dart.com> on 2001/04/06 20:43:29 UTC

multiple usage of same classes in different jars

Hi

I'm running Tomcat 4.0-b3 (standalone) and have some bit weired problem.
I know that it is possible to have eg.:

user1/WEB-INF
user2/WEB-INF

with apriopriate contexts:

<Context path="/userX" 
  docBase="/home/userX/tomcat"
  debug="0"
  reloadable="false">
  <Logger className="org.apache.catalina.logger.FileLogger"
    prefix="framework_userX_log." suffix=".txt"
    timestamp="true"/>
</Context>

so both users can run/develop their application with no conflicts with
other. My idea is to run cocoon (1.8) with this environment. I have
(hopefully) solved classloader problem in cocoon, so even XSP is working
good for me while having all jars in user1/WEB-INF/lib. Now I'd like
user2 to have his own copy of all the jars in user2/WEB-INF/lib so he
can use modified wersion of his own jars or cocoon or any other classes.
AFAIK in Tomcat 4 it should be possible to allow simultanous work of
both users with their own versions of same classes.

However the results are that both users receive instances of classes
from one of them. Strange thing - I was testing Class objects - all
classes from my jars seems to be different for both users (eg testing
org.apache.cocoon.Cocoon.hashCode() or any other class from WEB-INF/lib)
but the code executed is the same for both users and for both staticaly
(servlet) and dynamicaly (xsp) loaded code. 

Is it my misconfiguration, misunderstadnig or wrong behaviour of Tomcat
or Cocoon? 


regards,

Szymon.

Re: multiple usage of same classes in different jars

Posted by Remy Maucherat <re...@apache.org>.
> Remy Maucherat wrote:
> > [...]
> > >
> > > It's (c) wrong behavior of Tomcat.  Remy is currently investigating a
fix
> > > for this.
> >
> > As I said privately, I have a fix. Should I commit it now ?
>
> I'v checked latest CVS (an hour ago) but the problem is still the same
> :/

The example given in attachement to bug 1219 works fine for me now, and it
should be the same case (ie : trouble when JARs in different webapps have
the same name).
http://nagoya.betaversion.org/bugzilla/show_bug.cgi?id=1219

Remy


Re: multiple usage of same classes in different jars

Posted by Szymon Stasik <sz...@3dart.com>.
Remy Maucherat wrote:
> [...]
> >
> > It's (c) wrong behavior of Tomcat.  Remy is currently investigating a fix
> > for this.
> 
> As I said privately, I have a fix. Should I commit it now ?

I'v checked latest CVS (an hour ago) but the problem is still the same
:/


Szymon

Re: multiple usage of same classes in different jars

Posted by Szymon Stasik <sz...@3dart.com>.
"Craig R. McClanahan" wrote:
> 
> On Fri, 6 Apr 2001, Craig R. McClanahan wrote:
> 
> >
> >
> > On Fri, 6 Apr 2001, Remy Maucherat wrote:
> >
> > > > On Fri, 6 Apr 2001, Szymon Stasik wrote:
> > > >
> > > > >
[...]
> > > > >
> > > > > Is it my misconfiguration, misunderstadnig or wrong behaviour of Tomcat
> > > > > or Cocoon?
> > > > >
> > > >
> > > > It's (c) wrong behavior of Tomcat.  Remy is currently investigating a fix
> > > > for this.
> > >
> > > As I said privately, I have a fix. Should I commit it now ?
> > >
> >
> > Yes ... I can back it out if needed.  One thing I need to double check is
> > what this does when you run with a security manager -- we might need to
> > tweak how the default policy file works too.
> >
> 
> Yep ... it definitely messes up when you use the "-security" switch at
> startup.  I'm looking into it.


So - I would be happy to try this path :)

regards,

Szymon

Re: multiple usage of same classes in different jars

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

On Fri, 6 Apr 2001, Craig R. McClanahan wrote:

> 
> 
> On Fri, 6 Apr 2001, Remy Maucherat wrote:
> 
> > > On Fri, 6 Apr 2001, Szymon Stasik wrote:
> > >
> > > >
> > > > Hi
> > > >
> > > > I'm running Tomcat 4.0-b3 (standalone) and have some bit weired problem.
> > > > I know that it is possible to have eg.:
> > > >
> > > > user1/WEB-INF
> > > > user2/WEB-INF
> > > >
> > > > with apriopriate contexts:
> > > >
> > > > <Context path="/userX"
> > > >   docBase="/home/userX/tomcat"
> > > >   debug="0"
> > > >   reloadable="false">
> > > >   <Logger className="org.apache.catalina.logger.FileLogger"
> > > >     prefix="framework_userX_log." suffix=".txt"
> > > >     timestamp="true"/>
> > > > </Context>
> > > >
> > > > so both users can run/develop their application with no conflicts with
> > > > other. My idea is to run cocoon (1.8) with this environment. I have
> > > > (hopefully) solved classloader problem in cocoon, so even XSP is working
> > > > good for me while having all jars in user1/WEB-INF/lib. Now I'd like
> > > > user2 to have his own copy of all the jars in user2/WEB-INF/lib so he
> > > > can use modified wersion of his own jars or cocoon or any other classes.
> > > > AFAIK in Tomcat 4 it should be possible to allow simultanous work of
> > > > both users with their own versions of same classes.
> > > >
> > > > However the results are that both users receive instances of classes
> > > > from one of them. Strange thing - I was testing Class objects - all
> > > > classes from my jars seems to be different for both users (eg testing
> > > > org.apache.cocoon.Cocoon.hashCode() or any other class from WEB-INF/lib)
> > > > but the code executed is the same for both users and for both staticaly
> > > > (servlet) and dynamicaly (xsp) loaded code.
> > > >
> > > > Is it my misconfiguration, misunderstadnig or wrong behaviour of Tomcat
> > > > or Cocoon?
> > > >
> > >
> > > It's (c) wrong behavior of Tomcat.  Remy is currently investigating a fix
> > > for this.
> > 
> > As I said privately, I have a fix. Should I commit it now ?
> > 
> 
> Yes ... I can back it out if needed.  One thing I need to double check is
> what this does when you run with a security manager -- we might need to
> tweak how the default policy file works too.
> 

Yep ... it definitely messes up when you use the "-security" switch at
startup.  I'm looking into it.

But the good news is that it seems to work quite nicely without a security
manager.

> > Remy
> > 
> > 
> 
> Craig
> 
> 
> 

Craig



Re: multiple usage of same classes in different jars

Posted by Glenn Nielsen <gl...@voyager.apg.more.net>.

On Fri, 6 Apr 2001, Craig R. McClanahan wrote:

> 
> 
> On Fri, 6 Apr 2001, Remy Maucherat wrote:
> 
> > > On Fri, 6 Apr 2001, Szymon Stasik wrote:
> > >
> > > >
> > > > Hi
> > > >
> > > > I'm running Tomcat 4.0-b3 (standalone) and have some bit weired problem.
> > > > I know that it is possible to have eg.:
> > > >
> > > > user1/WEB-INF
> > > > user2/WEB-INF
> > > >
> > > > with apriopriate contexts:
> > > >
> > > > <Context path="/userX"
> > > >   docBase="/home/userX/tomcat"
> > > >   debug="0"
> > > >   reloadable="false">
> > > >   <Logger className="org.apache.catalina.logger.FileLogger"
> > > >     prefix="framework_userX_log." suffix=".txt"
> > > >     timestamp="true"/>
> > > > </Context>
> > > >
> > > > so both users can run/develop their application with no conflicts with
> > > > other. My idea is to run cocoon (1.8) with this environment. I have
> > > > (hopefully) solved classloader problem in cocoon, so even XSP is working
> > > > good for me while having all jars in user1/WEB-INF/lib. Now I'd like
> > > > user2 to have his own copy of all the jars in user2/WEB-INF/lib so he
> > > > can use modified wersion of his own jars or cocoon or any other classes.
> > > > AFAIK in Tomcat 4 it should be possible to allow simultanous work of
> > > > both users with their own versions of same classes.
> > > >
> > > > However the results are that both users receive instances of classes
> > > > from one of them. Strange thing - I was testing Class objects - all
> > > > classes from my jars seems to be different for both users (eg testing
> > > > org.apache.cocoon.Cocoon.hashCode() or any other class from WEB-INF/lib)
> > > > but the code executed is the same for both users and for both staticaly
> > > > (servlet) and dynamicaly (xsp) loaded code.
> > > >
> > > > Is it my misconfiguration, misunderstadnig or wrong behaviour of Tomcat
> > > > or Cocoon?
> > > >
> > >
> > > It's (c) wrong behavior of Tomcat.  Remy is currently investigating a fix
> > > for this.
> > 
> > As I said privately, I have a fix. Should I commit it now ?
> > 
> 
> Yes ... I can back it out if needed.  One thing I need to double check is
> what this does when you run with a security manager -- we might need to
> tweak how the default policy file works too.
>

I'll look into this early next week and get a patch committed.

Glenn
 
> > Remy
> > 
> > 
> 
> Craig
> 
> 


Re: multiple usage of same classes in different jars

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

On Fri, 6 Apr 2001, Remy Maucherat wrote:

> > On Fri, 6 Apr 2001, Szymon Stasik wrote:
> >
> > >
> > > Hi
> > >
> > > I'm running Tomcat 4.0-b3 (standalone) and have some bit weired problem.
> > > I know that it is possible to have eg.:
> > >
> > > user1/WEB-INF
> > > user2/WEB-INF
> > >
> > > with apriopriate contexts:
> > >
> > > <Context path="/userX"
> > >   docBase="/home/userX/tomcat"
> > >   debug="0"
> > >   reloadable="false">
> > >   <Logger className="org.apache.catalina.logger.FileLogger"
> > >     prefix="framework_userX_log." suffix=".txt"
> > >     timestamp="true"/>
> > > </Context>
> > >
> > > so both users can run/develop their application with no conflicts with
> > > other. My idea is to run cocoon (1.8) with this environment. I have
> > > (hopefully) solved classloader problem in cocoon, so even XSP is working
> > > good for me while having all jars in user1/WEB-INF/lib. Now I'd like
> > > user2 to have his own copy of all the jars in user2/WEB-INF/lib so he
> > > can use modified wersion of his own jars or cocoon or any other classes.
> > > AFAIK in Tomcat 4 it should be possible to allow simultanous work of
> > > both users with their own versions of same classes.
> > >
> > > However the results are that both users receive instances of classes
> > > from one of them. Strange thing - I was testing Class objects - all
> > > classes from my jars seems to be different for both users (eg testing
> > > org.apache.cocoon.Cocoon.hashCode() or any other class from WEB-INF/lib)
> > > but the code executed is the same for both users and for both staticaly
> > > (servlet) and dynamicaly (xsp) loaded code.
> > >
> > > Is it my misconfiguration, misunderstadnig or wrong behaviour of Tomcat
> > > or Cocoon?
> > >
> >
> > It's (c) wrong behavior of Tomcat.  Remy is currently investigating a fix
> > for this.
> 
> As I said privately, I have a fix. Should I commit it now ?
> 

Yes ... I can back it out if needed.  One thing I need to double check is
what this does when you run with a security manager -- we might need to
tweak how the default policy file works too.

> Remy
> 
> 

Craig



Re: multiple usage of same classes in different jars

Posted by Remy Maucherat <re...@apache.org>.
> On Fri, 6 Apr 2001, Szymon Stasik wrote:
>
> >
> > Hi
> >
> > I'm running Tomcat 4.0-b3 (standalone) and have some bit weired problem.
> > I know that it is possible to have eg.:
> >
> > user1/WEB-INF
> > user2/WEB-INF
> >
> > with apriopriate contexts:
> >
> > <Context path="/userX"
> >   docBase="/home/userX/tomcat"
> >   debug="0"
> >   reloadable="false">
> >   <Logger className="org.apache.catalina.logger.FileLogger"
> >     prefix="framework_userX_log." suffix=".txt"
> >     timestamp="true"/>
> > </Context>
> >
> > so both users can run/develop their application with no conflicts with
> > other. My idea is to run cocoon (1.8) with this environment. I have
> > (hopefully) solved classloader problem in cocoon, so even XSP is working
> > good for me while having all jars in user1/WEB-INF/lib. Now I'd like
> > user2 to have his own copy of all the jars in user2/WEB-INF/lib so he
> > can use modified wersion of his own jars or cocoon or any other classes.
> > AFAIK in Tomcat 4 it should be possible to allow simultanous work of
> > both users with their own versions of same classes.
> >
> > However the results are that both users receive instances of classes
> > from one of them. Strange thing - I was testing Class objects - all
> > classes from my jars seems to be different for both users (eg testing
> > org.apache.cocoon.Cocoon.hashCode() or any other class from WEB-INF/lib)
> > but the code executed is the same for both users and for both staticaly
> > (servlet) and dynamicaly (xsp) loaded code.
> >
> > Is it my misconfiguration, misunderstadnig or wrong behaviour of Tomcat
> > or Cocoon?
> >
>
> It's (c) wrong behavior of Tomcat.  Remy is currently investigating a fix
> for this.

As I said privately, I have a fix. Should I commit it now ?

Remy


Re: multiple usage of same classes in different jars

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

On Fri, 6 Apr 2001, Szymon Stasik wrote:

> 
> Hi
> 
> I'm running Tomcat 4.0-b3 (standalone) and have some bit weired problem.
> I know that it is possible to have eg.:
> 
> user1/WEB-INF
> user2/WEB-INF
> 
> with apriopriate contexts:
> 
> <Context path="/userX" 
>   docBase="/home/userX/tomcat"
>   debug="0"
>   reloadable="false">
>   <Logger className="org.apache.catalina.logger.FileLogger"
>     prefix="framework_userX_log." suffix=".txt"
>     timestamp="true"/>
> </Context>
> 
> so both users can run/develop their application with no conflicts with
> other. My idea is to run cocoon (1.8) with this environment. I have
> (hopefully) solved classloader problem in cocoon, so even XSP is working
> good for me while having all jars in user1/WEB-INF/lib. Now I'd like
> user2 to have his own copy of all the jars in user2/WEB-INF/lib so he
> can use modified wersion of his own jars or cocoon or any other classes.
> AFAIK in Tomcat 4 it should be possible to allow simultanous work of
> both users with their own versions of same classes.
> 
> However the results are that both users receive instances of classes
> from one of them. Strange thing - I was testing Class objects - all
> classes from my jars seems to be different for both users (eg testing
> org.apache.cocoon.Cocoon.hashCode() or any other class from WEB-INF/lib)
> but the code executed is the same for both users and for both staticaly
> (servlet) and dynamicaly (xsp) loaded code. 
> 
> Is it my misconfiguration, misunderstadnig or wrong behaviour of Tomcat
> or Cocoon? 
> 

It's (c) wrong behavior of Tomcat.  Remy is currently investigating a fix
for this.

> 
> regards,
> 
> Szymon.
> 

Craig