Yes the class is in the right directory corresponding to it's package. The
whole thing just works abolutely fine if I link the
webapps/myapp/WEB-INF/classes/com directory into commons/classes, so chances
are the problem is not locatet in my app. I already dived a bit deeper into
the subject but I only found more questions rather than answers.

The exception gets thrown by the class org.apache.catalina.startup.Catalina
during the server startup process. At the time this class tries to load the
Listener class there are only two jars in the classpath (tools.jar and
bootstrap.jar, both set by the startup script) and as far as I can see only
the classloaders for the server/ common/ and shared/ directories in the
catalina home directory have been created.
The exact point of interest is in org.apache.catalina.startup.ContextRuleSet
in method addRuleInstances(Digester):
        [..]
        digester.addObjectCreate(prefix + "Context/Listener",
                                 null, // MUST be specified in the element
                                 "className");
        digester.addSetProperties(prefix + "Context/Listener");
        digester.addSetNext(prefix + "Context/Listener",
                            "addLifecycleListener",
                            "org.apache.catalina.LifecycleListener");

        digester.addRule(prefix + "Context/Loader",
                         new CreateLoaderRule
                             (digester,
                              "org.apache.catalina.loader.WebappLoader",
                              "className"));
        digester.addSetProperties(prefix + "Context/Loader");
        digester.addSetNext(prefix + "Context/Loader",
                            "setLoader",
                            "org.apache.catalina.Loader");

Do I get that right, that this means the Context/Listener object is created
_before_ the webapp classloader? And if so, is this a bug or a feature? (And
by looking over the mail again, will this still be a tomcat-user question or
should I post in tomcat-devel?)

I am not sure weather this is really the point where the problem is located
but so far this is the only trace I have. If it is, then there must be other
people having the same problem, no? Any comments or suggestions are very
welcome even a "don't think so complicated, stupid, you just did it wrong
here".

Thanks
Tobi



----- Original Message -----
From: "Kief Morris" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Friday, December 20, 2002 4:12 PM
Subject: Re: Listener Element in Context: class not found Exception


> [EMAIL PROTECTED] typed the following on 13:29 20/12/2002 +0100
> >I always get a ClassNotFound
> >Exception for the class I specify in the attribute className when I
> >try to start catalina.
> ...
> >  <Context path="/myapp" docBase="myapp" debug="1">
> >    <Listener className="com.mypackage.ListenerClass"/>
> >  </Context>
> ...
> >The corresponding com.mypackage.ListenerClass resides inside it's web
> >application directory webapps/myapp/WEB-INF/classes.
>
> Are you sure the class file is in:
>   webapps/myapp/WEB-INF/classes/com/mypackage/ListenerClass.class,
> and not just in the base classes directory? The directory structure needs
to
> match the package.
>
> Kief
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>


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

Reply via email to