On Tue, 3 Dec 2002, Jim Coble wrote:

> Date: Tue, 3 Dec 2002 09:27:14 -0500
> From: Jim Coble <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Classloader behavior in Struts 1.0.2 and Tomcat 4.1.12
>
> I've just seen some surprising behavior in finding Action classes depending
> on where I put the struts.jar file and where I put the action class.  Has
> anyone else seen this?  Is this how one would expect it to work?  I'm using
> Struts 1.0.2 and Tomcat 4.1.12 on a Solaris 8 Sun server.
>
> If I put struts.jar in $CATALINA_HOME/common/lib and the action class for a
> particular mapping in $CATALINA_HOME/common/classes/..., all works well.
>
> Likewise, all works well if I put struts.jar in
> $CATALINA_HOME/webapps/MyApp/WEB-INF/lib and the action class in
> $CATALINA_HOME/webapps/MyApp/WEB-INF/classes/...
>
> However, if I put struts.jar in $CATALINA_HOME/webapps/MyApp/WEB-INF/lib
> and the action class in $CATALINA_HOME/common/classes/..., I get a "class
> not found" error for class "org/apache/struts/action/Action" when it tries
> to instantiate my action class.
>
> And, if I put struts.jar in $CATALINA_HOME/common/lib and my action class
> in $CATALINA_HOME/webapps/MyApp/WEB-INF/classes/..., I get a "class not
> found" error for my action class when it tries to instantiate the mapping.
>
> Obviously, the work-around is to put both pieces in one place or the other
> but I don't understand why that should be the case, assuming I get the
> package names right, etc.
>
> I'm guessing that this has something to do with the way in which Tomcat
> 4.1.12 handles class loading but, if anyone could shed light on this, I
> would much appreciate it.
>

Struts 1.0.2 will absolutely *NOT* work if you put struts.jar anywhere
other than in the webapp's /WEB-INF/lib directory.  Struts 1.1 *should*
work in this scenario, but there are no guarantees.

Lots of people (including me) run Struts 1.0.2 apps on Tomcat 4.1.12
without problems, using the standard approach of including both struts.jar
and the application classes inside the webapp.  Does the standard Struts
example app work for you?  Do you possibly have struts.jar or your
application classes in the Java extensions directory?

> Thanks in advance.
> --Jim

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to