On Friday, May 10, 2002, at 11:30 AM, Gerhard Froehlich wrote:
> Stuart Roebuck wrote: >> 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 { > > Every Avalon Component must implement a work interface, in your case: > > package your.package; > > import org.apache.avalon.framework.component.Component; > > public interface DatabaseAccessManager extends Component { > > String ROLE = your.package.DatabaseAccessManager "; > > //your methods and fields > } > > public class DatabaseAccessManagerImpl > extends AbstractLoggable > implements DatabaseAccessManager, > Parameterizable, Composable, Disposable, ThreadSafe { > > //your class goes here > } > > You see what I mean. There interface name is the same as you > define in your roles.conf. Important is the String ROLE in the > DatabaseAccessManager interface. Now the ComponentManager should > find your component. > > Refer to: > <http://jakarta.apache.org/avalon/developing/index.html> > > I hope that helps! Very much - thank you! I wasn't aware of that bit of extra documentation - I had gone to the page: <http://jakarta.apache.org/avalon/framework/index.html> which has an explanation on "What is a Component?" and "Designing a Component" but these texts aren't anywhere near as detailed as the one you mentioned. It might be good to have a link to the "Developing with Apache Avalon" guide from that page. Okay... off to make the changes. :-) 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]>