You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Anand B N <an...@learningbyte.com> on 2001/08/26 17:58:51 UTC

Help with Tomcat4

Hi,

I'm using experimenting with Tomcat4 and I did the following:-

I wrote a servlet that implements the ContainerServlet[Obviosuly in the org.apache.catalina.servlets package] . Now I have a set of JSPs which in turn use a set of Java beans whcih in turn use this Servlet for getting hol of information on Context etc. However I am facing the follwing problem:-

In my Java bean if I import org.apache.catalina.Deployer it's not able to find the class in my classpath and throws a ClassNotFoundException. I found this problem very weird as these are the classes in the standard JAR that comes with Tomcat 4.

Could someone please explain this to me?

Anand
Associate,R&D,
Digital Think 


Re: Help with Tomcat4

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

On Sun, 26 Aug 2001, Anand B N wrote:

> Date: Sun, 26 Aug 2001 21:28:51 +0530
> From: Anand B N <an...@learningbyte.com>
> Reply-To: tomcat-user@jakarta.apache.org
> To: tomcat-user@jakarta.apache.org
> Subject: Help with Tomcat4
>
> Hi,
>
> I'm using experimenting with Tomcat4 and I did the following:-
>
> I wrote a servlet that implements the ContainerServlet[Obviosuly in
> the org.apache.catalina.servlets package] . Now I have a set of JSPs
> which in turn use a set of Java beans whcih in turn use this Servlet
> for getting hol of information on Context etc. However I am facing the
> follwing problem:-
>
> In my Java bean if I import org.apache.catalina.Deployer it's not able
> to find the class in my classpath and throws a ClassNotFoundException.
> I found this problem very weird as these are the classes in the
> standard JAR that comes with Tomcat 4.
>
> Could someone please explain this to me?

Container servlets are loaded from the Catalina internal class
loader, so the servlet class itself (and any beans it references) has to
be loaded from a $CATALINA_HOME/server/classes, or a JAR file in
$CATALINA_HOME/server/lib.  If the bean classes must also be referenced
from within your webapp, you can put them unde
$CATALINA_HOME/common/classes or $CATALINA_HOME/common/lib to make them
available both internally and externally.

It goes without saying that using this facility is very much specific to
Tomcat 4, and you should be very security conscious in your programming --
since the Container servlet has complete access to Catalina internals.
But the technique is definitely useful for building Tomcat 4
administrative tools as web applications.

>
> Anand
> Associate,R&D,
> Digital Think
>
>

Craig McClanahan