Return-Path: Delivered-To: apmail-jakarta-avalon-dev-archive@apache.org Received: (qmail 88946 invoked from network); 30 Jan 2002 08:54:48 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 30 Jan 2002 08:54:48 -0000 Received: (qmail 5764 invoked by uid 97); 30 Jan 2002 08:54:12 -0000 Delivered-To: qmlist-jakarta-archive-avalon-dev@jakarta.apache.org Received: (qmail 5713 invoked by uid 97); 30 Jan 2002 08:54:11 -0000 Mailing-List: contact avalon-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Avalon Developers List" Reply-To: "Avalon Developers List" Delivered-To: mailing list avalon-dev@jakarta.apache.org Received: (qmail 5652 invoked from network); 30 Jan 2002 08:54:11 -0000 Message-Id: <200201300854.g0U8sAE14755@mail016.syd.optusnet.com.au> Content-Type: text/plain; charset="utf-8" From: Peter Donald To: "Avalon Developers List" Subject: Re: Minor bug in ExcaliburComponentSelector when there is a configuration problem Date: Wed, 30 Jan 2002 19:41:56 +1100 X-Mailer: KMail [version 1.3.2] References: <3C57AFE4.2030209@silveregg.co.jp> In-Reply-To: <3C57AFE4.2030209@silveregg.co.jp> X-Wisdom-Cookie: . MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N works for me. On Wed, 30 Jan 2002 19:33, Leif Mortenson wrote: > I wanted whoever wrote the ExcaliburComponentSelector (Berin?) to take a > look at this and decide whether or not to fix it before the release (It > can probably wait). Given that this is a critical class. > > I had a configuration error in my components.xml file. It was in a jdbc > definition within a datasources selector block. When I tried to start > the application, the DataSource threw a ConfigurationException on > startup. The problem is, that this is the stack trace that gets dumped. > > --- > 1012378110164 ERROR [cm ]: The component instance for > 'asp-service-visitor-cluster' has an invalid class name. > org.apache.avalon.framework.component.ComponentException: Could not set > up Component for hint: asp-service-visitor-cluster > at > org.apache.avalon.excalibur.component.ExcaliburComponentSelector.addCompone >nt(ExcaliburComponentSelector.java:465) at > org.apache.avalon.excalibur.component.ExcaliburComponentSelector.configure( >ExcaliburComponentSelector.java:354) at > org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(D >efaultComponentFactory.java:172) at > org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize >(ThreadSafeComponentHandler.java:84) at > org.apache.avalon.excalibur.component.ExcaliburComponentManager.lookup(Exca >liburComponentManager.java:331) at > com.silveregg.nikko.rserver.service.DatabaseProfileRepository.initialize(Da >tabaseProfileRepository.java:151) at > org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(D >efaultComponentFactory.java:183) rethrown from > org.apache.avalon.framework.configuration.ConfigurationException: > Expected a dbpool with index="2" > at > org.apache.avalon.excalibur.datasource.cluster.AbstractDataSourceCluster.co >nfigure(AbstractDataSourceCluster.java:145) at > org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(D >efaultComponentFactory.java:172) at > org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize >(ThreadSafeComponentHandler.java:84) at > org.apache.avalon.excalibur.component.ExcaliburComponentSelector.addCompone >nt(ExcaliburComponentSelector.java:448) at > org.apache.avalon.excalibur.component.ExcaliburComponentSelector.configure( >ExcaliburComponentSelector.java:354) at > org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(D >efaultComponentFactory.java:172) at > org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize >(ThreadSafeComponentHandler.java:84) --- > > This error message is misleading because it says that a class was > misnamed, when the real problem was a configuration exception. > The problem is being caused by the following code in > ExcaliburComponentSelector.configure(). The call to addComponent is > throwing a ConfigurationException. > --- > try > { > final Class clazz = m_loader.loadClass( className ); > addComponent( hint, clazz, instances[i]); > } > catch( final Exception e ) > { > final String message = > "The component instance for '" + hint + "' has an invalid class name."; > if (getLogger().isErrorEnabled()) > { > getLogger().error( message, e ); > } > > throw new ConfigurationException( message, e ); > } > --- > > I think that the code should be changed to something like this: > > --- > try > { > final Class clazz = m_loader.loadClass( className ); > addComponent( hint, clazz, instances[i]); > } > catch( final ClassNotFoundException e ) > { > final String message = > "The component instance for '" + hint + "' has an invalid class name."; > if (getLogger().isErrorEnabled()) > { > getLogger().error( message, e ); > } > > throw new ConfigurationException( message, e ); > } > catch( final Exception e) // Could just be ComponentException?? > { > final String message = > "The component instance for '" + hint + "' could not be initialized."; > if (getLogger().isErrorEnabled()) > { > getLogger().error( message, e ); > } > > throw new ConfigurationException( message, e ); > } > --- > > The ExcaliburComponentManager class has the same problem. > > Cheers, > Leif -- Cheers, Pete --------------------------------------- Be nice to your friends. If it weren't for them, you'd be a complete stranger. --------------------------------------- -- To unsubscribe, e-mail: For additional commands, e-mail: