You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Eric Guinois <gu...@icod.ca> on 2007/03/01 22:51:02 UTC

Loader component nested in Context

Hi,
    I'm trying to use my own ClassLoader for my Web-Application. I 
google a long time and find that the Loader component in the Context 
component could help me to replace the ClassLoader of my web application 
(subclassing WebappClassLoader).

    In the first place, I tried to use the default parameters for the 
Loader component. My context file 
($CATALINA_HOME/conf/engine/host/context.xml)  was

<Context path="/app"
                 reloadable="true"
                 docBase="C:/apacheTest/test/app"
                 workDir="C:/apacheTest/test/app/work" />

and my application were loading and working properly.

When I change to

<Context path="/app"
                 reloadable="true"
                 docBase="C:/apacheTest/test/app"
                 workDir="C:/apacheTest/test/app/work" >
<Loader
                className="org.apache.catalina.loader.WebappLoader"
                delegate="false"
                
loaderClass="org.apache.catalina.loader.WebappClassLoader" />
</Context>


I always got this error in the console :

2007-03-01 16:37:19 org.apache.catalina.core.StandardContext start
GRAVE: Error listenerStart
2007-03-01 16:37:19 org.apache.catalina.core.StandardContext start
GRAVE: Erreur de dÚmarrage du contexte [/app] suite aux erreurs prÚcÚdentes

I googled and searched for information with this error and googled for 
example using Loader component without any success.

How can I use the Loader component properly?

I'm using Tomcat 5.5.20 and tried it only under Windows.

Thank you in advance for your time.

Eric Guinois



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Loader component nested in Context

Posted by David Delbecq <de...@oma.be>.
Eric Guinois a écrit :
> Ok, just found the solution. When adding Loader component intot
> context descriptor, the default value for useSystemClassLoaderAsParent
> is true and cause a ClassNotFound error. To fix I added
> useSystemClassLoaderAsParent="false" on my Loader component.
> I don't know if It is normal that the default value of the
> useSystemClassLoaderAsParent attribute is not the same value as used
> when "skipping" the Loader component? I didn't found any config file
> anywhere overwritting the default values.
>
According to tomcat docs, the default value is true for compatibility
reasons. But maybe the default classloader is not loaded at context
level, which might make a difference. Also, seems it's a deprecated
value that will be removed in tomcat 6.

>
> Eric
>
> Eric Guinois a écrit :
>> Hi,
>>    I'm trying to use my own ClassLoader for my Web-Application. I
>> google a long time and find that the Loader component in the Context
>> component could help me to replace the ClassLoader of my web
>> application (subclassing WebappClassLoader).
>>
>>    In the first place, I tried to use the default parameters for the
>> Loader component. My context file
>> ($CATALINA_HOME/conf/engine/host/context.xml)  was
>>
>> <Context path="/app"
>>                 reloadable="true"
>>                 docBase="C:/apacheTest/test/app"
>>                 workDir="C:/apacheTest/test/app/work" />
>>
>> and my application were loading and working properly.
>>
>> When I change to
>>
>> <Context path="/app"
>>                 reloadable="true"
>>                 docBase="C:/apacheTest/test/app"
>>                 workDir="C:/apacheTest/test/app/work" >
>> <Loader
>>                className="org.apache.catalina.loader.WebappLoader"
>>                delegate="false"
>>               
>> loaderClass="org.apache.catalina.loader.WebappClassLoader" />
>> </Context>
>>
>>
>> I always got this error in the console :
>>
>> 2007-03-01 16:37:19 org.apache.catalina.core.StandardContext start
>> GRAVE: Error listenerStart
>> 2007-03-01 16:37:19 org.apache.catalina.core.StandardContext start
>> GRAVE: Erreur de dÚmarrage du contexte [/app] suite aux erreurs
>> prÚcÚdentes
>>
>> I googled and searched for information with this error and googled
>> for example using Loader component without any success.
>>
>> How can I use the Loader component properly?
>>
>> I'm using Tomcat 5.5.20 and tried it only under Windows.
>>
>> Thank you in advance for your time.
>>
>> Eric Guinois
>>
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Loader component nested in Context

Posted by Eric Guinois <gu...@icod.ca>.
Ok, just found the solution. When adding Loader component intot context 
descriptor, the default value for useSystemClassLoaderAsParent is true 
and cause a ClassNotFound error. To fix I added 
useSystemClassLoaderAsParent="false" on my Loader component.

<Context path="/app"
                 reloadable="true"
                 docBase="C:/solapcore/apacheTest/test/app"
                 workDir="C:/solapcore/apacheTest/test/app/work"
                 override="true">

  <Loader
                className="org.apache.catalina.loader.WebappLoader"
                delegate="false"
                useSystemClassLoaderAsParent="false"
                
loaderClass="org.apache.catalina.loader.WebappClassLoader" />
</Context>

I don't know if It is normal that the default value of the 
useSystemClassLoaderAsParent attribute is not the same value as used 
when "skipping" the Loader component? I didn't found any config file 
anywhere overwritting the default values.


Eric

Eric Guinois a écrit :
> Hi,
>    I'm trying to use my own ClassLoader for my Web-Application. I 
> google a long time and find that the Loader component in the Context 
> component could help me to replace the ClassLoader of my web 
> application (subclassing WebappClassLoader).
>
>    In the first place, I tried to use the default parameters for the 
> Loader component. My context file 
> ($CATALINA_HOME/conf/engine/host/context.xml)  was
>
> <Context path="/app"
>                 reloadable="true"
>                 docBase="C:/apacheTest/test/app"
>                 workDir="C:/apacheTest/test/app/work" />
>
> and my application were loading and working properly.
>
> When I change to
>
> <Context path="/app"
>                 reloadable="true"
>                 docBase="C:/apacheTest/test/app"
>                 workDir="C:/apacheTest/test/app/work" >
> <Loader
>                className="org.apache.catalina.loader.WebappLoader"
>                delegate="false"
>                
> loaderClass="org.apache.catalina.loader.WebappClassLoader" />
> </Context>
>
>
> I always got this error in the console :
>
> 2007-03-01 16:37:19 org.apache.catalina.core.StandardContext start
> GRAVE: Error listenerStart
> 2007-03-01 16:37:19 org.apache.catalina.core.StandardContext start
> GRAVE: Erreur de dÚmarrage du contexte [/app] suite aux erreurs 
> prÚcÚdentes
>
> I googled and searched for information with this error and googled for 
> example using Loader component without any success.
>
> How can I use the Loader component properly?
>
> I'm using Tomcat 5.5.20 and tried it only under Windows.
>
> Thank you in advance for your time.
>
> Eric Guinois
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Loader component nested in Context

Posted by Eric Guinois <gu...@icod.ca>.
I just founded these messages and stack trace inside localhost.DATE.log. 
(a lot of times with different listeners)

2007-03-01 17:48:23 org.apache.catalina.core.StandardContext listenerStart
GRAVE: Erreur lors de la configuration de la classe d'écoute de 
l'application (application listener) 
com.icod.ACME.init.ConnectionProviderConfigurator
java.lang.NoClassDefFoundError: javax/servlet/ServletContextListener
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at 
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1815)
    at 
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:869)
    at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1322)
    at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1201)
    at 
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3711)
    at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4211)
    at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
    at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
    at 
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:608)
    at 
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:535)
    at 
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
    at 
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
    at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
    at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
    at 
org.apache.catalina.core.StandardService.start(StandardService.java:450)
    at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)

And these messages occurs only when I add the Loader component inside my 
context descriptor.

Otherwise my localhost.DATE.log contain only information messages 
(example below) and my context is starting up properly.

2007-03-01 23:53:31 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()

Eric


Caldarale, Charles R a écrit :
>> From: Eric Guinois [mailto:guinoise@icod.ca] 
>> Subject: Loader component nested in Context 
>>
>> 2007-03-01 16:37:19 org.apache.catalina.core.StandardContext start
>> GRAVE: Error listenerStart
>> 2007-03-01 16:37:19 org.apache.catalina.core.StandardContext start
>> GRAVE: Erreur de dÚmarrage du contexte [/app] suite aux 
>> erreurs prÚcÚdentes
>>     
>
> What do the "erreurs précédentes" say about the initial problem?
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>   

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Loader component nested in Context

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Eric Guinois [mailto:guinoise@icod.ca] 
> Subject: Loader component nested in Context 
> 
> 2007-03-01 16:37:19 org.apache.catalina.core.StandardContext start
> GRAVE: Error listenerStart
> 2007-03-01 16:37:19 org.apache.catalina.core.StandardContext start
> GRAVE: Erreur de dÚmarrage du contexte [/app] suite aux 
> erreurs prÚcÚdentes

What do the "erreurs précédentes" say about the initial problem?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org