tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Cronin <...@13-colonies.com>
Subject RE: choosing where to deploy class files
Date Thu, 09 May 2002 16:27:26 GMT
Thanks.

I was afraid of that.

>* Anything that needs to be both places is a sign
>  that you should refactor your classes into
>  smaller pieces -- in particular, to make the ones that
>  need to be visible to your webapp not depend on
>  Catalina internals.

My web apps don't need to see Catalina internals but
I access the DB in Both places and we have a 
Package that handles all DB access and resource
allocation. This package is out of my control so
I am un able to Refactor it. 

There is any work around?


-----Original Message-----
From: Craig R. McClanahan [mailto:craigmcc@apache.org]
Sent: Thursday, May 09, 2002 11:06 AM
To: Tomcat Users List
Cc: 'rnf@tbird.com'
Subject: RE: choosing where to deploy class files




On Thu, 9 May 2002, Tim Cronin wrote:

> Date: Thu, 9 May 2002 09:46:21 -0500
> From: Tim Cronin <tim@13-colonies.com>
> Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> To: 'Tomcat Users List' <tomcat-user@jakarta.apache.org>
> Cc: "'rnf@tbird.com'" <rnf@tbird.com>
> Subject: RE: choosing where to deploy class files
>
> thanks but...
>
> > For files to be available to both your web apps AND Tomcat
> >
> > Put jar files in /tomcat/common/lib
> > Put un-jarred class files in /tomcat/common/classes
>
> I tried these under 4.0.3 and...
>
> >> placing my classes at $CATALINA_HOME/common/classes
> >> it finds my Realm but I get:
> >> NoClassDefFoundError org/apache/catalina/realm/RealmBase
>
> It can't find the Catalina classes that are located at
> server\lib\catalina.jar
>

That's to be expected ... per the Catalina class loader architecture,
common/lib is loaded from a parent class loader of the one that loads
server/lib.

> putting them in server\classes makes them unavailable to
> my we apps.
>

That is also to be expected.  It's the whole point of the class loader
architecture.

> Are you saying that 4.1 Fixes this or just the fixes the Docs?
>

Neither of the above.  What you need to do is split up your classes and
put them in *both* places:

* Anything that depends on an internal org.apache.catalina
  class needs to be in server/classes or server/lib.

* Anything that is needed by the classes above *and* by
  classes from your webapps needs to be in common/classes
  or common/lib.

* Anything that needs to be both places is a sign
  that you should refactor your classes into
  smaller pieces -- in particular, to make the ones that
  need to be visible to your webapp not depend on
  Catalina internals.

Craig


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

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


Mime
View raw message