On Friday, May 10, 2002, at 08:03 AM, Gerhard Froehlich wrote:

> Stuart Roebuck wrote:
>> I'm trying to install a new 'user' component into Cocoon 2 but I'm 
>> hitting a problem which I can't seem to get a handle on:
>> Basically, I'm getting a the following stack dump:
>>> ERROR   (2002-05-09) 19:03.08:176   [sitemap.generator.database-
>>> access](/about_us_index.html) 
>>> HttpProcessor[8080][4]/DatabaseAccessGenerator: Can't get 
>>> DatabaseAccessManager component
>>> org.apache.avalon.framework.component.ComponentException: Could not 
>>> find component
>>>         at 
>>> org.apache.avalon.excalibur.component.ExcaliburComponentManager.lookup
>>> (ExcaliburComponentManager.java:335)
>>>         at org.apache.cocoon.components.CocoonComponentManager.lookup
>>> (CocoonComponentManager.java:175)
>>>         at 
>>> 
>org.apache.avalon.excalibur.component.DefaultComponentFactory$ComponentManagerProxy.
>>> lookup(DefaultComponentFactory.java:323)
>>>         at 
>>> 
>org.apache.avalon.excalibur.component.DefaultComponentFactory$ComponentManagerProxy.
>>> lookup(DefaultComponentFactory.java:323)
>>>         at 
>>> com.adolos.cocoon.generation.DatabaseAccessGenerator.compose
>>> (DatabaseAccessGenerator.java:94)
>>> ...
>> My new DatabaseAccessGenerator (generator) is composable and uses the 
>> given manager to lookup the new component called 
>> DatabaseAccessManager.  This component is defined in my my.roles file:
>>> <?xml version="1.0"?>
>>> <role-list>
>>>   <role name="com.adolos.cocoon.util.DatabaseAccessManager"
>>>         shorthand="database-access-manager"
>>>         default-class="com.adolos.cocoon.util.DatabaseAccessManager"/>
>>> </role-list>
>> The my.roles file is referenced in my cocoon.xconf file as:
>>> <cocoon version="2.0" user-roles="/WEB-INF/my.roles">
>> This appears to be being accessed, as prior to putting in the 
>> preceding forward-slash this reference threw a runtime error as well.
>> The cocoon.xconf file also has an entry for the component like this 
>> (I'm not sure if this is really necessary):
>>>   <database-access-manager 
>>> class="com.adolos.cocoon.util.DatabaseAccessManager" 
>>> logger="core.database.access" />
>> I have some logging in place and I know that the compose and configure 
>> methods of my DatabaseAccessManager component are called prior to any 
>> attempt to use the component.
>> But, when my DatabaseAccessGenerator attempts to lookup the component 
>> it throws the 'Could not find component' exception listed above (top).
>> I've checked and double-checked that the role names match up 
>> throughout.
>> Any thoughts?
>
> Blind shot. Do you have a work interface for your DatabaseAccessManager?

Thank you for a suggestion - I'm not sure what you mean by a 'work 
interface'.  Do you mean 'ThreadSafe', 'Poolable', etc. ?  Here is the 
class declaration:

> public class DatabaseAccessManager extends AbstractLoggable implements 
> Composable, Configurable, ThreadSafe {
>

Here's the call to look up the component, the exception is thrown in the 
lookup:

>     public void compose(ComponentManager manager) throws 
> ComponentException {
>         super.compose(manager);
>         try {
>             this.dam = (DatabaseAccessManager) 
> this.manager.lookup(DatabaseAccessManager.ROLE);
>         } catch (ComponentException e) {
>             getLogger().error("Can't get DatabaseAccessManager 
> component", e);
>             this.dam = null;
>         }
>     }

I've done some further debugging and I've established that the manager 
and this.manager objects (which are identical at the time of the lookup 
call) contain an entry for the DatabaseAccessManager role in the parent 
manager.  Could there be any issue with the lookup only discovering 
things in the immediate manager?

The other thought was whether there could be any problems arising in 
creating the instance of the DatabaseAccessManager, and if there was a 
problem, whether the error message would be different or whether 'Could 
not find component' could mean this as well.

Stuart.

            Public Key - 1024D/88DD65AF 2001-11-23 Stuart Roebuck (Adolos)
      Key fingerprint = 89D9 E405 F8B1 9B22 0FA2  F2C1 9E57 5AB1 88DD 65AF
-------------------------------------------------------------------------
Stuart Roebuck                                  [EMAIL PROTECTED]
Systems Architect                             Java, XML, MacOS X, XP, 
etc.
ADOLOS                                           <http://www.adolos.com/>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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

Reply via email to